Search, Reflection, and Test-Time Compute › Sampling: Coverage Before You Can Select

Michael BrenndoerferNovember 29, 20264 min read
Language AI HandbookAll chapters
Part 40 of 67Reasoning Post-Training and Verifiable Rewards
Chapter 304Search, Reflection, and Test-Time Compute › Sampling: Coverage Before You Can Select
Reading section 5 of 14 · Sampling: Coverage Before You Can Select · 4 minSection 5 of 14 · 4 min

Section 5 of 14 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Coverage is the fraction of problems for which the pool contains a correct candidate. It bounds the accuracy of any selector that returns a member of that pool. Measure it alongside selected accuracy to find out how much room remains for better selection.

Independent sampling and pass@k

Suppose a single sample from the model is correct with probability pp, independently across draws. The probability that at least one of NN samples is correct is

pass@N=1−(1−p)N.\text{pass@}N = 1 - (1-p)^N.

This is the quantity reported in code-generation benchmarks, where it is estimated with the unbiased estimator from Chen et al. (2021): given nn samples of which cc are correct,

pass@k^=1−(n−ck)(nk).\widehat{\text{pass@}k} = 1 - \frac{\binom{n-c}{k}}{\binom{n}{k}}.

For 1≤k≤n1\le k\le n, the ratio is the fraction of size-kk subsets made up entirely of incorrect samples. Use zero in the numerator when n−c<kn-c<k. Under independent, identically distributed draws, each subset has the same success probability, which makes the estimator unbiased. The plug-in estimate 1−(1−p^)k1-(1-\hat p)^k, with p^=c/n\hat p=c/n, instead has downward bias for k>1k>1 and a nondegenerate p^\hat p. Coverage is concave as a function of pp, so averaging over estimates of pp gives a lower value than evaluating it at the true pp.

When 0<p<10<p<1, coverage approaches 1 as NN grows. The smallest budgets that reach at least 0.999 are 10 draws at p=0.5p=0.5 and 3 at p=0.9p=0.9. The gain from each additional draw falls as the pool gets larger. Its size depends on both pp and the existing budget.

These assumptions are conditional on a prompt and a fixed sampling policy. Across a suite, average 1−(1−pi)N1-(1-p_i)^N over prompts. In general the result differs from evaluating the formula at the average pip_i. Revisions that condition on earlier answers can change the proposal distribution, so this formula need not apply. Brown et al. found that an exponentiated power law in sample count fit many of their empirical coverage curves. Some curves, including one on MiniF2F-MATH, showed a poorer fit.

A fixed decoder with p=0p=0 never samples a correct answer. When pp is positive but small, you may still see no correct candidate within your budget. Similar coverage curves over a short range of NN can come from either case.

Temperature, nucleus sampling, and the diversity dial

Independent draws can repeat an answer. With deterministic greedy decoding, identical prompts produce the same output under fixed model and tie-breaking settings, so repeating that computation does not increase coverage.

For a fixed prompt and model, three common decoding settings change the sampling distribution:

  • Temperature T>0T>0 rescales logits ziz_i before the softmax, giving token weights proportional to exp⁡(zi/T)\exp(z_i/T). Higher temperature flattens the distribution. As TT approaches zero, mass concentrates on the maximum-logit tokens. Deterministic greedy decoding chooses one of them using a tie rule.
  • Top-kk keeps the kk highest-probability tokens and renormalizes their probabilities.
  • Top-pp (nucleus) sampling keeps the shortest probability-sorted prefix whose cumulative mass reaches pp, then renormalizes. A peaked distribution can reach the threshold with fewer tokens. Holtzman et al.

Changing the decoder can increase the variety of sampled answers while sending probability mass to wrong answers. For fixed NN and independent draws on a given prompt, coverage grows when the decoder increases the probability of a correct draw. Sweep the decoder settings on held-out prompts and measure coverage and selected accuracy for each selector at the resource budget you intend to use.

Redundancy

Even independent samples can collide. Sixty-four draws might produce only five distinct final answers. You still paid for sixty-four draws, and the multiplicities are part of the evidence for a plurality vote.

A deterministic scorer can reuse a result whenever its inputs match. If it reads the full derivation, two responses with the same final answer can still require different scores. Check what the grouping preserves before collapsing candidates. Removing exact duplicates preserves whether the pool contains a correct answer, and keeping the counts preserves votes.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy