Lesson 9 told you a 5-point gain can be noise. This lesson gives you the machinery that puts an exact number on that doubt, and the traps that machinery sets for you.
Every eval you run produces a number from a finite sample. Lesson 5 showed that such numbers wobble, and Lesson 9 showed that a new prompt scoring higher might just be lucky. What you have not yet seen is the formal procedure that turns "might be lucky" into a calculation: the hypothesis test. This lesson covers the law that says averages settle, the test framework, two fully worked tests (one on pass rates, one on latency), and three ways testing misleads people who use it carelessly.
The law of large numbers (LLN) says: if you average more and more independent draws that share the same true mean, the average converges to that mean. It is the guarantee that measuring works at all. An eval pass rate over 10,000 examples is a better estimate of a model's true pass rate than one over 25, and with enough examples it gets as close as you like.
The LLN and the Central Limit Theorem (Lesson 5) are two answers to two different questions. The LLN says where the average ends up. The CLT says how it is spread around that destination for a given N: a bell curve whose width is the standard error. We don't re-teach the CLT here; we use its result, the standard error.
Here is how fast an eval settles. Suppose a prompt's true pass rate is 0.80, so each graded example is a 0-or-1 draw with standard deviation √(0.80 × 0.20) = 0.40. The standard error of the measured pass rate is 0.40 / √N:
| Eval examples (N) | Standard error | Typical range (±2 SE) |
|---|---|---|
| 25 | 0.080 | 0.64 to 0.96 |
| 100 | 0.040 | 0.72 to 0.88 |
| 400 | 0.020 | 0.76 to 0.84 |
| 10,000 | 0.004 | 0.792 to 0.808 |
The same law powers Monte Carlo estimates. If you want the expected length of a model's reply under sampling, or the chance a sampled answer passes a checker, you generate N replies and average. The estimate converges to the truth, with error shrinking like 1/√N. So 100 times more samples buys only 10 times less error.
You have two prompts and an eval score for each. A hypothesis test is a fixed five-step routine for asking whether the gap is bigger than luck would produce.
| Piece | What it is | Prompt A vs B example |
|---|---|---|
| Null hypothesis H0 | The boring claim: no real difference. You assume it and see if the data contradicts it. | Both prompts have the same true pass rate. |
| Alternative H1 | What you suspect instead. | The true pass rates differ (two-sided). |
| Test statistic | One number summarizing how far the data sits from H0, measured in standard errors. | z = (observed gap) / (standard error of the gap) |
| p-value | If H0 were true, how often would the statistic land at least this far from zero, by luck of the draw alone? | Computed from the Normal curve (below). |
| Significance level α | The cutoff you fix before looking. If p < α, you reject H0. Usually 0.05. | α = 0.05, so reject when |z| > 1.96. |
The number 1.96 is the point on the standard Normal curve with 2.5% of the area beyond it on each side, so 5% in total. The CLT is why the Normal curve from Lesson 4 applies to an average or a gap of averages.
The p-value is the probability of seeing a result at least this extreme, assuming H0 is true. It is a statement about the data under a hypothesis, not a statement about the hypothesis.
| H0 actually true (no real difference) | H0 actually false (real difference) | |
|---|---|---|
| Test rejects H0 | Type I error (false positive). Probability = α. You ship a prompt that is no better. | Correct. Probability = power. |
| Test does not reject | Correct. | Type II error (false negative). Probability = β = 1 − power. You discard a prompt that really was better. |
These mirror the false-positive and false-negative cells of Lesson 9's confusion matrix, applied to a claim instead of a single example. Setting α = 0.05 caps your Type I rate at 5% when H0 is true. Power is the chance of catching a difference that really exists. It depends on three things: how big the true difference is, how noisy the data is, and N. Small eval sets have low power, which is the formal reason a 20-example eval cannot confirm much.
A team compares two prompt variants on the same task, each run on its own 800 eval examples and graded pass/fail. Prompt A passes 600 (75.0%). Prompt B passes 640 (80.0%). Is B really better?
Setup. H0: pA = pB. H1: pA ≠ pB. α = 0.05, two-sided.
Under H0 the two prompts share one pass rate, so we estimate it by pooling both groups:
Now the picture. The curve is the distribution of z if H0 were true. The shaded tails are the rejection region: the 5% of outcomes most extreme under H0. Our z = 2.39 falls inside the right tail.
Null distribution of the test statistic. Red tails: rejection region (|z| > 1.96, area 0.05). Yellow: observed z = 2.39; the area beyond ±2.39 is the p-value.
Interpretation. Because 0.0166 < 0.05, reject H0. If the prompts were truly equal, a gap of 5 points or more in either direction would appear in only about 1.7% of eval runs this size. That is decent evidence B is better. It is not proof, and it does not mean B is better with 98.3% probability.
A 95% confidence interval for the gap tells you more than the verdict. Using the unpooled standard error √(0.75×0.25/800 + 0.80×0.20/800) = 0.02084:
The interval excludes zero (that is what "significant at 0.05" means), but it is wide. The true gain could be under 1 point or nearly 9.
Lesson 9 compared 75% vs 80% at N = 20 and N = 500. Here is the full calculation at both sizes, plus the 800 above. At 500 the result is borderline:
| N per prompt | Passes (A / B) | Std. error | z | p-value | Verdict at 0.05 |
|---|---|---|---|---|---|
| 20 | 15 / 16 | 0.1321 | 0.38 | 0.705 | No evidence |
| 500 | 375 / 400 | 0.0264 | 1.89 | 0.058 | Just misses |
| 800 | 600 / 640 | 0.0209 | 2.39 | 0.017 | Significant |
Nothing changed except N. The standard error shrank, so the same gap became more standard errors from zero. Also, 0.058 versus 0.049 is no real distinction: 0.05 is a convention, not a cliff.
Suppose the true gap really is 0.05. With 800 per prompt, the test statistic's typical size is 0.05 / 0.02084 = 2.40. It must beat 1.96, and luck moves it up or down by about one unit, so the chance it clears 1.96 is the Normal area below 2.40 − 1.96 = 0.44, which is about 0.67.
So even with 800 examples a real 5-point gain is missed one time in three. The usual target is 80% power. Solve for N per arm:
Run this before building the eval set. It is the formal version of Lesson 9's rule of thumb.
Pass rates are 0-or-1, so one proportion fixes the spread. A continuous metric like latency has its own spread, which you must estimate from the data. When you do that with a modest sample, the test statistic is called t instead of z, and its reference curve (the t-distribution) has slightly heavier tails than the Normal. With a few dozen or more observations per group, the two are very close.
A team times two serving configurations, 40 requests each:
| Config | n | Mean latency | Std. dev. |
|---|---|---|---|
| A (baseline) | 40 | 212 ms | 38 ms |
| B (new batching) | 40 | 198 ms | 34 ms |
H0: the true mean latencies are equal. H1: they differ. α = 0.05, two-sided. This is the Welch version, which does not assume the two configs have equal spread:
The critical t for 77 degrees of freedom at α = 0.05 is about 1.99, and 1.74 does not reach it. Do not reject H0. The 95% interval for the gap is 14 ± 1.99 × 8.06 = −2.1 to +30.1 ms, which includes zero.
Significance asks "is the gap distinguishable from zero?" It does not ask "is the gap large?" The standard error shrinks as N grows, so with enough data any nonzero gap eventually becomes significant, however trivial.
Take two models with true pass rates 0.800 and 0.802, each evaluated on 1,000,000 examples:
The p-value is tiny and the result is "highly significant," yet the best case is a third of a point. Whether that matters is a product decision, not a statistical one. Compare the earlier latency test: not significant, but a plausible 14 ms gain worth chasing with more data. Report both numbers every time:
Decide in advance the smallest gap worth shipping and size the eval to detect it with good power, instead of testing until something crosses 0.05.
The 5% false-positive rate applies to one test. A team tries 20 prompt variants against the baseline, and suppose none is truly better. Each test has a 5% chance of a false positive:
That is a 64% chance of declaring a winner when nothing works. This is how repeated prompt tweaking overfits an eval set (the held-out warning in Lesson 9's checklist), and why "we found a prompt that beats the baseline" claims fall apart on fresh data.
The simplest repair is the Bonferroni correction: divide α by the number of tests. For 20 variants, each must clear 0.05 / 20 = 0.0025, which means |z| > 3.02 instead of 1.96. The total chance of any false positive then stays near 5% (exactly 1 − 0.997520 = 0.049). Our worked example's p = 0.0166 passes at 0.05 but would not survive 20 comparisons. The cost: Bonferroni is conservative and lowers power, so real gains become harder to confirm. Other methods (such as false discovery rate control) trade this off differently, but the habit is the same: count everything you tried, not just the one that worked.
A p-value tells you how surprising the data would be if the null were true. It never gives the probability you actually want: how likely is it that B is better, given what we saw? Answering that means flipping the condition with Bayes' Theorem (Lesson 3) and treating the unknown pass rate itself as something with a probability distribution. That is Bayesian inference, the subject of Lesson 16.
1. A prompt's true pass rate is 0.80. What does the law of large numbers promise about the measured pass rate on an eval set?
2. A comparison of two prompts returns p = 0.03. Which statement is correct?
3. Your 20-example eval fails to show a significant gain even though the new prompt really is better. What happened?
4. A 0.2-point accuracy gain is "highly significant" (p = 0.0004) on a 1,000,000-example test set. What should you conclude?
5. You test 20 prompt variants against a baseline at α = 0.05, and none is truly better. Roughly what do you expect, and what does Bonferroni do?