Pass@k.
Draw n samples, count c correct, and compute 1 − C(n − c, k)/C(n, k) — not 1 − (1 − c/n)^k.
For code, a solution can be checked by running tests, so it is natural to ask whether a model solves a problem in k attempts: pass@k. Chen and colleagues (2021), introducing HumanEval, noted that estimating it from exactly k samples is noisy, and that the obvious alternative — sample n, estimate the success rate p̂ = c/n, report 1 − (1 − p̂)^k — is biased: 1 − (1 − p)^k is a concave function of p, so by Jensen’s inequality plugging in the noisy estimate p̂ gives, on average, less than the true pass@k. The unbiased estimator is the probability that k samples drawn without replacement from the n include at least one correct: 1 − C(n − c, k)/C(n, k).
The workshop applies both to real samples: the fine-tuned model of plate XVII.1 answers each of the 30 held-out sums 16 times at temperature 1; c is the count correct for each. It compares the estimators for each k and shows how far they differ.
Below: left, pass@k on the held-out sums by the unbiased estimator and by the plug-in formula, against k. Right, the number of correct samples out of 16 for each question.
- Define pass@k.
- Write the unbiased estimator.
- Show the bias of the plug-in formula.
- Choose n relative to k.
Unbiased, from every sample
From 16 samples per question, pass@1 is 49.6% by either estimator — at k = 1 they coincide. At k = 8 the unbiased estimate is 69.3% and the plug-in 68.1%; at k = 16, 73.3% against 70.7%. The plug-in formula under-states pass@k here because for a question solved in, say, 1 of 16 samples it assigns a chance of finding a solution in 16 tries of only 1 − (15/16)¹⁶ ≈ 64%, while the samples drawn show one was found. 8 questions were never solved in 16 tries and 4 always were.
The practical rules from Chen and colleagues still apply: draw n well above k (they used n = 200 for k up to 100), compute the unbiased estimator in a numerically stable form, and report which k. pass@1 measures the typical answer, large k measures reach — the distinction that matters for RL-trained models (plate XIX.9) and for any system that can try several times and check (plate XIX.10).
Terms
- pass@k
- The probability that at least one of k samples is correct.
- Unbiased estimator
- An estimator whose expectation equals the true value.
- Plug-in estimate
- Substituting an estimated parameter into a formula.
- n
- The number of samples drawn per problem, at least k.
Sources
- Chen et al., “Evaluating Large Language Models Trained on Code”, arXiv:2107.03374, 2021, section 2.1 and appendix A.
- Kulal et al., “SPoC: Search-based Pseudocode to Code”, NeurIPS 2019 (pass@k).