ealeng

Episode 05 of 15 · Can you trust the score?

Same test, different score: repeated runs, flaky tests, pass@k and pass^k

A simulated AI ran the same 100 tasks twice with nothing changed and scored 76%, then 83%. Why scores move on their own (flaky tests), what temperature changes and what it doesn't, pass@k (at least one of k runs passes) against pass^k (all k pass), why one run's pass rate to the power k is the wrong shortcut (19.6% against a true 57.3%), and why 100 tasks × 5 runs aren't 500 test cases.

Lab 06 · Repeated Runs17 min read
Video transcript7:05

0:00Cold open

0:01

We test our AI on a hundred tasks, each with an answer we can check. I ran the test once: seventy-six percent passed.

0:10

Then I ran it again. Same AI, same tasks, nothing changed. Eighty-three percent.

0:17

Eleven tasks that failed now passed. Four went the other way.

0:21

If the first run had been our old prompt, and the second a new one, I’d have called it a seven-point win.

0:29

So when the same test gives different scores, how do you tell a real improvement from luck?

0:35Intro

0:37

Hands-on AI evals: can you trust the score? Part one.

0:41

Today: flaky tests, what temperature changes, and why “passes once” and “passes every time” are different numbers.

0:50Meet Maya

0:51

I’m Maya, an ML engineer. First, three words I’ll use a lot.

0:56

A task is one test case: a question with an answer we can check.

1:01

A run is one attempt. I ask the AI once, and grade the answer: pass, or fail.

1:07

The pass rate is the share of runs that pass. Seventy-six out of a hundred is seventy-six percent.

1:15

And the AI in this video is a simulation I built: two thousand tasks, each with its own true chance of passing. So I know the truth, which you never do in real life.

1:2701 · Flaky tasks

1:28

So why did the score move? To see it, I took twenty tasks, and ran each one ten times.

1:34

Nine tasks passed all ten runs.

1:37

The other eleven flipped at least once. A task that sometimes passes and sometimes fails is called flaky.

1:46

Look at the top four. They pass nine runs in ten. They’re not hard. They just slip now and then.

1:52

It’s like free throws. A great shooter still misses some. One shot tells you little about the player.

1:58

Even a task that passes ninety-seven percent of the time: give it ten runs, and about one time in four, at least one fails.

2:08

So with one run per task, the score depends partly on which runs you happened to get.

2:1402 · Temperature

2:15

Can a setting fix this? Language models have one called temperature. It sets how random the answers are. Near zero, the model gives its most likely answer almost every time.

2:27

I took a hundred tasks and ran each ten times at temperature zero, then the same hundred at 0.7.

2:35

At 0.7, thirty-five tasks were flaky. At zero, only nine.

2:41

Then I reran the whole test two hundred times, one run per task each time. At zero, the score wobbles about half as much.

2:50

But the true pass rate barely moves. The two are less than a point apart.

2:56

I built my simulation that way: a low temperature makes it more consistent, not more correct. Real models can shift a little either way, so measure yours.

3:06

So test at the temperature you’ll ship with. If you ship at a higher one, a test at zero hides the randomness your users will see.

3:1503 · Once, or every time?

3:17

Repeats also answer a second question. Sometimes one good answer out of several is enough. Sometimes users need a good answer every time.

3:26

Back to free throws. A shooter who makes ninety percent of her shots makes five in a row only fifty-nine percent of the time.

3:35

Evals measure both. Say we run it k times: k is just the number of runs. “At least one passes” is written pass at k.

3:43

“All k pass” gets a little hat: pass hat k.

3:47

I ran two hundred tasks ten times each. As k grows, “at least one” climbs to about nine in ten.

3:55

“All of them” falls to about half.

3:58

Which one to report? At least one of k, when you can keep the best answer. Say the AI writes five versions of some code, and your tests keep one that passes.

4:08

All k, when users need it to work every time: an agent, or a support flow.

4:1504 · The shortcut

4:16

Now a puzzle. Two AIs both pass a single run seventy-two percent of the time.

4:22

A user brings the same task five times. How often do all five runs pass?

4:29

In the first AI, every task has the same seventy-two percent chance. All five pass about twenty percent of the time. That’s seventy-two percent multiplied by itself five times: a shortcut many people use to guess “all five”.

4:46

The second is ours, with easy, hard and in-between tasks. All five: fifty-seven percent.

4:54

Why so different? Look at our tasks. Most pass almost always, or almost never. An easy task passes five in a row with ease.

5:03

So the shortcut, one run’s rate multiplied by itself, can be far too gloomy when tasks differ. Measure “all five” from repeated runs instead.

5:1305 · Runs aren’t tasks

5:15

Repeats also set a trap. A hundred tasks, five runs each: that’s five hundred results. Are they worth five hundred test cases?

5:24

To check, I ran this evaluation four hundred times, on fresh tasks each time, and gave each result a ninety-five percent range: where the true pass rate probably is. A good one catches the truth ninety-five times in a hundred.

5:39

The naive range treats all five hundred results as five hundred separate test cases. It’s narrow. And it catches the truth only about seven times in ten.

5:51

Why? Five runs of one task share its difficulty. An easy task passes all five. You really have a hundred tasks, not five hundred cases.

6:01

So build the range from the tasks: each task’s own pass rate, a hundred of them. It’s about twice as wide, and it catches the truth more than nine times in ten.

6:1306 · What I do now

6:15

Back to my seventy-six and eighty-three. For these tasks, two runs differ by seven points or more only about one time in twenty. But a gap of three points or more happens more than four times in ten.

6:29

So before I credit a change, I rerun the test a few times, to see how much it moves on its own. And I look at which tasks flipped, not just the score.

6:39

I test at the temperature we ship with. When users need it to work every time, I report “all k pass”, measured from repeats.

6:48

And I build ranges from tasks, not runs.Maya: Rerun before you celebrate.

6:51

Next time: designing an eval, and auditing one before you trust its score.

6:57Summary

6:58

Scores flip on their own. Know the noise before you trust a change.Maya: Thanks for watching!

Key takeaways

  • ✓An LLM can pass a task on one run and fail it on the next. Such a task is flaky. Of 20 simulated tasks run 10 times each, 11 flipped at least once, and scoring the eval on any single run gave anywhere from 75% to 95%. Even a task that passes 97% of the time fails at least once in 10 runs 26% of the time.
  • ✓The same 100-task eval, run twice with nothing changed, scored 76% and then 83%: 11 tasks went from fail to pass and 4 the other way. A 7-point gap is rare for those tasks (4.6% of rerun pairs), but a gap of 3 points or more happens 44.2% of the time. Know how much your score moves on its own before you credit a change.
  • ✓In this simulation, lower temperature makes the AI more consistent, not more correct: 9 flaky tasks of 100 at temperature 0 against 35 at 0.7, half the score wobble (1.2 against 2.3 points), and a true pass rate under a point apart (78.4% against 77.5%). Test at the temperature you ship with.
  • ✓pass@k is the chance at least one of k runs passes; pass^k, the chance all k pass. From 200 tasks × 10 runs, pass@10 was 89.0% and pass^10 51.5%. Report pass@k when you can keep the best of k answers (tests pick one), and pass^k when users need it to work every time.
  • ✓Don't compute pass^k as one run's pass rate to the power k. That assumes every task has the same chance. With a true pass rate of 72.2%, all 5 runs passing is 19.6% if every task is alike, but 57.3% for tasks that mostly pass almost always or almost never. Measure pass^k from repeated runs.
  • ✓Runs of one task aren't separate test cases: they share the task's difficulty. A 95% confidence interval that treats 100 tasks × 5 runs as 500 cases was 7.5 points wide and caught the true pass rate in 72.5% of 400 evaluations. Built from the 100 tasks' own pass rates, it was 14.5 points wide and caught it 92.5% of the time.
  • ✓For a more precise average, more tasks beat more runs: 500 runs spread as 500 × 1 had a spread (SD) of 1.77 points, as 100 × 5 had 3.63. Repeats pay off when new tasks cost much more than runs, and they're the only way to measure pass^k or find flaky tasks.

We test an AI on 100 tasks, each with an answer we can check. Run it once: 76% pass. Run it again, with the same AI on the same tasks and nothing changed: 83%. Eleven tasks that failed now passed, and four went the other way. If the first run had been the old prompt and the second a new one, that would have looked like a seven-point win. This chapter is about telling a real improvement from luck: why the same test gives different scores, what temperature does about it, why "passes once" and "passes every time" are different numbers, and why five runs of one task aren't five test cases.

The examples come from Lab 06 (Repeated Runs) of the eval labs, scripts 01_flakiness.py (flaky tasks, temperature, an eval that disagrees with itself), 02_pass_at_k.py (pass@k and pass^k) and 03_clustered_intervals.py (intervals when each task runs several times), with the math in the lab's evalkit/repeats.py. A short section covers 04_cases_vs_runs.py (more tasks or more runs?), which the video skips. The lab's last script, 05_real_model.py, repeats the measurements on a real model through a paid API; it isn't covered here. The AI in this chapter is simulated: a pool of 2,000 tasks, each with its own true chance of passing. 70% are easy (about 97%), 15% are hard (about 5%) and 15% are genuinely unsure (anywhere from 20% to 80%); the whole pool passes 75.0% of the time. Because it's a simulation, we know each task's true chance, which you never do in real life. Every number below is from the lab's scripts with their own random seeds, so rerunning them prints the same results.

Three words used throughout. A task is one test case: a question with an answer we can check. A run is one attempt: ask the AI once and grade the answer, pass or fail. The pass rate is the share of runs that pass: 76 of 100 is 76%. In the lab's printouts a task is named by its number in the pool, like "task 1818"; the number carries no meaning beyond that.

Flaky tasks

To see why the score moved, the lab took 20 tasks and ran each one 10 times. Nine passed all ten runs. The other eleven flipped at least once. A task that passes on some runs and fails on others is flaky, the same word as for a flaky test in ordinary software. Pick a run below and score the eval on it alone.

Try it · Twenty tasks, ten runs eachLab 06 · 01_flakiness.py · simulated AI, temperature 0.7
Score the eval on one run:
task12345678910passed
535✓✓✓✓✓✓✓✓✓✓10/10
1209✓✓✓✓✓✓✓✓✓✓10/10
611✓✓✓✓✓✓✓✓✓✓10/10
1456✓✓✓✓✓✓✓✓✓✓10/10
1119✓✓✓✓✓✓✓✓✓✓10/10
1685✓✓✓✓✓✓✓✓✓✓10/10
1262✓✓✓✓✓✓✓✓✓✓10/10
1292✓✓✓✓✓✓✓✓✓✓10/10
81✓✓✓✓✓✓✓✓✓✓10/10
1818✓✓✓✓✓✓✗✓✓✓9/10 flaky
1086✓✓✓✗✓✓✓✓✓✓9/10 flaky
348✓✓✗✓✓✓✓✓✓✓9/10 flaky
1996✓✓✓✓✓✗✓✓✓✓9/10 flaky
149✓✗✓✓✓✓✓✗✓✓8/10 flaky
1003✓✓✓✓✗✓✓✓✗✓8/10 flaky
1013✓✓✓✓✓✗✓✗✓✓8/10 flaky
1936✓✗✓✓✗✓✓✗✓✓7/10 flaky
1618✓✓✗✓✓✓✗✓✗✓7/10 flaky
1870✗✓✗✓✓✓✓✗✓✓7/10 flaky
32✓✗✗✗✗✗✗✗✗✗1/10 flaky
Score on run 1
95%
Always passed
9 of 20
Flaky (flipped)
11 of 20

Run 1 alone: 19 of 20 pass. Pick another run and the same AI on the same tasks gets a different score.

Rows are sorted by passes. The number on the left is the task's number in the simulated pool of 2,000 tasks. Recorded with the lab's seed (0), so it's the exact grid the script prints.

The four tasks at the top of the flaky group passed 9 runs in 10. They aren't hard; they slip now and then. The same AI on the same 20 tasks scores anywhere from 15 to 19 of 20, 75% to 95%, depending on which run you look at.

It's like free throws in basketball. A great shooter still misses some, and one shot tells you little about the player. A shooter who makes 90% of her shots makes five in a row only 59% of the time (0.9 × 0.9 × 0.9 × 0.9 × 0.9). A task that passes 97% of the time, given ten runs, fails at least once 26% of the time, about one time in four.

Try it · Free throwsexact arithmetic: chance per shot to the power k

100 practice sessions of 5 shots each, sorted

● every shot made● at least one miss
All 5 made
59.0%
At least one miss
41.0%

90.0% × itself 5 times = 59.0%. A good shooter still misses, and the longer the streak you ask for, the likelier one miss is. One shot tells you little about the shooter; one run tells you little about a task.

Each dot is one session; the share of green dots is the exact chance, rounded to whole sessions (not a simulation). It assumes every shot has the same chance. For one shooter or one task that holds; for a mix of tasks it doesn't, which is the trap in the pass@k section.

So with one run per task, part of the score is which runs you happened to get. Flaky tasks are also the most useful ones to read when you look for failures: they sit exactly where the model is unsure.

What temperature changes

Language models have a setting called temperature: how random the answers are. Near zero, the model gives its most likely answer almost every time. The lab took 100 tasks and ran each 10 times at temperature 0, then the same 100 tasks at 0.7. Then it reran the whole eval 200 times at each temperature, one run per task each time, to see how much the score wobbles:

Temperature 0 Temperature 0.7
Flaky tasks (of 100) 9 35
Always pass / always fail 74 / 17 56 / 9
Typical wobble of a one-run score (standard deviation over 200 reruns) 1.2 points 2.3 points
Lowest and highest of the 200 scores 76–82% 72–85%
True pass rate (known from the simulation) 78.4% 77.5%

The standard deviation (SD) is the typical distance of a score from the average score; here it halves at temperature 0. But the true pass rate barely moves: the two are less than a point apart. That's by design. The simulation is built so a low temperature pushes every task toward always-pass or always-fail: more consistent, not more correct. Real models can shift a little either way, so measure yours.

The practical rule: test at the temperature you ship with. If the product runs at 0.7, a test at 0 hides the randomness your users will see. And temperature 0 isn't reliably deterministic with most hosted models (batching and hardware can still change outputs), so measure that too rather than assume it. If you run a cheap test at 0 for every change, also run the shipped setting now and then, with repeats.

Once, or every time?

Repeats also answer a second question. Sometimes one good answer out of several is enough; sometimes users need a good answer every time. Evals measure both. Say we run a task k times, where k is just the number of runs:

  • pass@k ("pass at k"): the chance at least one of the k runs passes.
  • pass^k ("pass hat k"): the chance all k runs pass.
  • pass@1 is the pass rate so far; with one run the two are the same number.

The lab estimates both per task from n runs with c passes, then averages over tasks. Take a task that passed 7 of its 10 runs. Choose 5 of those 10 runs: there are 252 ways. In 21 of them all 5 chosen runs are passes (pick 5 of the 7 passes), so its pass^5 is 21 ÷ 252 = 8.3%. None of the ways picks 5 failures, because there are only 3, so its pass@5 is 100%. This counting uses every run, not only the first k. As formulas, with C(a, b) the number of ways to choose b of a: pass@k = 1 − C(n − c, k) ÷ C(n, k), and pass^k = C(c, k) ÷ C(n, k).

The lab ran 200 tasks 10 times each:

k pass@k true pass@k pass^k true pass^k
1 73.3% 72.2% 73.3% 72.2%
2 79.6% 78.5% 67.1% 65.9%
3 82.3% 81.1% 63.7% 62.2%
5 85.5% 84.0% 59.1% 57.3%
10 89.0% 87.4% 51.5% 49.4%

As k grows, "at least one" climbs to about nine in ten and "all of them" falls to about half. The estimates land within about 2 points of the truth (the "true" columns use each task's known chance, which only a simulation has).

Which one to report? pass@k when you can keep the best of k: the AI writes five versions of some code and your tests keep one that passes, or a person picks from three candidates. pass^k when users need it to work every time: an agent, a support flow, anything a user relies on again and again. Reporting the wrong one misleads in a predictable direction: pass@k makes an unreliable system look great.

Try it · At least one, or every time?Lab 06 · 02_pass_at_k.py · 200 simulated tasks × 10 runs
0%25%50%75%100%12345678910k (runs)
━ pass@k: at least one of k passes━ pass^k: all k pass
pass@5
85.5%
pass^5
59.1%

Measured from 10 runs per task: at least one of 5 runs passes 85.5% of the time; all 5 pass 59.1%.

The shortcut that's wrong

A puzzle. Two AIs both pass a single run 72.2% of the time (the true pass rate of the 200 tasks above). A user brings the same task five times. How often do all five runs pass?

  • In the first AI, every task has the same 72.2% chance. All five pass 19.6% of the time: 72.2% multiplied by itself five times. That multiplication is a shortcut many people use to guess pass^k.
  • The second AI is the lab's, with easy, hard and in-between tasks. All five pass 57.3% of the time.

Why so different? Look at its tasks: 125 of the 200 pass at least 90% of the time and 32 pass under 10%. An easy task passes five in a row with ease, and the failures pile up on the few hard tasks, which fail every time whether you run them once or five times. The shortcut spreads those failures evenly over every task. For a mix of tasks it can only be too low, never too high, and here it's three times too gloomy (the widget's "The shortcut" option above draws it against the measured curves, with the 200 tasks' true chances). Measure pass^k from repeated runs; don't compute it from one run's pass rate.

With repeats you also get an interval for each number. From the first 100 of these tasks, resampling whole tasks (a bootstrap: draw 100 tasks at random from the 100, allowing repeats, recompute, and do that 2,000 times; the middle 95% of the results is the interval): pass@1 77.5% (70.3–84.0%), pass@5 88.8%, pass^5 64.7% (56.0–73.2%).

Runs aren't test cases

Repeats set a trap too. 100 tasks × 5 runs is 500 results. Are they worth 500 test cases?

A 95% confidence interval is a range built from the results that should contain the true pass rate 95 times in 100; its margin is half its width, the "±" in "80% ± 4 points". To check whether an interval keeps that promise, the lab ran the evaluation 400 times, each time on 100 fresh tasks from the pool, 5 runs each, and counted how often each kind of interval contained the pool's true pass rate (75.0%):

Interval Average width Contained the truth
Naive: the 500 results as if they were 500 separate test cases 7.5 points 290 of 400 (72.5%)
From the tasks: the spread of the 100 per-task pass rates 14.5 points 370 of 400 (92.5%)
Cluster bootstrap: resample whole tasks with all their runs 14.3 points 371 of 400 (92.75%)

The naive interval is narrow and wrong more than a quarter of the time instead of one time in twenty. The reason: five runs of one task share its difficulty. An easy task passes all five; a hard one fails all five. The biggest uncertainty is which tasks you happened to pick, and there are only 100 of those, not 500. Build the interval from the tasks: each task's own pass rate (passes ÷ runs), a hundred numbers, and their spread. It's about twice as wide, and it comes close to its promise.

Try it · Runs aren't tasksLab 06 · 03_clustered_intervals.py · 100 simulated tasks × 5 runs
60%70%80%90%truth 75.0%the first 50 of 400 evaluations, each on 100 fresh tasks
Missed, of these 50
14
Caught the truth, all 400
290 (72.5%)
Average width
7.5 pts

Each line is one evaluation's 95% confidence interval, computed as if its 500 results were 500 separate test cases. It's narrow, and it misses the truth (red) far more than 5 times in 100: a task's five runs share its difficulty, so they mostly agree.

Simulated: the true pass rate of the pool (75.0%) is known only because the AI is simulated. Recorded with the lab's seed (0). The lab's third interval, the cluster bootstrap, resamples whole tasks: 14.3 points wide, caught the truth 371 of 400 times (92.75%).

Any interval that counts each result as independent falls into this trap, including the Wilson interval from Chapter 1 if you feed it 500 runs as if they were 500 tasks. Count tasks, not runs. And it happens without any repeats too: ten questions about one document share that document's difficulty. In the lab's second example, 50 documents × 10 questions each, the naive interval caught the truth 81.25% of the time (325 of 400) and the per-document one 94.5% (378). Those 500 questions were worth about 248 independent ones.

How much are the runs worth? The lab splits the noise into two parts: how different the tasks are, and how random the model is on a given task. The share that belongs to the task is called the intraclass correlation (ICC). A high ICC means a task's runs mostly agree, so extra runs add little. On 200 tasks × 10 runs, the ICC was 0.67 at temperature 0.7 and 0.92 at temperature 0. At 0.7, 100 tasks × 5 runs were worth about 135 independent tasks; at 0, where the runs agree even more, about 107. (The formula: results ÷ (1 + (runs − 1) × ICC), for example 500 ÷ (1 + 4 × 0.67) ≈ 135. The divisor is called the design effect.)

More tasks or more runs?

Script 04 asks the budget question, which the video leaves out. With 500 runs in total, simulated 3,000 times per split, the spread (SD) of the measured pass rate was:

Tasks × runs SD of pass@1 SD of pass^5
500 × 1 1.77 points can't estimate
250 × 2 2.36 can't estimate
100 × 5 3.63 4.69
50 × 10 5.02 6.14

For a precise average, spreading runs over more different tasks always wins: a new task tells you about both kinds of randomness, a repeat only about the model's. The answer changes when tasks cost much more than runs, because writing and checking a task costs real money and a model call costs a fraction of a cent. With $300, $1 per new task and $0.006 per run, the best split was 283 tasks × 10 runs, margin ±4.2 points, against 298 × 1 at ±4.9: a real but modest gain. A pilot of 100 tasks × 5 runs at those prices recommended about 10 runs per task. And repeats are the only way to measure pass^k or to find flaky tasks, whatever they cost.

Back to 76 and 83

How unusual was the cold open? From those 100 tasks' true chances, the chance that two runs differ by a given amount can be computed exactly (the video's exporter did this with the lab's own task model; the lab doesn't print it): 7 points or more 4.6% of the time, about one rerun pair in twenty. 3 points or more 44.2% of the time, more than four in ten. The 76 → 83 swing was unlucky, but a three-point "win" from noise is routine.

So before crediting a change, rerun the test a few times to see how much the score moves on its own, and compare old and new on the same tasks, task by task: which tasks flipped, and in which direction. That's a paired comparison: each task is compared with itself, so the differences between tasks drop out. With a flaky model, give each task several runs on both sides, and resample tasks (not runs) when you put an interval on the difference.

What to do

  1. Rerun before you celebrate. Run the unchanged eval a few times to learn how much its score moves on its own.
  2. Look at which tasks flipped, not just the score. Read the flaky tasks first: that's where the model is unsure.
  3. Test at the temperature you ship with. A test at 0 can be a cheap check, not the release number.
  4. Pick the metric for the product: pass@k when something keeps the best of k answers, pass^k when it must work every time.
  5. Measure pass^k from repeats, never as pass@1 to the power k.
  6. Build intervals from tasks, not runs: per-task pass rates, or a bootstrap that resamples whole tasks.
  7. Spend on new tasks first for a precise average; add runs when tasks are expensive, or when you need pass^k.

Caveats

  • Everything here is simulated. The task pool, the temperature effect and every "true" value come from the lab's model (common.py), not from a real AI. Script 05 measures a real model, but its results aren't recorded in the lab (it was tested only in a stand-in mode without an API key), so this chapter has no real-model numbers.
  • The temperature effect is an assumption. The simulation sharpens every task toward always-pass or always-fail and leaves the pass rate roughly alone. A real model may gain or lose a little accuracy at temperature 0.
  • One draw of each experiment. The 76 → 83 pair, the 20-task grid and the 200-task matrix are single random draws. Other seeds give other numbers; the 4.6% and 44.2% say how typical the cold open's gap was.
  • "Close to 95%" isn't 95%. The task-level intervals caught the truth 92.5% and 92.75% of the time, a little short with only 100 tasks of very unequal difficulty. They're far closer than the naive 72.5%.
  • Rounded in the lab's printout. Script 03 prints the bootstrap's 371 of 400 as 92.8% and the documents' naive 325 of 400 as 81.2%; this chapter gives the exact shares, 92.75% and 81.25%.

The checklist

  1. Why can an unchanged eval give a different score? Runs are random; flaky tasks flip.
  2. How much does your score move on its own? Rerun it before judging a change.
  3. Which tasks flipped, and are they the same ones that "improved"?
  4. At what temperature was it tested, and is that the one you ship?
  5. pass@1, pass@k or pass^k: which one matches how users meet the system?
  6. Was pass^k measured from repeats, or computed with the shortcut?
  7. What's the independent unit: tasks, documents, users, conversations? Build the interval on it.
  8. More tasks or more runs for this budget, and do you need pass^k at all?

Practice: count the flips and build the right interval

Write the lab's repeat math: count flaky tasks, count flips between two runs, the chance all k runs pass, pass@k and pass^k from n runs per task, the naive interval and the task-level one, and how many independent tasks repeated runs are worth. The tests use the lab's recorded runs: the 20-task grid (9 always pass, 11 flaky), the 76 → 83 pair (4 and 11 flips), the 200 × 10 matrix (pass@10 89.0%, pass^10 51.5%, the shortcut's 21.2% at k = 5), and 100 tasks × 5 runs, where the task-level interval comes out about twice as wide as the naive one.

Try it · Practice in PythonRuns in your browser · ⌘/Ctrl + Enter to run
repeats_practice.py74 lines

Quiz

Try it · Check your understanding0 of 6 answered
  1. 1.You rerun an unchanged eval of 100 tasks and the score goes from 76% to 83%. What's the best first reading?

  2. 2.A task passes 97% of its runs. You run it 10 times. How often does at least one run fail?

  3. 3.In the lab's simulation, what did dropping the temperature from 0.7 to 0 change?

  4. 4.A coding assistant writes 5 versions of a function and your tests keep one that passes. Which number describes what users get?

  5. 5.Your eval's pass rate is 72.2%. A colleague says all 5 of 5 runs will pass 0.722 to the power 5 = 19.6% of the time. Repeated runs measured 57.3%. Why the gap?

  6. 6.An eval runs 100 tasks 5 times each. Why is a 95% confidence interval computed from 500 results as separate cases wrong?

Check your understanding

Try each question before opening its answer.

Why can the same eval give different scores with nothing changed?

The model's answers are random: at a non-zero temperature, and to some degree even at zero, the same task can pass on one run and fail on the next. Those flaky tasks flip between runs. In the lab, the same 100 tasks scored 76% and then 83%, with 11 tasks going from fail to pass and 4 the other way.

A task passes 97% of its runs. Why does it show up as flaky so often?

All 10 of 10 runs pass with chance 0.97 to the power 10, about 74%, so at least one fails about 26% of the time. Like a great free-throw shooter who still misses: mostly reliable doesn't mean always.

What did temperature change in the lab's simulation, and what didn't it?

At temperature 0, 9 of 100 tasks were flaky against 35 at 0.7, and a one-run score wobbled about half as much (1.2 against 2.3 points). The true pass rate barely moved (78.4% against 77.5%), because the simulation is built that way: more consistent, not more correct. Test at the temperature you ship with.

What are pass@k and pass^k, and when do you report each?

pass@k is the chance at least one of k runs passes; report it when something keeps the best of k answers, like tests picking one of five code versions. pass^k is the chance all k pass; report it when users need it to work every time, like an agent or a support flow. From 200 tasks × 10 runs: pass@10 89.0%, pass^10 51.5%.

Why is one run's pass rate to the power k the wrong estimate of pass^k?

It assumes every task has the same chance of passing. Real tasks mostly pass almost always or almost never, so the easy ones keep passing over k runs and the failures stay on the few hard ones. With a 72.2% pass rate, the shortcut says all 5 runs pass 19.6% of the time; for the lab's tasks it's 57.3%. For a mix of tasks the shortcut is never too high, and can be far too low.

Why aren't 100 tasks × 5 runs worth 500 test cases, and how do you build an honest interval?

A task's runs share its difficulty, so they mostly agree; the main uncertainty is which 100 tasks you picked. Treating the 500 results as separate cases gave an interval 7.5 points wide that caught the truth 72.5% of the time. Build it from the 100 per-task pass rates, or with a bootstrap that resamples whole tasks: about 14.5 points wide, catching the truth about 92.5% of the time.

A new prompt scores 3 points higher than the old one on a single run each. What do you do before believing it?

For the lab's tasks, a 3-point gap between two unchanged runs happens 44.2% of the time, so it's well within noise. Rerun both a few times on the same tasks, compare them task by task (a paired comparison: which tasks flipped, and in which direction), and put an interval on the difference that resamples tasks, not runs.

You have a fixed budget. When should you add runs per task rather than new tasks?

For a precise average, new tasks win when they're cheap: 500 × 1 had an SD of 1.77 points against 3.63 for 100 × 5. When a new task costs far more than a run (in the lab, $1 against $0.006), a few repeats become the cheaper precision: about 10 runs per task. And you need repeats anyway to measure pass^k or find flaky tasks.

Next up: Chapter 6, designing an eval from its goal, and auditing one before you trust its score: the earlier chapters' questions (how many cases, which strata, when you've found the failures, how many runs) put together.

Learning something useful?

New labs, articles, and videos on evaluating and testing AI systems come out regularly. Follow along so you don't miss the next one.