Parity
Statistical testing for LLM endpoints: is the server really running those weights?
$ parity run --model Qwen/Qwen3-0.6B --target http://127.0.0.1:8081Running suite 'core' (reference hf:local) template.token_counts PASS distribution.teacher_forced PASS greedy.agreement PASS sampler.conformance PASS longctx.needle PASS tools.structured PASSVerdict: PASS. No deviation from the reference was detected.The problem
Quantized weights, a broken chat template, ignored sampling parameters and silently truncated prompts all still produce fluent text. You can't catch them by reading outputs.
Parity sends cheap probes to an OpenAI-compatible endpoint, runs the same inputs through a pinned reference implementation of the same open-weight model, and uses statistics to decide whether the two differ by more than benign numerical noise.
What it does
- Six probes, cheapest first: chat template, teacher-forced distribution, greedy agreement, sampler conformance, long-context needle and structured tool calls.
- Three verdicts only: PASS, DEVIATION or INCONCLUSIVE, with exit codes 0, 1 and 2 for CI.
- Calibration against known-good deployments that differ in harmless ways, so honest changes aren't flagged.
- Every report lists what the result does not prove.
- Faults injected into a real llama.cpp deployment (Q8_0, Q4_K_M and Q2_K weights, wrong templates, dropped sampling parameters, smaller context) were detected in every repetition of the validation study.
How it works
- 1
Probes send token-id prompts where the server accepts them, so the endpoint and the reference see exactly the same tokens.
- 2
Evidence is judged with calibrated thresholds, sequential tests (SPRT), bootstrap confidence intervals and Holm–Bonferroni correction.
- 3
With --fail-fast, a DEVIATION can be reached after as few as seven requests.
Decisions worth noting
Never guess
When evidence is thin, Parity says INCONCLUSIVE instead of picking a side. A verdict is evidence, not a certificate.
More views
