pass@k is the probability that at least one of independent samples from a model solves a task, averaged over tasks. pass@1 is plain per-attempt accuracy; larger measures what a model can reach when it is allowed several tries and something (a test suite or verifier) picks out the correct one.
The unbiased estimator
Computing pass@k by drawing exactly samples is high variance. Instead, draw samples per task, count the correct ones, and use
The fraction is the probability that a random subset of of the samples contains no correct answer, so one minus it is the probability that the subset contains at least one. Averaging this over tasks gives an unbiased estimate of pass@k. The naive alternative, , is biased low because it plugs a noisy estimate into a nonlinear function.
Worked example
A model generates programs for a task and pass the unit tests. pass@1 is . For pass@5, and , so the estimate is . A task the model solves only 30% of the time is solved more than 90% of the time with five tries.
Pitfalls
- pass@k with large assumes a perfect selector. Without one, users see pass@1, not pass@k.
- For reliability questions, the opposite metric matters: the probability that all attempts succeed, sometimes written pass^k. A model with pass@1 of 0.9 succeeds on all of 5 tries only of the time on a typical task.
- Always report , , the sampling temperature and a confidence interval. Tasks, not samples, are the unit of independence.
Why it matters
pass@k connects evaluation to how models are used and trained. Best-of-n sampling and RL with verifiable rewards both exploit the gap between pass@1 and pass@k, and a widening or narrowing gap is a useful diagnostic of what training changed. For safety, the same arithmetic describes an attacker who retries a jailbreak: a small per-attempt success rate becomes a large one over many attempts.
Related terms
- Verifier
- Best-of-n sampling
- RLVR (reinforcement learning with verifiable rewards)
- LLM benchmark
- Attack success rate (ASR)
Sources
- Mark Chen et al.. Evaluating Large Language Models Trained on Code, 2021. arxiv.org