Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Evaluation (eval) | A fixed set of questions or tasks with a way to score the answers. |
| Paired comparison | Running both systems on the same questions and comparing question by question. |
| Flip | A question one system gets right and the other gets wrong (Dutta et al., 2024). |
| Confidence interval (CI) | A range that, with stated confidence (often 95%), contains the true difference. |
| p-value | How likely a difference at least this large would be if there were no real difference. Small means “probably real”. |
| McNemar test | A test for paired yes/no outcomes that looks only at the questions that flipped. |
| Harness | The program that sends eval questions to a model, collects answers and scores them. |
1. What is it?#
The practice of deciding, with evidence, whether a change to the serving stack changes quality: a new quantization (13.b–13.h), turning on speculative decoding (13.n), a kernel or library upgrade, an engine upgrade, a new sampler, a different tensor-parallel layout.
It differs from evaluating a model in one important way. A model evaluation asks “how good is this model?” A serving-change evaluation asks “is the candidate the same as the baseline, and if not, how different and where?” That needs paired comparisons, flip counts, enough questions to see small effects, and tests chosen for the kind of change. 13.b gave the four-level validation ladder for quantization; this lesson is the method behind each level, applied to any change.
Facts checked on 13 November 2026.
2. Why does it matter?#
Because the default practice, “run a benchmark on both, compare the two numbers”, fails in both directions:
- It misses real regressions. On 500 questions, a 1–2 point drop is inside the noise of two independent scores. Teams ship it, then see it in production.
- It invents regressions. A 1-point drop from a change that cannot change quality (a deterministic kernel refactor) sends engineers chasing noise.
- It hides answer changes. Dutta et al. (“Accuracy is Not All You Need”, NeurIPS 2024) show compressed models with near-identical accuracy whose individual answers changed substantially, and which were measurably worse in free-form generation. Users see answers, not averages.
3. Simple analogy#
Testing whether a new pair of glasses is better. Comparing your score on an eye chart today with someone else’s score yesterday tells you little: people differ more than lenses do. Reading the same chart with the old glasses and then the new, line by line, and noting which letters you now get wrong and which you now get right, tells you a lot. That is a paired comparison.
4. Tiny example: is the difference real?#
One evaluation of 500 questions, run on the baseline and on four candidates, scored question by question. The flip counts are illustrative, chosen to show the typical shapes, not measurements of real models.
// paired.go — is a serving change's accuracy difference real? Paired statistics for
// one evaluation run on the baseline and the candidate, question by question.
package main
import (
"fmt"
"math"
)
// binomTwoSided is the exact two-sided McNemar test: under "no real difference",
// each of the b+c discordant questions is equally likely to be a loss or a gain.
func binomTwoSided(b, c int) float64 {
n, k := b+c, min(b, c)
tail := 0.0
for i := 0; i <= k; i++ {
lg, _ := math.Lgamma(float64(n + 1))
l1, _ := math.Lgamma(float64(i + 1))
l2, _ := math.Lgamma(float64(n - i + 1))
tail += math.Exp(lg - l1 - l2 - float64(n)*math.Ln2)
}
return min(1, 2*tail)
}
func report(name string, n, baseCorrect, lost, gained int) {
cand := baseCorrect - lost + gained
pa, pb := float64(baseCorrect)/float64(n), float64(cand)/float64(n)
diff := pb - pa
// Unpaired: treats the two runs as independent samples (what a leaderboard comparison does).
seUnpaired := math.Sqrt(pa*(1-pa)/float64(n) + pb*(1-pb)/float64(n))
// Paired: only the questions that changed carry information about the difference.
d := float64(gained - lost)
sePaired := math.Sqrt(float64(lost+gained)-d*d/float64(n)) / float64(n)
fmt.Printf("%s\n accuracy %.1f%% -> %.1f%% (%+.1f pts); flips: %d lost, %d gained (%.1f%% of questions changed)\n",
name, 100*pa, 100*pb, 100*diff, lost, gained, 100*float64(lost+gained)/float64(n))
fmt.Printf(" 95%% CI unpaired ±%.1f pts, paired ±%.1f pts; McNemar exact p = %.2g\n",
100*1.96*seUnpaired, 100*1.96*sePaired, binomTwoSided(lost, gained))
}
func main() {
const n = 500
report("A. FP8 weights and activations", n, 355, 9, 7)
report("B. 4-bit weights, aggressive", n, 355, 22, 15)
report("C. broken kernel on long prompts", n, 355, 31, 6)
report("D. same as B, ten times the questions", 10*n, 3550, 220, 150)
}Output:
A. FP8 weights and activations
accuracy 71.0% -> 70.6% (-0.4 pts); flips: 9 lost, 7 gained (3.2% of questions changed)
95% CI unpaired ±5.6 pts, paired ±1.6 pts; McNemar exact p = 0.8
B. 4-bit weights, aggressive
accuracy 71.0% -> 69.6% (-1.4 pts); flips: 22 lost, 15 gained (7.4% of questions changed)
95% CI unpaired ±5.7 pts, paired ±2.4 pts; McNemar exact p = 0.32
C. broken kernel on long prompts
accuracy 71.0% -> 66.0% (-5.0 pts); flips: 31 lost, 6 gained (7.4% of questions changed)
95% CI unpaired ±5.7 pts, paired ±2.3 pts; McNemar exact p = 4.1e-05
D. same as B, ten times the questions
accuracy 71.0% -> 69.6% (-1.4 pts); flips: 220 lost, 150 gained (7.4% of questions changed)
95% CI unpaired ±1.8 pts, paired ±0.8 pts; McNemar exact p = 0.00032What to read from it:
- Pairing shrinks the uncertainty by a factor of 2–3. Comparing two independent scores, a 5-point drop (C) sits right at the edge of the ±5.7-point interval. Paired, it is unmistakable (p = 0.00004).
- B and C changed the same number of answers (7.4%). The flip rate tells you how different the systems are; the balance of losses and gains tells you whether one is worse.
- B’s 1.4-point drop is not significant on 500 questions, and is on 5,000 (D). “Not significant” means “this eval cannot see it”, not “it is not there”. Size the eval for the smallest drop you care about.
- A still changed 16 answers without any accuracy effect. That is the normal footprint of a good FP8 change: near-tie flips in both directions.
5. Technical explanation#
Paired statistics, in practice#
FOR EACH EVAL QUESTION i: base_i ∈ {0,1}, cand_i ∈ {0,1} (or a continuous score)
lost = #(base=1, cand=0) gained = #(base=0, cand=1)
DIFFERENCE (gained − lost) / n
TEST exact McNemar (binomial on lost vs lost+gained) or
paired bootstrap: resample questions, recompute the difference
REPORT difference with 95% CI, flips lost/gained, flip rateHow many questions? With a paired test, the noise depends on how many questions flip. If about
f of questions flip, the paired 95% interval on the difference is roughly ±1.96·√(f/n). To
detect a 1-point drop with a 4% flip rate you need 1.96·√(0.04/n) ≤ 0.01, so n ≈ 1,500
questions. Most public benchmarks have a few hundred; combine several, or build your own from
production traffic.
Sampling noise: one run is not enough#
With temperature above 0, each run of the eval is itself random. Two runs of the baseline will flip some answers. Handle it:
- Run the generative evals greedy and at the production temperature.
- At production temperature, run several seeds (or k samples per question) and compare per-question pass rates (for example out of 8 samples) rather than single answers. The gpt-oss verification guide does this: 16 attempts per AIME problem, 8 per GPQA question.
- Use the deterministic mode (28.c) for the baseline-versus-baseline noise floor: it tells you how many flips your eval produces from batching alone.
- A/A test first. Run baseline against baseline. If that shows “significant” differences, your setup (harness, sampling, server load) is the problem.
Evaluate through the server, not around it#
Run the harness against the deployed endpoint, with the real chat template, tokenizer and sampler. An offline evaluation in a notebook tests the weights; your users get the server. EleutherAI’s lm-evaluation-harness (v0.4.13, released 31 August 2026) supports this:
pip install "lm_eval[api]"
lm_eval --model local-completions \
--model_args model=my-org/model-70b,base_url=http://localhost:8000/v1/completions,num_concurrent=16,tokenized_requests=False \
--tasks gsm8k,ifeval --apply_chat_template \
--log_samples --output_path results/candidate --seed 1234local-completionssupports log-likelihood tasks (multiple choice) as well as generation;local-chat-completionssupports generation tasks only (the harness lists no log-likelihood support for chat endpoints).--apply_chat_templateformats prompts with the model’s template (and, by default, few-shot examples as a multi-turn chat). Without it you are evaluating a chat model on raw text, which is not how it is served.--log_sampleswrites every question, answer and score: the input to the paired analysis. Never keep only the summary number.
Use the same harness version, task versions, prompt format and generation settings for both sides. Changing any of them changes the scores more than most serving changes do.
What to test, by type of change#
CHANGE NUMERICAL (28.e) TASK (paired, this lesson) BEHAVIOUR
Kernel / library upgrade per-layer error (28.b), paired evals; expect flips spot-check long outputs
teacher-forced KL ≈ noise ≈ A/A noise floor
FP8 weights + activations KL small, top-1 ≥ 99% paired evals on your tasks long generations
4-bit weights, low-bit KV KL by position and by paired evals, larger n; long- tool calls, JSON validity,
context length context and reasoning tasks refusal rate, output length
Speculative decoding greedy: token-identical sampled: distribution test acceptance rate is speed,
except at near-ties (below) not quality
Sampler change logprobs unchanged; sampled distribution test stop behaviour, length
Engine upgrade all of the above, plus template and tokenizer diff (28.f)
TP/EP layout change KL ≈ noise paired evals ≈ A/A none expectedSpeculative decoding: test the distribution#
Speculative decoding is exact in distribution (12.n), so a quality evaluation has little to say: the eval cannot be better or worse than the target model, only noisier. What can go wrong is the implementation: a rejection sampler that ignores top-p, a draft that uses a different chat template, a bonus token sampled at the wrong temperature. Those make the distribution wrong. Test that directly:
1. GREEDY: 200 prompts, spec on vs off, 500 tokens each. Expect identical tokens except at
near-ties (28.a). Any divergence where the reference margin is large is a bug.
2. SAMPLED: for 20 prompts, draw 2,000 samples of the next 1–3 tokens with spec on and off,
same sampling parameters. Compare the token histograms (chi-square or a two-sample test).
Repeat with top-k, top-p, min-p and penalties set, because each is a place the rejection
sampler must apply the same transformation.
3. LOGPROB: score the spec-on outputs under the target model (prompt logprobs, 28.e). Their
average logprob should match spec-off outputs' within noise.vLLM documents the same idea for its own tests: a rejection sampler convergence test and greedy equality tests, with the caveat that batch size and numerics can still shift logprobs.
Quantization: where to look for damage#
Quantization error is small per token and compounds over long outputs (11.k, 13.b). Averaged benchmarks with short answers hide it. Look where it concentrates:
- Long generations and reasoning traces (thousands of tokens): measure accuracy as a function of output length.
- Long contexts, especially with a quantized KV cache (13.h): retrieval and multi-document tasks at your longest served context.
- Structured output and tool calls: schema validity and argument accuracy. Moonshot’s K2 Vendor Verifier measures exactly this (tool-call trigger similarity and schema accuracy) across providers serving the same model.
- Languages and domains that are rare in the calibration set (24.d).
- Refusals and safety behaviour, which can shift in either direction.
6. Under the hood: why pairing works#
Questions vary enormously in difficulty. Most are easy (both systems right) or hard (both wrong). Those questions add noise to each system’s score but carry no information about the difference: they agree. Unpaired comparison pays for the full variance of each score; paired comparison cancels the shared part and keeps only the flips.
Formally, Var(cand − base) = Var(cand) + Var(base) − 2·Cov(cand, base), and the covariance is
large because both systems are nearly the same model. The more similar the systems, the larger the
covariance and the bigger the gain from pairing, which is exactly the situation of a serving
change.
The same argument says do not compare against a stored score from last month: a different run of the harness, task version or prompt format breaks the pairing. Store per-question results and re-run the baseline when anything in the harness changes.
7. Performance implications#
- Evals cost GPU time. 2,000 questions × 2 systems × 8 samples at a few hundred tokens each is millions of tokens: affordable for a release, not for every commit. Tier them: a fast numerical check (28.e) on every change, the paired task suite on release candidates, the long-generation and tool-call suites on precision and engine changes.
- Run evals at production concurrency. The candidate’s batch sizes, chunking and kernel choices at load are what users get; a batch-1 eval tests a different numerical path (28.c).
- Speed and quality are judged separately. Benchmark throughput and latency with the methods of 22.g; never accept a quality result measured on a configuration different from the one you benchmarked.
8. Production implications#
- Every serving change ships with a quality report: flips lost and gained, paired difference with its interval, A/A noise floor, and the behaviour checks. Store it with the release.
- Set decision rules before you look: for example “ship if the paired 95% interval excludes a drop larger than 1 point on each suite, and JSON validity and tool-call accuracy are within the A/A noise”. Deciding after seeing results invites rationalizing.
- Build an eval set from your own traffic (with consent and privacy controls): a few thousand representative prompts with reference answers or graded rubrics. Public benchmarks measure someone else’s workload.
- Keep evaluating after release. Canary guards (23.g) cover the first hours; a scheduled run of the paired suite against the production endpoint catches configuration drift, routing mistakes and bad deploys later, the lesson Anthropic drew from its September 2025 incidents.
- When you consume a model from a provider, run the same paired suite against the provider and against the model author’s reference, as the gpt-oss guide and the K2 Vendor Verifier do.
9. Common mistakes#
- Comparing two summary scores instead of per-question results.
- Too few questions for the effect you care about, then reading “not significant” as “no effect”.
- No A/A baseline, so harness noise is mistaken for a regression.
- Evaluating the weights offline instead of the deployed server with its template and sampler.
- Using acceptance rate as evidence of speculative-decoding correctness. It measures speed.
- Short-answer benchmarks only for a quantization change. Damage shows in long outputs, long contexts and tool calls.
- Changing the harness version or prompt format between the two runs.
- Deciding the threshold after seeing the result.
10. Hands-on exercise#
- Run
paired.go. Find the smallest number of questions at which candidate B’s drop becomes significant at p < 0.05, keeping the same flip rates. - Add a paired bootstrap (resample questions 10,000 times) and compare its interval with the formula.
- Serve a model twice, identical configuration, and run lm-evaluation-harness against both with
--log_samples. Count flips (your A/A noise floor), greedy and at temperature 0.7. - Repeat with an FP8 or 4-bit version of the same model. Is the flip count above the A/A floor? Are the lost and gained flips balanced?
- Implement the speculative-decoding distribution test of section 5 with a small target and draft model. Then deliberately break the rejection sampler (ignore top-p) and confirm the test fails.
11. Interview questions#
- Why is “both configurations scored 71% on the benchmark” not evidence they are equivalent?
- Explain why a paired comparison is more sensitive than comparing two scores.
- How many eval questions do you need to detect a 1-point regression? What does it depend on?
- How would you show that a speculative decoding implementation is correct?
- Where does quantization damage hide, and how would you design an eval to find it?
- What is an A/A test and why run it before every evaluation of a change?
- Why evaluate through the serving endpoint rather than with the model in a notebook?
12. Further reading#
Checked on 13 November 2026.
- Dutta et al., “Accuracy is Not All You Need” (arXiv 2407.09141)
- EleutherAI lm-evaluation-harness (v0.4.13, 31 August 2026)
- lm-evaluation-harness, API and local-server models guide
- OpenAI cookbook, “Verifying gpt-oss implementations”
- Moonshot AI, K2 Vendor Verifier
- vLLM v0.32.0 docs, speculative decoding (lossless guarantees)
- Miller, “Adding Error Bars to Evals: A Statistical Approach to Language Model Evaluations” (arXiv 2411.00640)
- Validation ladder for quantization: 13.b. Speculative decoding deployment: 13.n. Rollout guards: 23.g. Benchmarking speed: 22.g.