Topic 3 of 5 · 5 min read
Paired comparisons between two versions
Goal: Compare two versions with a paired, per-case analysis instead of two independent averages.
When two versions run on the same cases, compare them case by case: only the cases where the result changed carry information. Hard questions are hard for both versions, so they cancel out of a paired analysis and the noise drops sharply.
Check yourself · 1 of 3
In a paired comparison of two prompts on the same cases, which cases carry the information?
Why it matters
Two independent averages mix two kinds of variation: the difference between versions, which you want, and the difference between easy and hard questions, which you do not. Pairing removes the second kind.
How to do it
- Run both versions on the identical case list and record pass or fail per case.
- Count four groups: both pass, both fail, only A passes, only B passes. The last two are the flips.
- Ignore the cases that did not flip. Among the flips, ask whether B wins more often than a fair coin would give. This is McNemar's test, or an exact sign test.
An example with 200 cases:
| B passes | B fails | |
|---|---|---|
| A passes | 138 | 12 |
| A fails | 24 | 26 |
A passes 150 (75 percent) and B passes 162 (81 percent). There were 36 flips; B won 24 of them. The z score is (24 - 12) / sqrt(36) = 2.0, which is just significant at 5 percent. Treated as two independent averages, the same data give a standard error of the gap of about 4.1 points, so z is about 1.4: not significant. Pairing found the signal.
Also keep the flip list. Reading the 12 cases that B broke tells you what the change costs, which a score cannot.
Cluster related cases
Cases are not always independent. Ten questions about one document, or variants of one template, move together. Treat each group as one unit when you compute errors (clustered standard errors, or resample whole groups). Otherwise your intervals come out too narrow.
Before and after
Before: "A scored 75 percent, B scored 81 percent, so B wins."
After: "Of 200 cases, B fixed 24 and broke 12 (exact sign test p about 0.05). Net gain 12 cases, with the 12 regressions listed in the appendix."
What goes wrong
- Comparing runs on different case lists. Pairing needs the same inputs.
- Counting all 200 cases in the test. Only the flips matter in McNemar's test.
- Ignoring clusters. Related cases make the result look more certain than it is.
Examples
24 fixes, 12 breaks
A model upgrade fixes 24 cases and breaks 12 out of 200. The headline gain is 6 points, but the breaks are all refund-policy questions. The team ships with a guardrail on refunds rather than trusting the net score.
One document, ten questions
An eval has 300 questions drawn from 30 contracts, 10 each. The real sample is closer to 30 independent units than 300. Resampling whole contracts gives an interval about twice as wide as the naive one.
Key points
- Run both versions on the same cases and compare per case, not two separate averages.
- Only flips (cases where one version passes and the other fails) carry information about the difference.
- A paired test often detects a gap that two independent averages cannot, because question difficulty cancels.
- Keep and read the list of cases the new version broke: a net gain can hide a serious regression.
- Treat related cases (same document, same template) as clusters so intervals are not too narrow.
Common mistakes
- Using two independent averages when both versions ran on the same cases.
- Throwing away the flip list and keeping only the aggregate.
- Counting the cases both versions pass or fail as evidence in the test.
- Treating 10 questions about one document as 10 independent samples.
Check yourself · 2 of 3
Version B fixes 10 cases and breaks 2 on the same 150 cases. What should you do besides noting the net gain?
Check yourself · 3 of 3
An eval has 200 questions, 10 per source document (20 documents). Why can naive error bars be too narrow?
Practice items, not counted towards your mastery.
Start here
- A statistical approach to model evaluations (Anthropic) (opens in a new tab)ArticleFree
Standard errors, paired differences, clustering and power analysis applied to model evals, in plain terms.
- Adding Error Bars to Evals (Miller, 2024) (opens in a new tab)PaperFree
The paper behind the article: formulas for clustered errors, paired tests, resampling and power.
- A/B test sample size calculator (Evan Miller) (opens in a new tab)ToolFree
Enter a baseline rate and the smallest difference you care about, and read off the sample size.
More for this topic
- McNemar's test (Wikipedia) (opens in a new tab)ArticleFree
The paired test for pass/fail on the same cases: only the cases that flipped count.