Getting an answer right at least once and getting it right every time are different requirements. Distinguish evaluation of multiple code candidates from the reliability of financial or robotic operations.
#1. Three success rates
Assume independent attempts on a task have success probability p. Pass@1 refers to one attempt; Pass@k denotes the event that at least one of k attempts succeeds; Pass^k denotes the event that every attempt succeeds.
For a hypothetical identical task with p=0.8, five attempts give a 99.968% chance of at least one success and a 32.768% chance of all successes.
| k | At least one success | All successes |
|---|---|---|
| 1 | 80% | 80% |
| 2 | 96% | 64% |
| 3 | 99.2% | 51.2% |
| 5 | 99.968% | 32.768% |
These numbers assume identical p, independence and fixed conditions. With a mixture of easy and difficult tasks, substituting the overall mean p into the formula does not generally recover the observed repeated success rate.
Reset two booking tasks and run each three times. Suppose the first yields success, success, failure and the second yields failure, failure, success. Both tasks succeeded at least once and neither succeeded every time. Averaging the observed task indicators gives 100% for pass@3 and 0% for pass^3. Three of six individual runs succeeded. This is a summary of six observations and requires no independence assumption. The figure you lead with should reflect whether a customer gets one attempt per booking. Stanford CS329Z lecture on evaluation infrastructure Β· Tool-use lecture at 1:17:50
#2. The HumanEval combinatorial estimator
The HumanEval paper uses a Pass@k estimator: given n sampled candidates with c correct, estimate the probability that a random selection of k includes at least one correct candidate.
With n=10, c=3 and k=2, there are 45 possible pairs, and 21 contain only failures. The result is 24/45=53.33%. Compute each taskβs value before taking the mean.
This is separate from whether a deployed system can identify the correct candidate. If hidden tests are unavailable during deployment, Pass@k does not measure selection ability. An all-pass sample estimator for the same candidate set is a ratio of combinations.
In the example, all-pass is 3/45=6.67%.
#3. Confidence intervals: uncertainty around 80
Suppose 80 of 100 independent Bernoulli tasks succeed. The estimate is 0.8. The Wilson interval is more stable near boundaries than the simple normal approximation. For z=1.96 it gives an approximate 95% interval.
For n=100 the interval is about 71.1β86.7%; for n=1000 with 800 successes it is about 77.4β82.4%. The score is unchanged but uncertainty differs. Brown, Cai & DasGupta (2001) compare confidence intervals for binomial proportions.
If the entire finite test is scored, this interval is not measurement error on that fixed test; it concerns generalization to a larger target population under assumptions. Multiple problems from the same repository may not be independent. Consider a clustered bootstrap at the task or repository level.
#4. Compare models using paired tasks
Give the same 100 tasks to two models. If both succeed on 65, only A on 15, only B on 10, and neither on 10, A scores 80%, B scores 75% and the gap is five percentage points. The key information is the 25 discordant tasks.
McNemarβs test uses discordant pairs for paired binary outcomes. In this example, an exact two-sided binomial test under the null of equal directions gives a p-value of about 0.424. A five-point gap alone cannot establish superiority. Report effect sizes and intervals too.
Do not apply a paired test to unmatched tasks. For repeated trials, aggregate at the task level while preserving dependence within each task.
#5. Practice code and run records
Reproduce the calculation for candidate success and repeated reliability. This pedagogical example does not call a model.
from math import comb, sqrt
def pass_at_k(n, c, k):
if not (0 <= c <= n and 1 <= k <= n):
raise ValueError("invalid counts")
return 1 - comb(n-c, k)/comb(n, k) if n-c >= k else 1.0
def wilson(c, n, z=1.96):
if not (n > 0 and 0 <= c <= n):
raise ValueError("invalid counts")
p = c/n
d = 1 + z*z/n
mid = (p+z*z/(2*n))/d
half = z*sqrt(p*(1-p)/n+z*z/(4*n*n))/d
return mid-half, mid+half
print(pass_at_k(10, 3, 2), wilson(80, 100))
For real evaluations, log attempt number, task ID, model version, harness, timeout, termination reason and cost. Dropping failed attempts may inflate the score. If infrastructure errors are retried, fix the rule in advance and report the original error count.