Key takeaways
- ✓A test score is a sample. A simulated system that truly gets 80% right, tested again and again on 30 fresh cases, scored anywhere from 17 to 25 in its first 8 tests. With no change at all, a second test beats the first by 10 points or more about 1 time in 5.
- ✓Report every score as a range with its number of cases: '22 of 30, 95% confidence interval 56% to 86%'. The 95% describes the method: across many tests, about 95 ranges in 100 contain the truth. You never know whether yours is one of them.
- ✓The margin (half the range's width) shrinks with the square root of the number of cases. Half the margin costs four times the cases: ±8% at a 90% pass rate needs 55 cases, ±4% 217, ±2% 865, ±1% 3,458. Going from 100 to 200 cases narrows the margin by 1.7 points; going from 1,000 to 1,100, by 0.09.
- ✓The simplest formula (Wald: score ± 1.96 × √(score × (1 − score) ÷ cases)) breaks near 0% and 100%: 20 of 20 gives '100% ± 0', and at 20 cases it contains a 99% system's truth only 18% of the time. Use the Wilson interval for pass rates: 20 of 20 gives 83.9% to 100%, and its coverage was 98% in the same spot.
- ✓To judge a change, compute one range for the improvement itself, not two ranges side by side. If it includes zero, the test can't tell the change from noise. On different cases, Newcombe's interval (built from two Wilson intervals) does this. 2 of the 7 changelog wins cleared zero, both on 400–500 cases.
- ✓'Could be noise' isn't 'it didn't help'. Say '+10 points on 30 cases, somewhere between −9 and +29', then test on more cases, or run both versions on the same cases (a paired comparison) so the luck of which cases were drawn cancels out.
Our team builds an AI assistant, and this is its changelog: seven changes in one summer, each one raised the test score and was announced as a win. Only two of them clearly beat luck. The biggest, a new way to cut documents into pieces for search, scored +10 points on 30 test cases, and the range of improvements that score is consistent with runs from an 8.8-point loss to a 28.5-point gain. This chapter shows why a test score wobbles, how to put a range on it, what that range promises, where the simplest formula for it breaks, and how to tell whether a win holds up.
The examples come from Lab 02 (How Many Evals?) of the eval labs, three of its five scripts: 01_shrinking_interval.py (one simulated system tested at 20 to 1,000 cases, once and then 1,000 times), 02_when_wald_breaks.py (where the simplest interval formula gives nonsense, and how often a "95%" interval really contains the truth) and the third exercise of 05_your_results.py (the changelog). The interval code is the lab's shared evalkit/stats.py. Most of this is simulation, on purpose: a simulated system has a true pass rate you choose (90% in the lab), so you can see how far a score lands from it. The changelog is a made-up example. The re-tests of an 80% system on 30 cases come from the video for this episode, generated with the lab's own functions; they're simulated too. Not covered here: 03_bootstrap.py (the bootstrap, a resampling trick for metrics with no formula; one paragraph below), 04_metric_types.py (averages of 1–5 scores against pass rates, and how sure a ranking is) and the first two exercises of 05_your_results.py (intervals on earlier labs' recorded results). Chapter 2 turns this chapter around: how many cases you need for a given precision, worked out before you run the test.
What a score is
A test case is a question with a known right answer. You run the assistant on every case and count the right answers; that share is the score, also called the pass rate. A change in score is measured in points: 80% to 90% is +10 points.
The document-cutting change was tested on 30 cases. Before the change, 24 were right (80%). After it, on 30 different cases, 27 were right (90%). Ten points sounds big. It's three test cases.
The same system, tested again
What if the change did nothing at all? Think of a basketball player who makes 8 free throws in 10. Give her 30 shots and she won't make the same number every time: some days more, some fewer. Tests work the same way. Each test draws a fresh set of cases, and which cases you happened to draw moves the score. That luck of the draw is called noise.
To see it, take a simulated system that truly gets 80% right (like the assistant before the document change) and test it on 30 fresh cases, again and again, changing nothing. Its first 8 tests scored 22, 25, 24, 17, 21, 20, 25 and 24 of 30. With no change at all, how often does a second test beat the first by 10 points (3 cases) or more? Worked out exactly from the binomial distribution, the math of counting right answers when each is a coin flip with an 80% chance: 21% of the time, about 1 in 5. A +10 on 30 cases is something noise does often.
A system that truly gets 80% right, tested on 30 fresh cases each time
Like a shooter who makes 8 free throws in 10: give her 30 shots and she won't make the same number every time. Press the button to test the same system on 30 new cases.
Now 1,000 tests of the same system: how many tests got each score
Shaded: the middle 95 of 100 scores (2.5th to 97.5th percentile). The formula's margin is 1.96 × √(p(1−p)/n), half the width of the range it predicts. Four times the cases halve it: ±14.3% at 30 cases, ±3.9% at 400 (80% system); ±5.9% at 100, ±2.6% at 500 (90% system). 30 cases is the size of the document-cutting test in the changelog below; 400 is the re-sorting step's.
Now run the test 1,000 times and stack up the scores. That stack is the sampling distribution: where a score can land for a system whose true pass rate is fixed.
- 30 cases (80% system): the middle 95 of 100 tests scored 19 to 28 right, 63% to 93%.
- 400 cases (same system): the middle 95 landed between 76.5% and 83.8%.
The lab does the same for a 90% system, at six sizes, 1,000 evaluations each (01_shrinking_interval.py, Exercise 2):
| Cases | Lowest – highest score | Middle 95% of scores | Formula margin | Off by more than 5 points |
|---|---|---|---|---|
| 20 | 65% – 100% | 75.0% – 100.0% | ±13.1% | 25% |
| 50 | 74% – 100% | 82.0% – 98.0% | ±8.3% | 21% |
| 100 | 80% – 98% | 84.0% – 95.0% | ±5.9% | 6% |
| 250 | 82% – 95% | 86.0% – 93.6% | ±3.7% | 0.5% |
| 500 | 86% – 94% | 87.6% – 92.6% | ±2.6% | 0% |
| 1,000 | 86% – 93% | 88.1% – 91.7% | ±1.9% | 0% |
The "formula margin" is the textbook prediction of that spread: 1.96 × √(p × (1 − p) ÷ n), for a true pass rate p and n cases. It matches the simulated spread well from about 50 cases up. At 20 cases the scores pile up against 100%, so the spread is lopsided, not a symmetric bell; that matters in a moment.
Half the wobble costs four times the cases
The margin shrinks with the square root of the number of cases, so halving it takes four times the cases (Exercise 3, at a 90% pass rate):
| Margin wanted | Cases needed |
|---|---|
| ±8% | 55 |
| ±4% | 217 |
| ±2% | 865 |
| ±1% | 3,458 |
Like free throws: the more shots, the closer her score gets to her true skill, but each halving of the wobble costs four times the shots. The first extra cases buy the most. Going from 100 to 200 cases narrows the margin from ±5.9% to ±4.2%, 1.7 points; going from 1,000 to 1,100 narrows it by 0.09 points. These counts hold near a 90% pass rate; a system near 50% needs about 2.8 times as many for the same margin, because p × (1 − p) is largest there.
A range for every score
So one score is a guess. You've seen the fix in election polls: "48%, plus or minus 3". If scores land near the truth, then the truth is near your score. A range for where the truth could be is called a confidence interval, and the "plus or minus" is its margin, half its width. A 95% confidence interval is built by a method that, across many tests, contains the truth about 95 times in 100.
The first re-test above, 22 of 30, gets a 95% range of 56% to 86%. Now give each of 100 tests of the same 80% system its own range:
Each bar is one simulated test of the same 80% system on 30 cases, with its 95% Wilson range; the dot is the score. The first is 22 of 30: 56% to 86%. 7 of these 100 miss, a slightly unlucky batch: over every possible 30-case test, these ranges catch 80% 96.4% of the time. In real life you get one bar and never learn whether it's a red one.
Seven of the 100 miss the truth, a slightly unlucky batch: worked out over every possible 30-case test, these ranges catch 80% 96% of the time. That's what 95% promises. It's a promise about the method, not about one range: once you've computed yours, it either contains the truth or it doesn't, and you can't tell which. The lab shows a real miss. In 01_shrinking_interval.py, Exercise 1, one evaluation of the 90% system on 100 cases drew 82 right, and its range, 73.3% to 88.3%, misses 90%. Nothing went wrong; that's the 1 time in 20.
A confidence interval covers one kind of error: which cases happened to be drawn. It says nothing about whether the cases are the right ones. A test set that misses whole kinds of questions can give a tight range around the wrong number.
Where the simplest formula breaks
The simplest way to build the range is the score plus or minus the margin formula above, using the score itself for p. It's called the Wald interval. It measures the wobble from your own score, which goes wrong near 0% and 100% (02_when_wald_breaks.py, Exercise 1):
| Result | Wald 95% | Wilson 95% |
|---|---|---|
| 20 of 20 right | 100% to 100% ("± 0") | 83.9% to 100% |
| 19 of 20 | 85.4% to 104.6% (past 100%) | 76.4% to 99.1% |
| 0 harmful answers in 20 | 0% to 0% | 0% to 16.1% |
| 1 harmful answer in 20 | −4.6% to 14.6% (below 0%) | 0.9% to 23.6% |
Twenty of twenty shows no wobble at all, so Wald says "100%, plus or minus zero": certainty from twenty cases. The Wilson interval (a better formula for pass rates, named after the statistician who proposed it) stays inside 0–100% and never has zero width: twenty out of twenty is consistent with a system that's right only 84% of the time. These edges are exactly where safety checks and critical cases live, so they're not a corner case.
You can check how often a method really contains the truth. That share is its coverage, and for pass rates it can be computed exactly: take every possible result from 0 to n right, weight it by how likely it is, and add up the ones whose range contains the true rate. Exercise 2 does this at 20 cases:
| True pass rate | Wald coverage | Wilson coverage |
|---|---|---|
| 90% | 88% | 96% |
| 95% | 64% | 92% |
| 99% | 18% | 98% |
A "95%" Wald range on 20 cases of a 99% system contains the truth less than one time in five. Wilson stayed between 90% and 98% across the lab's whole grid (true rates 50–99%, 10–500 cases). Coverage also zig-zags as the number of cases changes by one, because right answers are whole numbers: over 10 to 200 cases at a 90% pass rate, Wald averaged 91.8% with a worst case of 65%, Wilson 95.3% with a worst case of 92% (Exercise 3). Every score's range in this chapter uses Wilson.
The bootstrap (03_bootstrap.py) is a resampling trick for metrics with no formula, like a median or a 90th-percentile latency: resample your cases with replacement 2,000 times, recompute the metric each time, keep the middle 95%. It has Wald's blind spot: at 20 of 20 every resample is 20 of 20, so it says 100% to 100% too. For pass rates, use Wilson.
Which wins hold up?
Back to the document cutting. Give the before and after scores their own ranges: 24 of 30 is 63% to 90%; 27 of 30 is 74% to 97%. They overlap a lot; the truth could be the same for both. The re-sorting step added to search was tested on 400 cases: 300 right before (71% to 79%), 336 after (80% to 87%). Its ranges don't even touch.
Overlap is only a hint, though, and a misleading one: two ranges can overlap a little while the change is still clearly bigger than noise. The rewritten instructions below went from 420 to 447 of 500 right; their ranges, 80.5% to 87.0% and 86.4% to 91.8%, overlap, yet the improvement clears zero. The proper check is one range for the improvement itself: how much better the change could plausibly be, from low to high. If it includes zero, the test can't tell the change from noise. When before and after were tested on different cases, the lab uses Newcombe's interval, which combines the two Wilson ranges into one range for the difference. For the document cutting it's −8.8 to +28.5 points: it crosses zero. For the re-sorting step it's +3.4 to +14.5: it stays above.
Here's the whole changelog (05_your_results.py, Exercise 3). Before you open the ranges: which of the seven survive?
Seven changes, each announced as a win. Before and after were measured on different samples of the same number of cases. Click the ones you think are bigger than noise, then reveal.
| Change | Cases | Score before → after | Change | 95% range for the improvement | Verdict |
|---|---|---|---|---|---|
| Told the AI to "think step by step" | 50 | 82% → 88% | +6.0 | −8.4 to +20.3 | could be noise |
| Switched to a newer, small AI model | 200 | 79% → 85.5% | +6.5 | −1.0 to +14.0 | could be noise |
| New way to cut documents for search | 30 | 80% → 90% | +10.0 | −8.8 to +28.5 | could be noise |
| Rewrote the AI's instructions | 500 | 84% → 89.4% | +5.4 | +1.2 to +9.6 | bigger than noise |
| Added 3 worked examples to the instructions | 100 | 81% → 88% | +7.0 | −3.2 to +17.1 | could be noise |
| Made answers less random (temperature 0.7 → 0) | 100 | 83% → 85% | +2.0 | −8.3 to +12.3 | could be noise |
| Added a re-sorting step to search | 400 | 75% → 84% | +9.0 | +3.4 to +14.5 | bigger than noise |
Two survive: the rewritten instructions, on 500 cases, and the re-sorting step, on 400. Lots of cases plus a solid gain keep their ranges above zero. The newer model, on 200 cases, just misses. The biggest win, on 30 cases, could be noise: thirty cases can't tell a big win from a loss.
"Could be noise" doesn't mean "didn't help". It means this test can't tell. Two fixes: test on more cases (Chapter 2 works out how many before you run anything), or run both versions on the same cases, a paired comparison. Then the luck of which cases were drawn is the same for both versions and cancels out, and only the cases where the two versions disagree carry information. That's much more sensitive than comparing two separate samples; Chapter 2 shows how much it saves.
What to do
- Report every score with its 95% range and its number of cases: "22 of 30 right, 73% (95% range 56% to 86%)", not "73%".
- Before anyone calls it a win, check that the improvement's range clears zero. Not the two scores' ranges side by side.
- If it doesn't, say so precisely: "+10 on 30 cases, somewhere between −9 and +29", and then test on more cases or on the same cases for both versions.
- Use Wilson for pass rates, especially near 0% or 100% and below a few hundred cases.
Caveats
- Simulated systems, made-up changelog. Every number about wobble comes from simulated systems with a known true pass rate (90% in the lab, 80% in the re-tests). In the simulation every case is an independent 80% or 90% coin flip; there are no easier or harder cases. The changelog is an example written for the lab, not a real team's history.
- The re-tests come from the video, not the lab's scripts. The 80% system on 30 and 400 cases, the 8 re-tests, the 100 ranges and the "1 in 5" were generated by the video's export script with the lab's
wilson_ciand coverage functions and its own random seed. Re-checked for this chapter with the lab's code. - The cases-needed table is for a 90% pass rate. Nearer 50% you need more cases for the same margin; nearer 100%, fewer.
- An interval only covers which cases were drawn. Not a test set that leaves out whole kinds of questions, not a grader that marks wrong answers right, and not the model giving a different answer when re-run on the same case (Chapter 5). It also assumes the cases are independent; many questions about the same few documents make the real range wider.
- Testing many versions and announcing the best makes even a range that clears zero suspect: with enough tries, some clear zero by luck. Confirm the winner on cases it wasn't picked on.
The checklist
- What does a 95% confidence interval promise? That the method contains the truth about 95 times in 100 across repeated tests. Not that this one range has a 95% chance.
- How does the margin change with the number of cases? With the square root: four times the cases for half the margin.
- When does the Wald interval fail? Small samples and scores near 0% or 100%: zero width at 20/20 and 0/20, past 100% at 19/20, 18% coverage at 20 cases for a 99% system. Use Wilson.
- What is coverage, and how do you check it? How often a method's range really contains the truth: on a simulation with a known truth, or exactly for pass rates by weighting every possible result.
- How do you tell whether an announced improvement is real? Ask how many cases, whether both versions ran on the same cases, and what the range for the difference is. Check whether it includes zero.
- What do you say when it includes zero? "Could be noise, this test can't tell", with the range, and a plan for a bigger or paired test.
Practice: put a range on it
Write the lab's interval code: the simplest margin, Wald and Wilson, Newcombe's range for an improvement, the verdict, the cases needed for a margin, exact coverage, and the chance an unchanged system "improves" by luck. The tests use the recorded numbers: 82 of 100 → 73.3% to 88.3%, 20 of 20 → 83.9% to 100%, the seven changelog ranges, 55 / 217 / 865 / 3,458 cases, Wald's 18% coverage, and the 21% chance of a 10-point "win" from noise alone.
Quiz
1.A change took a score from 24 of 30 to 27 of 30 (80% to 90%). Before and after were tested on different cases. What's the honest summary?
2.What does '95%' in a 95% confidence interval promise?
3.Your score has a ±4% margin on 217 cases. About how many cases for ±2%?
4.A safety check found 0 harmful answers in 20. What does Wilson say about the true rate of harmful answers?
5.Of seven changelog wins, which two had improvement ranges entirely above zero?
6.Two versions' 95% ranges overlap a little. What can you conclude?
Check your understanding
Try each question before opening its answer.
Why is "+10 points" on 30 test cases weak evidence?
Ten points on 30 cases is three cases. A simulated system that truly gets 80% right, re-tested on 30 fresh cases with nothing changed, beats its first score by 10 points or more about 1 time in 5 (21%, exact). The range for the document-cutting improvement runs from −8.8 to +28.5 points.
What does a 95% confidence interval promise, and what doesn't it?
It promises that the method contains the truth about 95 times in 100 over repeated tests (7 of 100 simulated ranges missed; exactly, 96% catch it). It doesn't say this one range has a 95% chance: yours either contains the truth or not. It also doesn't cover a biased test set or an unreliable grader.
Your score has a margin of ±4% on 217 cases. You want ±1%. How many cases, roughly, and why?
About 3,458 at a 90% pass rate: sixteen times as many. The margin shrinks with the square root of the number of cases, so each halving costs four times the cases, and halving twice costs sixteen.
A new safety filter produced 0 harmful answers in 20 tries. What do you report?
"0 of 20, 95% Wilson range 0% to 16.1%". The simplest formula says 0% ± 0 because 0 of 20 shows no wobble; Wilson shows that up to about one harmful answer in six is still consistent with what you saw.
Before and after ranges overlap. Is the change noise?
Not necessarily. Overlap is only a hint: two ranges can overlap a little while the change still clears zero. Compute one range for the improvement (Newcombe's, for different cases) and check whether it includes zero.
Which two changelog wins hold up, and what do they have in common?
Rewriting the AI's instructions (+5.4 points on 500 cases, range +1.2 to +9.6) and adding a re-sorting step to search (+9.0 on 400 cases, +3.4 to +14.5). Both had hundreds of cases and a solid gain. The newer model (+6.5 on 200 cases) just missed: −1.0 to +14.0.
A colleague's change is "could be noise". How do you word it, and what next?
"+10 points on 30 cases, somewhere between −9 and +29: this test can't tell it from noise." Not "it didn't help". Then test on more cases, sized in advance, or run both versions on the same cases so the luck of the draw cancels out.
Next up: Chapter 2, sample size: this chapter went from cases to precision. The next one goes the other way: given the precision you need, how many cases, why "±0.4%" means tens of thousands of them, and how much a paired comparison saves.