Key takeaways
- ✓“How often does it fail?” is a rate; “in what ways does it fail?” is a list. In the simulation, the rate was known to ±3 points after about 240 cases. Finding all 28 failure types typically took 9,439, 39× as many, because every rare type has to show up at least once.
- ✓A discovery curve counts the distinct failure types found after each reviewed case. It climbs fast, because common types show up early (18 types after 1,000 cases in one review), then crawls (27 of 28 after 5,000). A flat curve says the source has stopped showing new types, not that none are left.
- ✓The popular stopping rule, “stop when 20 failures in a row bring no new type”, is good for finding the main problems. It typically stopped at 1,652 cases with 21 of 28 types and only 3 of the 6 critical ones. Waiting for 100 in a row took 5,552 cases and still typically missed one critical type.
- ✓Count the types you've seen only once. Many of them mean more types are hiding. Chao1 (from ecology, where it estimates bird species) turns those counts into an estimate: after 1,000 cases, 18 types seen, 9 of them once, Chao1 said 30 against a true 28. Over 300 reviews it usually ran low (a median of 22.5), so read it as “at least this many”.
- ✓Rare isn't harmless. After 1,000 cases the unseen types were typically 11.6% of failures but 36.6% of the failure cost, because 3 of the 6 rarest types were critical (each critical failure costs 50 times a normal one).
- ✓Every source of cases has blind spots: random requests are slow, synthetic tickets can't fake failures that need real customer data, users never flagged the hidden instruction. For 500 cases, no single source found all 6 critical types in more than 68.5% of reviews; a three-way mix found 26 of 28 types and all 6 critical in 81.5%.
- ✓Find with targeted sources, measure with random samples. Flagged and synthetic cases are skewed on purpose, so they can't say how often a failure happens; a random sample, or a stratified one weighted back (Chapter 3), can.
Chapters 1 to 3 asked how precisely you know a rate: how often your AI fails, give or take how much. This chapter asks a different question: in what ways does it fail, and how can you tell you haven't found them all? In the simulation below, the failure rate was known to ±3 percentage points after about 240 reviewed cases. Finding every type of failure typically took 9,439, and one dangerous failure, the AI obeying an instruction hidden inside a ticket, typically showed up for the first time only after about 5,100.
The examples come from Lab 05 (Dataset Saturation) of the AI evals labs, scripts 01_discovery_curve.py (how fast failure types are found, against how fast the rate is known), 02_unseen_modes.py (estimating the types you haven't seen, and what they cost) and 03_sources.py (where to look: four sources of cases and their blind spots). Their counting functions live in the labs' shared package, evalkit/discovery.py. The lab's fourth script, 04_your_labels.py, runs the same report on your own review labels; this chapter only mentions its example result. Every number here comes from the lab's code, re-run for this chapter.
Everything here is a simulation. The assistant is a simulated customer-support AI with 100,000 requests, and the lab planted the failures in it, so it knows the truth, which you never do in real life. The requests come in four kinds, the same mix as Chapter 3: normal (90% of traffic, failing 4% of the time), difficult (5%, failing 15%), ambiguous (4%, failing 20%) and critical (1%, failing 30%). Overall, 5.5% of answers fail.
What a type of failure is
Here a test case is one customer request and the AI's answer. Reviewing it means reading the answer and marking it pass or fail, and for each failure, writing down what went wrong. That label is its failure mode: its type of failure. The lab planted 28 of them, with a long tail of frequencies:
- 13 in normal traffic, from "missed the customer's second question" (about 1 in 110 requests) to "promised a callback that doesn't exist" (1 in 5,556);
- 5 in difficult requests (like "miscalculated a partial refund") and 4 in ambiguous ones (like "guessed instead of asking");
- 6 critical types: failures that cost money, leak data or put someone at risk. "Refund above the limit without approval", "changed account details without verification", "unsafe advice about a gas stove leak", "exposed another customer's order details", "made a legal promise about liability", and the rarest of all 28, "followed an instruction injected in the ticket", about 1 in 11,000 requests by design.
In one review, the first 100 cases held 6 failures of 5 different types; "wrong order status" showed up twice.
The discovery curve
Now keep reviewing, in random order. After every case, count how many different failure types you've found so far. Drawn as a line, that count is a discovery curve. Here is one review of 5,000 random cases, the one Scripts 1 and 2 read:
| Cases reviewed | Failures seen | Types found | Failure-rate margin |
|---|---|---|---|
| 100 | 6 | 5 | ±4.8 points |
| 500 | 22 | 11 | ±1.8 |
| 1,000 | 49 | 18 | ±1.3 |
| 2,000 | 109 | 24 | ±1.0 |
| 5,000 | 277 | 27 | ±0.6 |
The margin is half the width of the 95% confidence interval for the failure rate (the Wilson interval from Chapter 1). It shrinks fast: by 1,000 cases the rate is 4.9% ± 1.3 points, pinned down. The types climb fast at first, because common failures show up early, then crawl: 18 after 1,000 cases, 27 after 5,000. One type, "made up a discount code", still hadn't appeared. The flat end of the curve is called saturation: more review stops turning up new types, for the source you're sampling from.
Cases reviewed so far
49 failures in 1,000 cases. Margin in percentage points. Critical types not seen yet: unsafe advice about a gas stove leak; exposed another customer's order details; made a legal promise about liability; followed an instruction injected in the ticket.
Typical, over 200 random review orders (cases needed)
The two rate rows are planned sample sizes at the population's true 5.5% failure rate; the type rows are medians. The hidden-instruction failure, the last critical type in about half the orders, typically first appears at case 5,103.
“Stop after k failures in a row with no new type”, typical over 200 reviews: k = 20: stops at 1,652, 21 of 28 types, 3 of 6 critical · k = 50: stops at 3,376, 25 of 28 types, 4 of 6 critical · k = 100: stops at 5,552, 26 of 28 types, 5 of 6 critical. In this one review the 20-failure rule fired at case 2,223.
Two different questions
One review can be lucky or unlucky. So Script 1 replays the same 100,000 requests in 200 random orders and takes the typical result, the median:
| Milestone | Cases |
|---|---|
| Failure rate known to ±3 points | 240 |
| Half the types found (14 of 28) | 494 |
| Failure rate known to ±1 point | 2,010 |
| 90% of the types found (26 of 28) | 3,724 |
| All 28 types found | 9,439 |
The two rate rows aren't medians: they're the planned sample size at the true 5.5% rate, the calculation from Chapter 2. Knowing how often it fails took 240 cases; finding every way it fails took 9,439, 39× as many. And the critical types are among the latest: the median first sighting was case 664 for the unapproved refund, 2,457 for another customer's order details, and 5,103 for the hidden instruction, which was the last critical type to appear in 105 of the 200 orders.
How often it fails is a rate. In what ways it fails is a list. They're different questions, and the list needs far more cases, because every rare item on it has to turn up at least once.
A popular stopping rule
So when do people stop reviewing? A popular rule from qualitative research and error analysis is called theoretical saturation: stop when k failures in a row (often 20) bring no new type. Passes don't count; only failures extend or break the streak.
In the review above, the rule fired at case 2,223. The last 20 failures were all types already found; 6 of them were the most common one, "missed the customer's second question". At that point the review had 24 of 28 types and 4 of the 6 critical ones. Across 200 random reviews (Script 1, Exercise 3):
| k (failures in a row with nothing new) | Typically stops after | Types found | Critical types found |
|---|---|---|---|
| 20 | 1,652 cases | 21 of 28 | 3 of 6 |
| 50 | 3,376 | 25 of 28 | 4 of 6 |
| 100 | 5,552 | 26 of 28 | 5 of 6 |
The rule is good at what it was made for: "have I understood the main problems?". It fires when the common types keep repeating, which happens early in a random sample. It's poor at "have I found everything dangerous?": with k = 20 it typically stopped with half the critical types still unseen, and waiting for 100 in a row took more than three times as many cases and still typically missed one.
Types seen once
Can the review itself tell you you're not done? Ecologists face the same problem when they count bird species in a forest. If many of the species they spotted were seen just once, more are probably hiding: the tail of rare species hasn't been exhausted. If every species was seen again and again, they've likely found most of them.
Failure types work the same way. The counts that matter are f1, the number of types seen exactly once (singletons), and f2, the number seen exactly twice. After 1,000 cases the review above had 18 types; 9 of them were seen once and 2 twice. A formula from ecology called Chao1 (after the statistician Anne Chao) turns those counts into an estimate of the total, seen and unseen:
estimated total = types seen + f1 × (f1 − 1) ÷ (2 × (f2 + 1))
= 18 + 9 × 8 ÷ (2 × 3) = 18 + 12 = 30
The truth is 28, so this time it landed close. Its 95% range is wide, though: about 21 to 72. Read the same review at four points:
| Cases | Types seen | Seen once (f1) | Seen twice (f2) | Chao1 (rough 95% range) | Coverage: estimated | Coverage: true |
|---|---|---|---|---|---|---|
| 500 | 11 | 6 | 1 | 18.5 (12–54) | 73% | 63% |
| 1,000 | 18 | 9 | 2 | 30 (21–72) | 82% | 86% |
| 2,000 | 24 | 6 | 5 | 26.5 (24–39) | 94% | 97% |
| 5,000 | 27 | 3 | 1 | 28.5 (27–42) | 99% | 99% |
The last two columns are a second estimate from the same counts, Good–Turing coverage: the share of all failures that belong to types you've already seen, about 1 − f1 ÷ failures (at 1,000 cases, 1 − 9 ÷ 49 = 82%). Only a simulation knows the true share. Coverage answers "how many of the failures do the types I know explain?"; the next section shows why that isn't the question that matters most.
Each row a failure type found so far, each dot one failure of that type. ● marks a critical type.
Chao1 = seen + f1 × (f1 − 1) ÷ (2 × (f2 + 1)) = 18 + 9 × 8 ÷ 6 = 30. Rough 95% range 21–72. The truth: 28.
Over 300 reviews of 1,000 cases, Chao1's median was 22.5 and its range held 28 in 82% of them: it usually runs low. Read it as “at least this many”.
Types not seen yet: share of failures
11.6%
typical (median of 300 reviews) · this review: 14.5%
… and share of failure cost
36.6%
typical (median of 300 reviews) · this review: 32.3%
Cost per failure: normal 1, difficult or ambiguous 2, critical 50. Only a simulation knows the unseen types; in real life you have the left-hand rows and nothing else.
Chao1 usually guesses low. Script 2 ran it on 300 independent reviews per size: with 1,000 cases its median estimate was 22.5, and with 500 cases 19.2, against a true 28. Its 95% range contained 28 in only 68–88% of reviews, depending on the size. That's built in: a type too rare to show up even once leaves no singleton behind, so nothing can count it. Read Chao1 as "at least this many", not as a total. It also assumes the cases come from one source, independently: mixing sources or reviewing near-duplicate traces distorts the counts.
Rare isn't harmless
The types you haven't found yet are rare, by definition. So it's tempting to say they don't matter much. Script 2 checks that by giving every failure a cost: a normal failure costs 1, a difficult or ambiguous one 2, a critical one 50.
| Cases reviewed | Unseen types: share of failures | Unseen types: share of the cost |
|---|---|---|
| 500 | 26.0% | 58.4% |
| 1,000 | 11.6% | 36.6% |
| 2,000 | 4.3% | 19.1% |
| 5,000 | 0.6% | 4.8% |
Medians over 300 random reviews. After 1,000 cases the types still unseen are typically about 12% of failures, but carry more than a third of the cost. The reason is in the tail: of the six rarest types, three are critical (the hidden instruction, a legal promise, another customer's order details shown). Coverage of failures and coverage of harm are different numbers.
Where the cases come from
So far the cases were picked at random. Script 3 compares four places to look, each reviewed 500 or 1,000 cases at a time:
- Random: production requests picked at random. Slow, because about 19 of 20 pass.
- Stratified: the same number of requests from each kind of traffic, including the critical 1% (stratified sampling, Chapter 3).
- Synthetic tricky tickets: fake difficult, ambiguous and critical tickets a generator writes (the lab calls this source "adversarial"). It can only provoke the types it was built to reach, and it can't fake failures that need real customer data.
- User-flagged: production failures a user flagged with a thumbs-down or a complaint. Every case is a failure, but only the ones users notice.
| Source | Types after 100 cases | after 500 | after 1,000 | Critical types after 500 |
|---|---|---|---|---|
| Random | 5 | 14 | 19 | 1 of 6 |
| Stratified | 10 | 18 | 21 | 6 of 6 |
| Synthetic | 13 | 13 | 13 | 5 of 6 |
| User-flagged | 20 | 26 | 27 | 4 of 6 |
(Medians over 100 reviews.) Each source is blind somewhere. The generator went flat at 13 types after about 100 cases: it never found a normal-traffic type, and never "exposed another customer's order details", which needs real data. In this simulation users never flag the hidden instruction (the lab sets that chance to zero: people don't report what they don't notice, or what works in their favor), and flag the legal promise only 10% of the times they hit it.
Mix the sources
Now give every option the same budget of 500 reviewed cases, 200 times each (Script 3, Exercise 3):
| Budget split | Types found | Critical types found | Reviews that found all 6 critical |
|---|---|---|---|
| All random | 13 of 28 | 1 of 6 | 0 of 200 |
| All synthetic | 13 | 5 | 0 |
| All user-flagged | 26 | 4 | 0 |
| All stratified | 18 | 6 | 137 (68.5%) |
| ½ stratified + ½ synthetic | 16 | 6 | 169 (84.5%) |
| ⅓ flagged + ⅓ synthetic + ⅓ stratified | 26 | 6 | 163 (81.5%) |
No single source reliably finds all six critical types; the best, stratified, does in about two reviews out of three. Their blind spots differ, so a mix covers more of them. Half stratified, half synthetic does a bit better on the critical types (84.5%) but finds only 16 types; the three-way mix finds 26 of 28 and all six critical types in about four reviews out of five.
| Source | Types at 100 | at 500 | at 1,000 | Critical at 500 |
|---|---|---|---|---|
| Random | 5 | 14 | 19 | 1 of 6 |
| Stratified | 10 | 18 | 21 | 6 of 6 |
| Synthetic tricky tickets | 13 | 13 | 13 | 5 of 6 |
| User-flagged | 20 | 26 | 27 | 4 of 6 |
Average of 100 reviews per source; the table shows medians. User-flagged cases are all failures, so that curve rises fastest. The synthetic generator reaches its 13 types within about 100 cases and then stays flat.
One thing none of the targeted sources can do is measure. Flagged and synthetic cases are skewed on purpose, so they say nothing about how often each failure happens in production. Keep a random sample for that, or a stratified one weighted back to the real traffic mix, as in Chapter 3. Targeted sources to find failures; random samples to measure them.
What to do
- Ask the two questions separately, and size each one. How often it fails: a few hundred random cases for ±3 points (Chapter 2). In what ways it fails: thousands of cases, or better, sources aimed at the risky parts.
- Plot a discovery curve for every review: distinct types against cases reviewed, per source.
- Don't stop on "20 failures with nothing new" alone. It finds the main problems. Before saying "we know how it fails", count the types seen only once: many of them mean you're not done.
- Compute Chao1 and read it as a floor. If it's well above the types you've seen, keep going.
- Weigh the unseen types by cost, not count. The rare types can carry much of the harm.
- Mix sources to find: stratified for rare kinds of traffic, synthetic for what you can provoke, user flags for what users notice. Know each one's blind spots.
- Sample at random (or stratify and weight back) to measure how often each type happens.
Caveats
- A simulation with planted failures. The 28 types, their frequencies, the user flag chances and what the generator can reach are settings in the lab's simulation file,
common.py. The lessons carry over; the exact numbers are this simulation's. - Rounded medians. Medians of 200 can end in .5, and the lab rounds them to the even number: the k = 20 rule stops at a median of 1,652.5 (shown as 1,652), half the types at 493.5 (494).
- About 1 in 11,000 is a design rate. The 100,000 simulated requests actually hold 12 hidden-instruction failures, about 1 in 8,300.
- The mixes reviewed slightly fewer than 500 cases. The lab splits 500 into whole cases per source (and the stratified source into equal quarters): the three-way mix reviewed 496, half-and-half 498.
- Chao1 assumes one source and independent cases. Run it per source (or per kind of traffic), not on a mix.
- Your own labels.
04_your_labels.pyprints the same report for a real review. On its bundled example of 600 traces (simulated too), the 20-failure rule fired at trace 338 while 7 categories had been seen once and Chao1 estimated about 26 (22–49): not saturated.
The checklist
- What's the difference between a precise failure rate and having found the failure types? A rate needs a few hundred cases; the list needs every rare type to show up, which took 39× as many here.
- What is a discovery curve, and what does saturation mean? Distinct types against cases reviewed; saturation is its flat end, for the source you're sampling from.
- How do the types seen once help? Many singletons mean more types are hiding; Chao1 turns f1 and f2 into an estimate.
- What are Chao1's limits? It runs low (types never seen leave no clue), its range missed the truth 12–32% of the time, and it assumes one source.
- When is "20 failures with nothing new" appropriate? For finding the main problems; not for "have I found everything dangerous?".
- Why can unseen types matter more than their frequency? The rarest types include critical ones: 11.6% of failures, 36.6% of the cost after 1,000 cases.
- Which sources find which failures, and how do you combine them? Each has blind spots; mix them to find, and sample at random to measure.
Practice: count what you haven't seen
Write the lab's discovery math: the discovery curve, how many types were seen once and twice, Chao1's estimate, Good–Turing coverage, the "k failures with nothing new" stopping rule, and the share of failures and of cost in the types you haven't seen. The tests use the recorded review up to case 2,223, where the 20-failure rule fired: 11 types after 500 cases and 18 after 1,000, Chao1 30 (21–72) at 1,000, coverage 82%, and the unseen types holding 14.5% of failures but 32.3% of the cost in this review.
Quiz
1.In the simulation the failure rate was known to ±3 points after about 240 cases. Finding all 28 failure types typically took 9,439. Why so many more?
2.You review production traces and stop when 20 failures in a row bring no new type. In the simulation, what did that typically miss?
3.After 1,000 cases you've seen 18 failure types: 9 of them once, 2 of them twice. What does that suggest?
4.Why does Chao1 usually guess low?
5.After 1,000 cases, the types you haven't seen are about 12% of all failures. Is it safe to ignore them?
6.User-flagged tickets found the most failure types (26 of 28 in 500 cases). Why not use only them?
Check your understanding
Try each question before opening its answer.
Your failure rate is known to ±1.3 points after 1,000 reviewed cases. Have you found the ways it fails?
Not necessarily. The rate and the list are different questions. In the simulation, 1,000 cases gave 4.9% ± 1.3 points but only 18 of 28 failure types and 2 of the 6 critical ones. Finding all 28 typically took 9,439 cases.
What is a discovery curve, and does a flat one mean you're done?
The number of distinct failure types found after each reviewed case. It climbs fast, then crawls. Flat means this source has stopped showing new types, not that none are left: the synthetic generator went flat at 13 of 28 after about 100 cases, because it can't reach the rest.
A review of 1,000 cases found 18 types, 9 seen once and 2 seen twice. Estimate the total, and say how much to trust it.
Chao1 = 18 + 9 × 8 ÷ (2 × 3) = 30, with a rough range of 21–72. The truth was 28. Chao1 usually runs low (median 22.5 over 300 reviews of 1,000 cases), because a type never seen leaves no clue, so read it as "at least this many".
When is "stop when 20 failures in a row bring no new type" a good rule?
For finding the main problems in a first round of error analysis. Not for safety work: it typically stopped at 1,652 cases with 3 of 6 critical types. Check the types seen once, and aim sources at the risky kinds of traffic.
Good–Turing says 95% of failures belong to types you already know. What doesn't that tell you?
How bad the other 5% are. Coverage counts failures, not harm. After 1,000 cases the unseen types were typically 11.6% of failures but 36.6% of the cost, because the rarest types include critical ones.
You have budget to review 500 cases. Where do they come from?
A mix, because each source has a blind spot: stratified for the critical kinds of traffic, synthetic tickets for what a generator can provoke, user flags for what users notice. In the simulation the three-way mix found 26 of 28 types and all 6 critical in 81.5% of reviews; no single source beat 68.5%.
Why keep a random sample if targeted sources find more types?
To measure. Flagged and synthetic cases are skewed on purpose, so they can't say how often each type happens in production. A random sample, or a stratified one weighted back to the real mix (Chapter 3), can.
Next up: Chapter 5, repeated runs: so far every case passed or failed once. Run the same eval again with nothing changed and the score moves. Chapter 5 separates the number of cases from the number of runs, and measures pass@k (the share of cases that pass at least once in k runs) and pass^k (the share that pass all k).