pass@k Calculator
Inputs
| Per-sample success rate | 40 % |
|---|---|
| Number of samples | 10 |
pass@k Calculator
Compute pass@k for code and reasoning evaluations: the chance that at least one of k independent model samples solves a problem, from the per-sample success rate.
Inputs
Sampling
Results
Enter a value to see results.
Details
pass@k
pass@k is the standard way to score language models on tasks where a candidate answer can be automatically checked — most famously code generation, where each attempt either passes a test suite or does not. Instead of asking whether a single answer is right, pass@k asks whether any of k attempts is right. This calculator turns a model's per-sample success rate into pass@k, so a single measured accuracy can be projected to any number of attempts.
What pass@k measures
For each problem in a benchmark, the model generates k independent candidate solutions, and the problem counts as solved if at least one candidate passes. pass@k is the fraction of problems solved under that rule. pass@1 is ordinary single-shot accuracy; pass@10 and pass@100 measure how often the model can reach a correct answer given several tries. The metric matters whenever an external verifier — a test suite, a compiler, a proof checker — can recognize a correct answer among many candidates, because then extra attempts translate directly into more solved problems.
The formula
If each sample succeeds independently with probability , then a single sample fails with probability one minus , and all samples fail with probability . pass@k is the complement:
Pkqk=1−(1−p)k=(1−p)kwhere is pass@k and is the probability that every attempt fails. The all-fail probability shrinks geometrically with , which is why even a modest per-sample rate climbs toward certainty with enough attempts.
Worked example
Suppose a model solves a coding problem on 40% of single attempts, and the evaluation allows 10 samples:
q10P10=(1−0.4)10=0.610≈0.0060=1−0.0060≈0.994=99.4%A per-sample rate of 40% becomes a pass@10 of about 99%. The leap illustrates why pass@k figures rise so quickly with k, and why benchmark tables report several values of k side by side — the shape of that curve says more about a model than any single point.
How it is measured
Estimating pass@k by drawing exactly k samples is noisy. Benchmarks such as HumanEval instead draw a larger pool of samples, count the that succeed, and use the unbiased estimator , averaging over every way to choose of the samples. The independence form used here matches that estimator when is taken as , and is the right tool for projecting a known success rate to a chosen attempt budget. The form assumes equal, independent success across samples; at very low temperature samples become nearly identical and adding more helps little. To plan how many problems an evaluation needs for a stable estimate, see the LLM Eval Sample Size Calculator.
Frequently Asked Questions (FAQ)
What is pass@k?
pass@k is the standard metric for code-generation and other sample-and-check evaluations. For each problem the model generates k candidate solutions, and the problem is counted as solved if at least one candidate passes the tests. pass@k is the fraction of problems solved under that rule.
pass@1 reflects single-shot accuracy, while pass@10 or pass@100 measures how often the model can solve a problem given several tries — relevant when an external checker, such as a test suite or a verifier, can pick out a correct answer from many.
Does the formula assume the samples are independent?
Yes. The expression one minus (one minus p) to the power k assumes each of the k samples succeeds independently with the same probability p. That holds well when samples are drawn at a non-zero temperature so they vary.
It breaks down at very low temperature, where samples are nearly identical and drawing more adds little, and when problem difficulty varies so that a single average p hides a mix of easy and hard cases. For projecting a measured rate to a different k, the independence form is a good first approximation.
How is pass@k measured in practice?
Estimating pass@k by literally drawing k samples is noisy. Benchmarks such as HumanEval instead draw a larger number n of samples, count the c that succeed, and use the unbiased estimator pass@k = 1 − C(n−c, k) / C(n, k), where C is the binomial coefficient. This averages over all ways to choose k of the n samples and gives a far more stable figure.
This calculator uses the simpler independence form, which matches the estimator when p is taken as c/n and is ideal for projecting a known success rate to a chosen budget of attempts.
Disclaimer
The independence form assumes equal, independent per-sample success probability. Real samples are correlated at low temperature and difficulty varies across problems, so measured pass@k can differ. Use a large sample pool and the unbiased estimator when reporting benchmark results.