# Small validation tools

Run from the repository root with Node 18+:

```sh
node experiments/validation/worker-contracts.cjs
node experiments/validation/harness-contracts.cjs
python3 experiments/validation/summary-contracts.py
python3 scripts/summarize_results.py
```

The Node checks mock tokenizer, GPU engine, ONNX tensors/session, cache failures, workers and DOM controls. They validate asynchronous application contracts without downloading weights or running GPU inference. They do **not** establish numerical model correctness or browser/device compatibility.

`worker-contracts.cjs` covers first-token delivery, packed revision/tuning metadata, incompatible loaded profiles, cancellation during tokenizer load and partial prefill, ONNX cache quota recovery and tensor cleanup.

`harness-contracts.cjs` covers competing clicks, stopping a multi-run suite, cancelling a pending load by worker termination, restoring controls, and forwarding a changed tuning profile.

The Python summarizer reads saved browser events and small reference logit files. It regenerates `results/browser-summary.json` and `results/browser-parity.json`; missing references remain explicitly unavailable. It never downloads or transforms model weights.

`summary-contracts.py` checks that Gram variants cannot silently match baseline references, conflicting revision/variant URLs are rejected, exact input IDs are required, missing binary references stay unavailable, and the complete-logit metric formulas behave correctly.

In a published HF clone, source is under `source/` and evidence at `../results/`.
Use `python3 scripts/summarize_results.py --events ../results/browser-events.jsonl --references ../results/reference --output-dir results/reproduced` from `source/`.
