Key takeaways
- ✓Start an eval from the decisions its score must support, not from a number of cases: how precise the overall score must be (the margin), which group of traffic needs its own claim, whether you'll compare versions, how many runs a case gets. Each becomes a requirement with its own size and a written reason.
- ✓In the example goal, ±2 points alone needs 857 cases, the critical group's claim "fails less than 5%" needs 59 cases that all pass, and catching a 2-point drop between versions 4 times in 5 needs 1,549 shared cases. The largest requirement is the binding constraint: it sets the size (1,551 cases), the cost ($1,598) and the labeling time (39 hours).
- ✓Before cutting cost, find the binding constraint. Loosening the margin to ±3 points saved nothing (1,556 cases, $5 more, from rounding). Dropping the regression checks cut the cost by about 42% (907 cases, $934), at the price of not catching a version that got worse. Tightening to ±1 point made the margin bind (3,368 cases, $3,469).
- ✓A design can measure a problem but not fix it. The critical group is expected to pass about 70%, so it would fail its "fails less than 5%" claim; 59 cases measure it to about ±11 points. That's a product problem, and the eval's job is to show it.
- ✓Inspect an eval set before you trust its score. The store's 100-case set: ⚠ ±7.3 points, ⚠ a mix far from production, ✗ 8 leaked cases, ⚠ one run per case, ⚠ newest case 159 days old, and by topic ✗ subscriptions missing (13% of traffic). Verdict: don't read the score as production performance.
- ✓A "?" line (couldn't check) is a finding: an unknown risk, not an absent one. Nobody had checked the store's grader against people or reviewed its failures.
- ✓Test the inspector itself: it raised no false alarms on a clean 1,000-case set and caught 11 of 12 planted problems. It missed reworded copies, because its duplicate check compares words. Know what your checker can't see.
"How many test cases do we need?" is the first question most teams ask about an eval, and it has no good answer on its own. This chapter answers it the other way round: start from the decisions the score has to support, give each one its own size, and find the one that sets the price. In the example goal, that's 1,551 test cases, about $1,600 and a week of someone's labeling time, and loosening the margin from ±2 to ±3 points saves nothing. Then it turns to the opposite job: inspecting an eval set someone else built, and checking that the inspector itself can be trusted.
The examples come from Lab 07 (The Eval Decision Engine) of the eval labs. It puts the pieces of Chapters 1–5 together into two tools in the labs' shared package, evalkit/engine.py: one designs an eval from its goal (design_evaluation), the other audits an existing one (audit). The chapter covers the lab's first three scripts: 01_design.py (designs, and what drives their cost), 02_audit.py (an audit of the store's eval set) and 03_planted_problems.py (testing the audit with planted problems). It doesn't cover the rest of 02_audit.py (an audit of a small question-answering set from another lab, whose results are real model outputs, and a third set that doesn't exist yet), the lab's command-line tool 04_cli.py, or a variant with a smaller population.
Everything here is simulated or an example. The goal is an example spec. The store, Trailhead Outfitters, is made up: its eval set, its production traffic and its assistant come from Lab 01 of the same labs, and the assistant's answers are a simulation (one run, with a fixed random seed). The clean 1,000-case set in the last section is synthetic. Nothing here measures a real model.
The words
An eval set is the list of test cases you score an AI on. A test case is a request with a known right answer. A person has to check that answer once; that's labeling, and it's most of the cost: the lab prices it at $1 and 1.5 minutes a case. A run is the AI answering one case and that answer being graded: $0.006, a fraction of a cent. The grader is whatever marks each answer pass or fail: a code check, a person, or another model.
The score is the share of cases that pass. Measured on a sample, it comes with a confidence interval, the range the true pass rate probably lies in (Chapter 1); the margin is half its width, how far the score may be from the truth. "90% ± 2" means somewhere between 88% and 92%.
Start from the decisions
The lab's example goal, written as decisions instead of a number:
| Decision | The example's answer | Where it comes from |
|---|---|---|
| How good is the assistant now? | about 90% of requests right | a guess, or a pilot run |
| How precise must the overall score be? | ±2 points, with 95% confidence | what the decision needs (Chapters 1 and 2) |
| How much traffic is there? | 100,000 requests | production |
| What groups does traffic fall into? | normal 90%, difficult 5%, ambiguous 4%, critical 1% | a labeled sample of production (Chapter 3) |
| Does any group need its own claim? | the critical group (billing, personal data, safety): "fails less than 5%" | whoever owns that risk |
| Will you compare versions? | yes: catch a 2-point drop, 4 times out of 5 | the release process |
| How many runs per case? | 5 | do you need to know how often answers flip? (Chapter 5) |
Two of those need a word. Splitting cases by groups of traffic and sizing each group is stratified sampling (Chapter 3); the groups are strata. And a regression check re-runs the same cases on every new version, to catch it getting worse. Running both versions on the same cases is a paired comparison, and "4 times out of 5" is its power: the chance it catches a real 2-point drop.
One size per requirement
The design engine turns each requirement into a number of cases, and prints the reason next to each.
| Requirement | Cases | Why |
|---|---|---|
| The margin: ±2 points | 857 | the sample-size formula from Chapter 2 gives 865 for ±2 at about 90%; with only 100,000 requests to draw from, it's 857 (the finite-population correction) |
| The critical group's claim: "fails less than 5%" | 59, all passing | its 1% share of 857 would give 9. To say "fails less than 5%" with 95% confidence you need 59 cases with no failure (the zero-failure rule, roughly 3 ÷ 5%: the "rule of three") |
| Regression checks: a 2-point drop, 4 times in 5 | 1,549 shared cases | a paired comparison of a version at 90% against one at 88%, judged with the McNemar test (a test for pass/fail results on the same cases) |
Why do regression checks need the most? Two versions of the same assistant agree on most cases: they pass and fail the same ones. A case both pass, or both fail, says nothing about which version is better. Only the cases where they disagree can show a drop. The lab assumes the two versions' results are fairly alike (a correlation, ρ, of 0.6), and then only 7.9% of cases disagree: 4.95% where the old version passes and the new one fails, 2.95% the other way. Of 1,549 shared cases, that's about 120 that carry the signal, roughly 77 against 46. Fewer, and a 2-point drop hides in the noise.
The largest requirement is the binding constraint. Think of packing a box: the biggest item decides how big the box must be, and the small items fit around it. Here the regression checks bind, so the design is 1,551 cases: normal 1,313, difficult 94, ambiguous 85, critical 59. With 5 runs each that's 7,755 runs. The cost is 1,551 labels × $1 + 7,755 runs × $0.006 = $1,598, and 1,551 × 1.5 minutes is 39 hours of labeling, a full week of someone's time. The box is 2 cases bigger than the biggest item because the engine grows the groups in 1% steps until they cover it.
The groups aren't in production's proportions any more (the critical group is 59 cases instead of 9), so the overall score is reported weighted back to production's shares. That costs some precision: the margin's 857 cases, with the critical group raised to 59, give ±1.8 points instead of ±2, and the full design ±1.4. Each group also gets its own Wilson interval, the interval for a pass rate that stays honest at small counts (Chapter 1).
Try changing the inputs. The bars are the requirements, the outline is the design:
Margin: how far the score may be from the truth
Regression checks (catch a 2-point drop, 4 times in 5)
Claim for the critical group
Runs per case
The biggest item: the regression checks. They need 1,549 shared cases; the margin's design has 907. The box is 2 cases bigger than the item, from growing the groups in 1% steps. Same cost as the example design.
1,551 labels × $1 + 7,755 runs × $0.006 = $1,598 · 1.5 min a label = 39 h · weighted overall margin ±1.4 points
Every setting is a call of the lab's design engine on the example goal (about 90% expected, 100,000 requests, groups 90/5/4/1, the critical group expected to pass 70%). The video and the lab change one input at a time; the ±1.5 and ±2.5 margins and the mixed settings come from the same engine. Cases are the cost: runs are a fraction of a cent.
What sets the price?
The lab changes one input at a time from the example. Before reading the table, guess: loosen the margin to ±3 points, and how much do you save?
| Change | Cases | Cost | Labeling | What binds |
|---|---|---|---|---|
| As designed | 1,551 | $1,598 | 39 h | the regression checks |
| Margin ±3 instead of ±2 | 1,556 | $1,603 | 39 h | still the regression checks |
| No regression checks | 907 | $934 | 23 h | the margin |
| Margin ±1 | 3,368 | $3,469 | 84 h | the margin |
| Critical claim "fails less than 1%" | 1,559 (299 critical) | $1,606 | 39 h | the regression checks |
| 1 run per case instead of 5 | 1,551 | $1,560 | 39 h | the regression checks |
- Loosening the margin saved nothing. ±3 alone needs only 383 cases, but the margin was never the biggest item: the regression checks still need 1,549. It even costs $5 more (1,556 cases), because the engine grows the groups in 1% steps from a different starting point and overshoots differently. That's rounding, not a real cost.
- Dropping the regression checks cut the cost by about 42% ($934 against $1,598). The price: a new version that got 2 points worse could slip through.
- Tightening the margin to ±1 point makes the margin the biggest item: 3,342 cases on its own. In fact it already binds at ±1.5 points (the margin's design reaches 1,559 cases there, covering the regression checks); at ±1.6 the regression checks still bind.
- A stricter critical claim adds cases to one group: "fails less than 1%" needs 299 cases that all pass.
- One run instead of five saves less than $40, because labels are the cost and runs are cheap. But one run can't tell you how often answers flip (Chapter 5's pass^k, the chance a case passes all k of its runs) or which cases are flaky, passing on some runs and failing on others.
So before cutting cost, find the binding constraint, and ask whether the decision really needs it.
A warning no design can fix
The engine printed a warning next to the critical group. We expect it to pass only about 70% of the time: an input guess, not a measurement. The claim says it fails less than 5%. If the guess is right, it will fail the claim, whatever the eval does.
59 cases measure that group to about ±11 points: enough to show a 30% failure rate is nowhere near 5%. But no eval design can make the group pass. That's a product problem, not an eval problem. The eval's job is to show it.
Inspecting someone else's eval set
Often the eval set you're handed was built by someone else. So the engine's second job is to inspect one. Think of a home inspection: a checklist, and every item marked fine, a caveat, or a problem that blocks the sale. The audit's marks:
| Mark | Meaning |
|---|---|
| ✓ | fine |
| ⚠ | a caveat: report it next to the score |
| ✗ | blocks the score: don't read it until this is fixed |
| ? | couldn't check: the information wasn't given |
The set is the simulated store's: Trailhead Outfitters, an outdoor-gear shop, 100 cases. The audit compares it against a sample of the store's production traffic from August and September (400 requests), and scores one simulated run of its assistant: 83 of 100 passed. Its nine lines, in order:
| Check | Mark | What it found |
|---|---|---|
| Sample size | ⚠ | 100 cases give ±7.3 points (Wilson); ±3 would need about 603 |
| Representativeness | ⚠ | the mix is far from production (TVD 0.25) |
| Cases per stratum | ✓ | every difficulty group has at least 20 cases |
| Near-duplicates | ✓ | 3% of cases repeat another case's wording, under the 5% bar |
| Leakage | ✗ | 8 cases also appear in what the assistant saw while it was built |
| Grader | ? | no record of anyone checking it against people |
| Failure discovery | ? | no record of a review of the failures |
| Repeated runs | ⚠ | one run per case |
| Freshness | ⚠ | the newest case is 159 days old |
- The mix. Production is mostly easy requests (64.5%, with 21.25% medium and 14.25% hard). The set is 40% easy, 40% medium, 20% hard, so its score describes a harder mix than customers send. The audit measures the gap as total variation distance (TVD): the share of cases you'd have to move to turn one mix into the other. 0.245 here, printed as 0.25; the audit warns from 0.10.
- Leakage is test cases the AI already saw while it was built, like seeing the exam questions in advance. Three of the 8 are in the prompt's few-shot examples (sample conversations written into the assistant's instructions), five in the tuning log (the requests the team used while adjusting it). On those, the score says how well the assistant remembers, not how well it handles new requests. That blocks the score.
- One run per case, so nobody knows how often its answers flip.
- Freshness. The newest case is from 24 April 2026; the audit is dated 30 September. About five months: the store's traffic may have moved on.
Then the lab runs the audit again, grouping by topic instead of difficulty. A whole topic is missing: subscriptions, 13% of today's traffic, and no case at all. Weighting can correct a group that's too small, but you can't weight up a topic with zero cases. That's a second ✗.
The verdict: don't read this score as how the assistant does in production. Fix the leaked cases and add subscription requests first. (The audit's printed recommendation names only leakage, because the topic check is a separate call.)
✗ Leakage · blocks the score
8 test cases also appear in what the assistant saw while it was built: 3 in the prompt's examples, 5 in the tuning log.
The audit printed: 8 cases also appear in few-shot examples, tuning log
The mix, against production
⚠ Representativeness: mix differs from production by TVD 0.25: report a score reweighted to production
Verdict: don't read this score as how the assistant does in production. Fix the leaked cases, and add subscription requests.
The audit printed: Do not interpret the aggregate score as production performance: leakage must be fixed first.
Click a room. The rooms are the nine lines of the lab's audit, in order; the "?" lines sit in the attic. The by-topic lines come from a second audit call, so the printed recommendation names leakage only. The store, its 100 cases and the assistant's answers are simulated (Lab 01).
A question mark is a finding
Two lines got a "?": the grader, and failure discovery. Nobody had given the audit a check of the grader against people, so its mistakes are unknown. And nobody had given it a review of the failures, sorted into kinds (a failure mode is one kind of failure); without one, the audit can't tell whether the team has found most kinds yet (Chapter 4's saturation).
A "?" is the inspector's "couldn't get into the attic". That's not a clean attic. It's an unknown risk, not an absent one. An audit that skipped those lines silently would make the set look safer than it is. To turn a "?" into an answer, record the missing input when the data is built: a grader check against human labels, a failure review, collection dates, the prompts and tuning logs.
Checking the inspector
Can you trust the inspector itself? A checker fails in two ways: it raises false alarms, and then people learn to ignore it, or it misses real problems. The lab tests both.
First, a clean set. 1,000 synthetic cases whose mix matches production exactly, 3 runs each, dated a month before the audit, a grader that catches 90% of failures, a failure review that has stopped finding new kinds. Every one of the nine checks came back ✓. No false alarms.
Then, one planted problem at a time. Each row starts from the clean set and changes one thing:
| Planted problem | What the audit flagged |
|---|---|
| 150 copies with an order number added | ⚠ near-duplicates |
| 150 reworded copies | nothing |
| the critical group removed | ✗ missing group |
| only 5 critical cases | ⚠ thin group |
| 10 cases leaked into the prompt | ✗ leakage |
| production drifted (critical 5% → 30%) | ⚠ representativeness |
| the set a year old | ⚠ freshness |
| one run per case | ⚠ repeated runs |
| only 150 cases | ⚠ sample size, ⚠ thin groups |
| a grader never checked | ? grader |
| a grader that misses half the failures | ⚠ grader |
| a failure review still finding new kinds | ⚠ failure discovery |
It caught 11 of 12. It missed reworded copies: the same question in different words. Its duplicate check compares words, and a reworded copy may share none. "What is your return window?" and "How many days do I have to send something back?", a real pair from the store's data, have no words in common. (The lab's planted copies are stand-ins made of made-up words, so they share none by construction.) Reworded copies need a check that compares meaning, using embeddings, number vectors that put texts with similar meaning close together. The audit's own duplicate line says so every time it runs.
Writing this test also turned up a real bug: the audit counted results for cases that weren't in the set, so "only 150 cases" wasn't flagged for sample size. It's fixed, with a regression test in the labs' tests/test_engine.py. That's the point of testing the tester.
1,000 synthetic cases whose mix matches production, 3 runs each, dated a month before the audit, a grader that catches 90% of failures, a failure review that has stopped finding new kinds.
Each plant starts from the clean set and changes one thing. Highlighted lines are the ones that changed from ✓. The clean set and the plants are synthetic; the reworded pair is from Lab 01's data.
The store's next eval set
The lab ends the design half by designing the store's next set from its August–September traffic, treating subscriptions as the critical group (they're new, and billing mistakes there are expensive). The goal: about 87% expected, ±3 points, 3 runs a case, catch a 3-point drop.
| Requirement | Cases |
|---|---|
| The margin: ±3 points | 483 |
| Subscriptions, "fails less than 5%" | 63 (their 13% share already covers the 59 needed) |
| Regression checks: a 3-point drop | 874 shared cases |
The regression checks bind again: 882 cases (easy 487, medium 199, hard 133, subscription 63), 2,646 runs, $898 and 22 hours. And the same warning: subscriptions, expected to pass about 70%, would fail their claim. Compare that with the set it replaces: 100 cases, no subscription requests, and no reason written down for any number.
Caveats
- Everything is simulated or an example. The pass rates (90%, and 70% for the critical group) are input guesses. When a first run measures them, rerun the design with the measured rates.
- The regression-check size depends on ρ, how alike two versions behave. The lab assumes 0.6; a pilot run comparing two real versions would give a measured value. The more alike they are, the fewer cases disagree and the cheaper the checks.
- The store's verdict comes from one simulated run. With 5 runs per case the sample-size and repeated-runs lines would change.
- The audit only knows what it's given. It can't see reworded copies, and every input left out becomes a "?".
- The ±3 row's extra $5 is rounding in how the engine grows its groups, not a real cost of a looser margin.
The checklist
- Write down the decisions first: the margin the decision needs, the groups of traffic and their shares, which group needs its own claim, whether you compare versions, how many runs per case.
- Give each requirement its own size, with its reason next to it.
- Find the binding constraint before cutting cost. Loosening anything else saves nothing.
- Read the design's warnings. A group expected to fail its claim is a product problem; the eval measures it.
- Inspect any eval set you're handed: sample size, mix against production, missing groups, leakage, duplicates, repeated runs, freshness, the grader, failure discovery.
- Treat ✗ as blocking, ⚠ as a caveat to report, "?" as an unknown risk.
- Test your checker: a clean set first (no false alarms), then planted problems one at a time. Write down what it can't see.
Practice: size it, then inspect it
Write the engine's arithmetic and three of the audit's checks: the cases for a margin, the cases a zero-failure claim needs, how often two versions disagree and how many shared cases a regression check needs, the binding constraint, the cost, the Wilson margin, the distance between two mixes, word overlap, and the verdict. The tests use the lab's numbers: 865 and 857, 59 and 299, 7.9% and 1,549, $1,598 against $1,603 and $934, ±7.3 points on the store's 100 cases, TVD 0.245, and 0% overlap for the reworded pair.
Quiz
1.The example design needs 1,551 cases. The margin alone needs 857, the critical group's claim 59, and the regression checks 1,549. Your manager loosens the margin from ±2 to ±3 points to save money. What happens?
2.Why do regression checks need so many cases, more than the overall margin?
3.The design tool warns that the critical group, expected to pass about 70%, will fail its claim "fails less than 5%". What should you do?
4.An audit of an eval set shows two "?" lines: the grader and failure discovery. How should you read them?
5.The store's eval set has 8 cases that also appear in the assistant's prompt examples and tuning log. Why does that block the score?
6.The audit raised no false alarms on a clean set and caught 11 of 12 planted problems. It missed reworded copies. What's the lesson?
Check your understanding
Try each question before opening its answer.
What inputs does an eval design need, and where does each come from?
The decisions, not a number of cases: the expected pass rate (a guess or a pilot run), the margin and confidence the decision needs, the size of the population, the groups of traffic and their shares (a labeled production sample), which groups need their own claim and what it is (whoever owns that risk), the smallest drop between versions you must catch and how alike versions behave (the release process and a pilot), the runs per case (do you need pass^k?), and the cost of a label and a run.
What is the binding constraint, and why does it matter?
Each requirement implies a size; the largest one is the binding constraint, and it sets the size and the price. In the example the margin needed 857 cases and the regression checks 1,549, so the design was 1,551 cases and $1,598. Loosening the margin to ±3 saved nothing ($1,603, from rounding), while dropping the regression checks cut the cost by about 42%. When someone asks for a cheaper eval, the question is whether the decision really needs the binding requirement.
Why do regression checks need more cases than a ±2-point margin?
Only cases where the two versions disagree can show a drop. With versions at 90% and 88% that behave alike (ρ = 0.6), only 7.9% of cases disagree, so 1,549 shared cases give about 120 informative ones: enough to catch a 2-point drop 4 times in 5.
The design warns that the critical group will fail its claim. Whose problem is that?
The product's. The group is expected to pass about 70%, so it would fail "fails less than 5%" whatever the eval does. 59 cases measure it to about ±11 points, enough to show the gap. The fix is in the assistant, not in the eval.
What would you check first when handed someone else's eval set?
Whether it represents production (the mix, and any group missing entirely), whether test cases leaked into the prompt or tuning, whether the interval is narrow enough for the decision, whether each important group can be measured, and whether the grader was checked against people. In the store's set, 8 leaked cases and a missing topic (subscriptions, 13% of traffic) each block the score, whatever its precision.
Why is "couldn't check" a finding?
Because missing information is an unknown risk, not an absent one. If nobody checked the grader against people, its mistakes are unknown; if nobody reviewed the failures, you don't know what kinds you're missing. An audit that skipped those lines silently would make the set look safer than it is.
How do you test an evaluation tool itself?
Like any detector: first check that it stays quiet on clean data (the audit raised no false alarms on a clean 1,000-case set), then plant known problems one at a time and see what's caught (11 of 12). The miss shows what it can't see: reworded copies, which a word-overlap check can't find. Planting from real incidents, not only the checks you wrote, keeps the test honest.
Next up: Rubric design: do your graders agree?. Every chapter so far took "pass" as given. The next one asks where "pass" comes from when an answer has no single right version: how to write a rubric two people apply the same way, and how to check whether graders agree.