The useful part, up front

What you’ll take away

  • Pass@k measures whether at least one candidate passes within a stated attempt budget.
  • The finite-pool combination estimator and a known-probability fresh-generation calculation condition on different information.
  • Two systems can reverse their average ranking when k changes, even with unchanged candidate outcomes.
  • Sample counts, valid k values, task weights and test conditions belong beside the score.
  • Measure the chosen answer separately; finding a passing candidate somewhere does not specify a working selector.
01

A successful candidate somewhere in the set is a particular result

A system that produces ten answers and gets one of them through a test has achieved something useful. It has not necessarily produced a correct first answer, or identified which answer a person should use. That distinction is central to pass@k, a measure often used when evaluating generated code. The k describes how many candidates are considered. A task counts as covered when at least one candidate passes the specified tests. Averaging over tasks then gives a score for that candidate budget. [1]

We will work through an invented pool of ten candidates, exactly two of which pass. We will count every possible group of three, compare that result with choosing one candidate, and construct two fictional systems whose ranking reverses when k changes. The examples contain only candidate labels and declared pass/fail outcomes; no model generated code and no candidate program was executed. This makes the arithmetic inspectable without presenting the result as a real model benchmark. It also keeps three questions separate: whether a passing answer exists in a set, whether a selection process finds it, and whether the tests establish the behavior a user actually needs. A score can answer the first question while leaving the other two unresolved.

Define the pool before calculating coverage. Original fixed record. These quantities describe different objects; none specifies a deployed selection algorithm.
Original fixed record. These quantities describe different objects; none specifies a deployed selection algorithm. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
02

Name the candidate pool and the event being counted

Label the ten recorded candidates A through J. In this invented record, A and B pass the test, while C through J fail. The number of candidates is n=10 and the number that pass is c=2. If you pick one of the ten labels uniformly at random, the chance of picking a passing candidate is two out of ten, or 20 percent. That is the pool's single-choice result. It says nothing about whether A was generated first or whether a ranking method would place it at the top.

For the next question, choose three different candidate indices uniformly from this fixed pool. We care only about whether their group contains A or B. Order does not change that event: the group A,C,D contains a passing candidate whether A is listed first or last. This is sampling without replacement, because an index cannot be selected twice in the same group. The hypergeometric distribution describes the number of successes in this kind of finite-population draw. [3] Candidate indices are the sampling units. Two separately recorded candidates could contain identical text; that does not turn their indices into one observation. If you deduplicate the pool, you have defined a different pool and must count its passing and failing members again.

03

Count the groups with no passing candidate first

There are 120 different groups of three indices from ten. One way to calculate this is 10×9×8 divided by 3×2×1. The division removes the six different orderings of each group, since we are counting groups rather than lists. Eight indices fail. They form 56 all-failing groups of three: 8×7×6 divided by 3×2×1. Subtracting those 56 groups from all 120 leaves 64 groups with at least one pass. The resulting fraction is 64/120, or 8/15, approximately 53.33 percent.

We can check the answer by counting successes more closely. Exactly one pass can be chosen in two ways, A or B, and the remaining two failures can be chosen in 28 ways. That gives 56 groups with exactly one pass. Exactly two passes require A and B together, plus one of eight failures, giving eight more groups. The three counts are therefore 56 groups with no pass, 56 with one, and eight with two. They sum to 120. This calculation explains the estimator's subtraction: count the groups that cannot succeed, then remove their share from one. The paper and reference implementation use the same combination ratio, with a stable product form for numerical calculation. [1][4]

Count all 120 groups of three. Original exact enumeration of three distinct indices from ten, where only two indices pass.
Original exact enumeration of three distinct indices from ten, where only two indices pass. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
04

A fresh generation experiment has another probability statement

Suppose a separate, hypothetical generation process has a known 20 percent chance of passing on each attempt. Suppose also that attempts are independent and use the same conditions. The chance that all three fresh attempts fail is 0.8×0.8×0.8=0.512. The chance that at least one passes is therefore 1−0.512=0.488, or 48.8 percent. That differs from the 53.33 percent we calculated for three indices from our particular ten-item pool. The two calculations condition on different information: one fixes the pool and its two passes, while the other generates three fresh outcomes from an assumed process.

The connection is a statistical average. Imagine repeatedly drawing ten independent candidates from that process. Different pools will contain different numbers of passes. For each pool, calculate the combination-based result. Averaging that result over the possible pools gives the true three-attempt success probability, 48.8 percent in this assumed process. This is the unbiased-estimator property proved in the paper under its binomial sampling model. [1] It does not say every individual pool produces exactly the true probability. Our one pool happens to produce 53.33 percent. That is compatible with an estimator being unbiased across repeated pools; the property describes its average behavior, not certainty about a single observed record.

05

An observed single-pass fraction is not a known process probability

Our ten-item pool has a passing fraction of 0.2. It is tempting to insert that number into 1−(1−p)^3 and report 48.8 percent as the estimate. But an observed fraction is not the same thing as a known probability for the generation process. The arithmetic produces the chance of finding at least one passing index when drawing three times from this fixed pool with replacement. In that experiment, the same index may be selected again. The earlier 53.33 percent result chose three different indices without replacement. Each formula fits its own experiment.

When the goal is estimating the fresh-generation probability from independent sampled candidates, the paper explains that this plug-in method is biased downward in expectation, while the combination estimator is unbiased under the stated sampling model. [1] This does not mean you should alter an observed count until a score looks better. Keep the original n and c, apply the declared estimator consistently, and state what it estimates. A number taken from data carries sampling uncertainty even if its decimal representation is neat. For this example, 20 percent is exact as a description of the recorded ten-item pool; interpreting it as the true probability of a future attempt adds a statistical claim that the count alone cannot settle.

06

Changing k can reverse the average ranking

Consider two fictional systems, A and B, evaluated on the same two tasks. Each system has ten candidates per task. System A gets five passes on the first task and none on the second. System B gets two passes on each. Give the two tasks equal weight. At k=1, A averages (0.5+0)/2=0.25, or 25 percent. B averages (0.2+0.2)/2=0.20, or 20 percent. A therefore has the higher single-candidate score in these stipulated records.

At k=3 the ordering changes. A's first task has only five failing candidates, which form ten all-failing three-item groups out of 120. Its first-task result is 110/120, while its second-task result remains zero. Its two-task average is 11/24, about 45.83 percent. B's two tasks each have the earlier 8/15 result, so its average is approximately 53.33 percent. B now leads. No candidates or pass labels changed; only the candidate budget changed. This is a consequence of averaging a nonlinear coverage measure across tasks. The reference implementation calculates each task's estimate and then takes the mean. [4] A comparison should therefore show k beside the score and retain the task-level counts, rather than turn one ordering into a universal claim that one system is better.

The same records give different leaders at different k. Original fictional systems. Two equally weighted tasks; ten candidates per system per task. Values shown are task means.
Original fictional systems. Two equally weighted tasks; ten candidates per system per task. Values shown are task means. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
07

A score of one can come from exhausting the failing members

Return to the ten-item pool with two passes. If you select nine different indices, you must include a passing one: only eight failing indices exist. The fixed-pool pass@9 quantity is therefore one. The same is true at k=10. That does not mean every candidate is correct. Eight of the ten still fail. It means a group that large cannot avoid both passing members. If the pool had no passes, its result would instead remain zero for every valid k.

The valid candidate budget also matters. You cannot select eleven different indices from a pool of ten. The historical HumanEval evaluator reports a requested k only when every included task has at least k recorded samples. [4] The accompanying README explains the insufficient-sample limitation. [2] An omitted score should not be silently filled with zero, and it should not be manufactured by reusing the same indices while keeping the without-replacement description. Reusing indices defines another experiment. The number n says how many evaluated candidates support the calculation; k says how many attempts the metric is considering. Write both numbers down. Their roles remain different even when a particular run happens to use n=k.

08

Finding a passing candidate requires a separate selection method

Suppose someone receives the entire original ten-item pool but no pass/fail labels. Choosing one index uniformly still succeeds only 20 percent of the time. Knowing that a three-item group often contains a pass does not tell them which member to choose. A practical system might rank candidates, run available checks, ask for another attempt, or deliver the first answer. Each procedure has its own result, and none is specified merely by writing pass@3 beside a score.

In the invented record, a perfect selector that can recognize a passing candidate whenever one exists would succeed on all 64 successful three-item groups. A selector without that ability can do worse, even though the candidate groups themselves have not changed. This is a reasoning example, not a claim that a real verifier is perfect. It explains what to measure next: the actual chosen output under the actual selection rule, alongside the candidate-set coverage. If a system uses tests to select an answer, describe which tests it can see and which tests define the reported evaluation. Otherwise, the phrase “the system got it right” may hide whether success means producing one acceptable possibility or reliably delivering it. Those are both useful measurements, but they answer different reader questions.

Similar formulas can describe different experiments. Original ten-index pool versus a separate hypothetical independent process with known p = 0.2.
Original ten-index pool versus a separate hypothetical independent process with known p = 0.2. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
09

Passing the recorded test does not define every useful behavior

In the source paper's coding evaluation, correctness is operationalized through the supplied unit tests. [1] A program that passes those tests has met that particular test condition. The score alone does not establish that it behaves correctly for every possible input, protects every kind of data, or meets a different project's requirements. Our examples simplify the same boundary further by declaring pass/fail labels directly. They prove arithmetic about those labels, not that any real program is correct.

Evaluation conditions can also affect the labels. The historical repository distinguishes passed, timed-out and failed execution results, and its README notes that resource problems can cause otherwise correct programs to fail. [2] Preserve the test definition, time and resource conditions, and failure-handling rules beside the counts. A changed limit can change c without changing the candidate text. This article is an explanation of the metric and its reference records, not instructions to run generated programs. The repository is now marked deprecated and unmaintained, so it is used here as a historical primary source for the estimator rather than a recommendation for a new evaluation installation. [2] The calculation remains understandable while its software provenance and practical execution scope stay explicit.

10

Read the score with its budget, denominator and decision rule

A useful report lets you reconstruct the question before judging the number. For each task, retain how many candidates were evaluated and how many passed. State the requested k values, the estimator, the task set and its weights. Describe how candidates were generated, what counted as passing, and whether the reported result concerns any successful candidate or the one actually selected for use. If costs matter, record them directly. Three candidates do not automatically represent the same time, output length or computing expense across two systems.

The worked record now gives us several compatible results. One uniform choice from the ten-item pool succeeds 20 percent of the time. A uniform three-index subset contains a pass in 64 of 120 cases, approximately 53.33 percent. A separate independent process with known 20 percent success per attempt has 48.8 percent three-attempt success. Finally, the two-task example changes its system ordering when k changes from one to three. None of these numbers needs to replace the others. Each answers a defined question. Keeping that question beside the score makes pass@k useful evidence about a particular evaluation, while leaving first-choice reliability, selection quality and real application behavior to the measurements that assess them.

Make a pass@k claim reconstructable. Proposed reporting sequence. These fields distinguish candidate-set coverage from the chosen-output result.
Proposed reporting sequence. These fields distinguish candidate-set coverage from the chosen-output result. · Ameer Journal — original explanatory diagramOriginal editorial illustration; no third-party artwork reused.
Follow the evidence

Sources & further reading

Explore the references behind this guide. External pages may change after our review.

  1. Evaluating Large Language Models Trained on Code
    Chen et al. / arXiv · Accessed 6 Nov 2026
  2. HumanEval reference repository README
    OpenAI HumanEval · Accessed 6 Nov 2026
  3. scipy.stats.hypergeom — SciPy v1.16.0 Manual
    SciPy · Accessed 6 Nov 2026
  4. HumanEval evaluation.py reference estimator
    OpenAI HumanEval · Accessed 6 Nov 2026

Article updated 6 Nov 2026.

Found something we should revisit?

Good explanations get better with thoughtful feedback.

Suggest a correction