Before You Say It Got Better — Building an Evaluation
Chapters 9, 10 and 11 each left something on deposit with the line "that is an evaluation question, for another chapter." This chapter collects all three.
Part III ends with measurement for a reason. Every one of the eleven chapters so far has the shape "change this and that gets better" — and whether you are allowed to say "better" rests entirely on this chapter.
Measuring is not producing one number. It is producing a width and a direction along with it.
1. A single number has a width
A test set is a sample drawn from the whole population of problems you care about. Draw a different 1,000 and the same model's score moves. If the model is right on a fraction of items, the number correct follows a binomial distribution and the standard deviation of the fraction is
where is the true accuracy and the number of items. The 95% half-width is 1.96 times that, so at :
| items | 95% half-width |
|---|---|
| 100 | ±0.0898 |
| 300 | ±0.0519 |
| 1,000 | ±0.0284 |
| 3,000 | ±0.0164 |
| 10,000 | ±0.0090 |
| 30,000 | ±0.0052 |
A "70%" measured on 100 items is really somewhere between 61% and 79%. It is the same shape as Part 0 Chapter 3, so halving the width costs four times the items.
Read the other way, the width you want fixes the number of items you need (at ):
| width you want | items needed |
|---|---|
| ±0.05 | 323 |
| ±0.02 | 2,017 |
| ±0.01 | 8,068 |
| ±0.005 | 32,270 |
So claiming a half-point improvement takes 30,000 items per model. That is one model, measured once.
2. When the width you labelled 95% is not 95%
The above is an approximation that holds when the accuracy is away from 0 and 1. How well it holds can be checked without any approximation by enumerating the binomial: fix the true , add up the probability of every , and read off how often the interval built from the measurement contains the true value.
| true value | items | naive formula () | Wilson |
|---|---|---|---|
| 0.50 | 100 | 0.9431 | 0.9431 |
| 0.70 | 100 | 0.9502 | 0.9372 |
| 0.70 | 30 | 0.9529 | 0.9298 |
| 0.95 | 100 | 0.8775 | 0.9659 |
| 0.95 | 1,000 | 0.9417 | 0.9504 |
In the middle the naive formula is fine. The trouble is at the edges: measure a 0.95 model on 100 items and the interval you called 95% actually contains the true value 87.8% of the time. Worse, in the same setting 25.2% of the time the upper end goes above 1 — an interval reaching "103% accuracy" once every four runs.
The closer a test is to saturation, the more this bites. Wilson's formula
with the measured accuracy, and the item count, pulls the centre slightly inward and never exceeds 1. As the table shows, it is better at the edges and slightly conservative in the middle.
(The table comes from enumeration. Set the knobs in the Section 4 figure to "100 items, true accuracy 0.95" and the measured share — counted by drawing, not enumerating — drops to just under 90% as well.)
3. To compare two models, give them the same problems
Now the main business. Compare models A and B. I built 1,000 artificial items with the following mix (this mix is an assumption I chose):
| share | |
|---|---|
| both right | 0.62 |
| both wrong | 0.24 |
| only A right | 0.05 |
| only B right | 0.09 |
True accuracy is 0.67 for A and 0.71 for B, and the two agree on 86% of the items. Real tests look like this too: easy items both solve, hard items both miss.
Measured on the 1,000 items I drew:
| correct | accuracy | its own 95% interval | |
|---|---|---|---|
| A | 679 | 0.679 | [0.6501, 0.7079] |
| B | 721 | 0.721 | [0.6932, 0.7488] |
The two intervals overlap by 0.0147. This is where it is common to write "the intervals overlap, so we cannot claim a difference." Build the interval for the difference itself and the story changes.
Items they agree on say nothing about the difference. Only the items they disagree on carry it: 45 where only A was right, 87 where only B was right, 132 in total (13.2%).
| how you compare | standard error of the difference | two-sided | |
|---|---|---|---|
| as two separate measurements | 0.02047 | 2.052 | 0.0402 |
| paired on the same items | 0.01142 | 3.678 | 0.000235 |
Same data, and the standard error is 1.79 times smaller. Pairing subtracts away the spread in item difficulty.
Looking only at the 132 disagreements, you can test this with almost no assumptions. If the null hypothesis "it makes no difference which one is right" holds, splitting into 45 and 87 is the same as tossing a coin 132 times.
- exact value from enumerating the binomial (McNemar's test):
- a permutation test flipping the signs at random, 200,000 times: the observed was reached or exceeded 68 times,
The two agree. The permutation test uses no normal distribution and no : it just builds "what it would look like if direction meant nothing" 200,000 times and counts. You can write that even when you cannot recall the formula.
How many items does it take to see a difference of 0.01? With disagreement rate and target difference , , so
For and that is 4,226 items. But that is the count at which the expected is exactly 1.96 — the count that reaches significance half the time. To see it 80% of the time, replace with : 8,634 items. Measured on artificial data:
| items | paired | compared separately |
|---|---|---|
| 1,000 | 0.1640 | 0.0015 |
| 4,226 | 0.4865 | 0.0260 |
| 8,626 | 0.8023 | — |
| 16,000 | 0.9720 | 0.4530 |
48.7% at 4,226 and 80.2% at 8,626, as the formula says. Without pairing it takes 16,135 (45.3% at the 16,000 in the table). When you see a comparison table claiming a one-point difference, look at the item count first.
4. By the time you picked it, the score is already up
Next, the drift that comes from looking at the same test set over and over.
Take candidates with exactly the same ability (true accuracy 0.70 for all of them). Measure each on its own 500 items and keep the best. Repeated 20,000 times:
Columns: the candidate count ; the mean score of the one that was picked; how much that is above the true 0.70; the same winner re-measured on a fresh 500 items; and how often the winner was called significantly better than 0.70.
| winner | lift | re-measured | called significant | |
|---|---|---|---|---|
| 1 | 0.6997 | −0.0003 | 0.7003 | 0.0200 |
| 2 | 0.7115 | +0.0115 | 0.6999 | 0.0428 |
| 5 | 0.7239 | +0.0239 | 0.7002 | 0.1062 |
| 10 | 0.7315 | +0.0315 | 0.7000 | 0.1976 |
| 20 | 0.7379 | +0.0379 | 0.7000 | 0.3553 |
| 50 | 0.7456 | +0.0456 | 0.7001 | 0.6680 |
Comments
Sign in to comment