Lesson 1 of 11 · 3 min read
pass@k and pass^k
In this lesson
TL;DR: Run each task several times. pass@k is the chance at least one of k runs succeeds; it rises with k and describes what you get with retries and a verifier. pass^k is the chance all k runs succeed; it falls with k and describes what users experience when they rely on the agent repeatedly. An agent at 90% per run has pass@5 above 99.99% and pass^5 near 59%. Report the one that matches how the agent is used, estimate it from n runs per task with the unbiased formulas, and remember both assume independent runs.
After this lesson, you should be able to define pass@k and pass^k, compute both from repeated runs, say which one fits a given product, and explain why a single run per task cannot measure reliability.
Before you read
Commit to an answer now. The lesson that follows explains it, and having guessed first, even wrongly, makes the explanation easier to remember.
1An agent books meeting rooms. On an eval it succeeds on 90% of tasks when each task is run once. A team uses it five times a day. Roughly how often will a day go by with no failure?
Two questions, two numbers
1 − (1 − 0.90)^50.90^5pass@k answers "if I try k times, will at least one work?" It is the right metric when something can pick the successful attempt: a test suite choosing among generated patches, a person choosing among drafts. Chen et al. (2021) introduced it for code generation, where tests verify each sample.
pass^k answers "if I run it k times, will every run work?" It is the right metric when each run reaches a user or changes something: a support agent, a booking agent, an operations runbook. Yao et al. (2024) used it in τ-bench to show that agents with respectable single-run success rates were far less consistent across repeated trials of the same task.
Estimating them from runs
Run each task n times (n ≥ k) and count successes c. The unbiased estimators count combinations rather than raising a rate to a power:
from math import comb
def pass_at_k(n, c, k):
return 1.0 if n - c < k else 1 - comb(n - c, k) / comb(n, k)
def pass_hat_k(n, c, k):
return comb(c, k) / comb(n, k)
# one task, run 10 times, 8 successes
print(round(pass_at_k(10, 8, 3), 3), round(pass_hat_k(10, 8, 3), 3)) # => 1.0 0.467
tasks = [(10, 10), (10, 9), (10, 5), (10, 0)] # (runs, successes) for four tasks
k = 3
at = sum(pass_at_k(n, c, k) for n, c in tasks) / len(tasks)
hat = sum(pass_hat_k(n, c, k) for n, c in tasks) / len(tasks)
print(round(at, 3), round(hat, 3)) # => 0.729 0.446
Average per-task values over the task set. Notice the task-level spread: one task always works, one never does, two are in between. A single run per task would score this agent somewhere around 60% and could not tell "every task 60%" from "some tasks always, some never", which call for very different fixes.
Independence, and why real agents violate it
Raising a single success rate to a power assumes each run is an independent coin toss. Real agent failures cluster: a task with an ambiguous instruction or a hard tool fails on most runs, and an easy task succeeds on all of them. That is why the estimators work per task. Across tasks, the clustering means pass^k computed from the average rate is too pessimistic for easy tasks and too optimistic for hard ones; per-task estimation from repeated runs is the honest measurement.
Choosing the metric
| Product | Metric | Why |
|---|---|---|
| Code generation with tests | pass@k | Tests pick the passing patch |
| Drafts a person chooses from | pass@k | The person is the verifier |
| Customer-facing support agent | pass^k | Every run reaches a customer |
| Runbook automation in production | pass^k | Every run changes real systems |
| Research assistant whose output is reviewed | Both | Reliability matters, but review catches some failures |
Say it in 30 seconds
"Because agents vary run to run, I run each task several times. pass@k is the chance at least one of k runs succeeds, the right number when a verifier or a person picks the good one; pass^k is the chance all k succeed, the right number when every run reaches a user. They diverge fast: 90% per run is pass@5 above 99.99% and pass^5 about 59%. I estimate both per task with the unbiased combinatorial formulas, average over tasks, and look at the per-task spread, because failures cluster on hard tasks rather than being independent."
Check yourself
Answer aloud or on paper before revealing. Producing the explanation unaided is exactly what a panel listens for.
1Why is pass@k the wrong headline metric for a customer-facing support agent?
2Why estimate pass^k per task from n runs instead of raising the overall success rate to the power k?
3A task was run 10 times with 8 successes. What is pass^3 for it, using the unbiased estimator?