Search, Reflection, and Test-Time Compute

Michael BrenndoerferNovember 29, 202636 min read

Learn how sampling, verifiers, and adaptive stopping convert inference compute into accuracy, and why selection limits what more draws can deliver.

Language AI HandbookAll chapters
Part 40 of 67Reasoning Post-Training and Verifiable Rewards
Chapter 304Search, Reflection, and Test-Time Compute
Reading the full chapter · 14 sections · 36 min14 sections · 36 min

All 14 sections · 36 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Search, Reflection, and Test-Time Compute

In the simulation below, drawing 32 answers instead of one raises the fraction of problems with a correct candidate from 47.0% to 99.5%. At 32 draws the random verifier still returns a correct answer on less than half the problems in this run. The additional samples make the right answer available. Selection determines whether the system returns it.

You can change a system's behavior at serving time with the model weights fixed. Generate several complete answers, score them with a verifier or vote, or feed an answer back as the starting point for revision. Each choice spends computation differently. The simulation compares adaptive stopping with two baselines. One assigns budgets without looking at individual answers and uses the same total number of draws. The other gives every problem the adaptive policy's maximum number of draws.

Test-time compute

Test-time compute is work performed after receiving a prompt to produce a response. It can include generated tokens, verifier passes, search expansions, or tool execution. A study's budget measures some of this work. Read the cost unit alongside any accuracy comparison.

From Training Compute to Inference Compute

Training scaling laws relate loss to quantities such as model size and training data. On a deployed model, the question changes. What can you do with a fixed set of weights and a larger budget for answering a prompt?

Suppose the decoder draws independently from the same distribution on a given problem and gets the answer right with probability pp on each draw. The chance that all NN draws fail is (1−p)N(1-p)^N, so at least one succeeds with probability 1−(1−p)N1-(1-p)^N. This is coverage. Program synthesis systems have used learned search and, in systems such as AlphaCode, large-scale sampling (Kulal et al., 2019; Li et al., 2022).

The other question is how to recognize a correct candidate once you have one. A unit test or proof checker can sometimes do that more cheaply than generating a solution. A learned verifier may be useful when no such checker is available. Cobbe et al. (2021), for example, scored complete math solutions against one another using a verifier trained on labeled candidates. The value of the scorer depends on how reliably it ranks the candidates your generator produces.

Sampling, scoring, and stopping give you three decisions to make. You can draw complete answers from scratch or expand partial derivations. A scoring heuristic can guide which paths survive, and a stopping rule decides when to return an answer.

What Counts as Test-Time Compute

Test-time compute choices and their costs.
SettingWork to countWhat a larger budget allows
Number of samples NNGeneration for NN candidatesMore chances to draw a correct answer
Verifier scoringOne score per candidate for pointwise reranking. Calls depend on batching and reuse.A ranking of candidates
Chain-of-thought lengthGenerated tokens per sampleMore steps in a single trajectory
Search branching and depthExpanded nodes and their scoring costsExploration within a derivation
Revision roundsExtra generations and any separate critiqueAnother attempt to repair an answer
Tool and execution callsTool latency and execution workEvidence such as test or compiler output

A method that uses more inference compute might change any of these settings. Check which resource the comparison counts. For example, generated tokens exclude scoring work done by a separate model. A system that calls an external interpreter also incurs work outside the model.

Raising NN gives a selector more candidates. Whether it returns more correct answers depends on the ranking rule and the resulting pool. Longer reasoning can help on some hard tasks and add tokens without improving accuracy on others. A tool call may supply evidence, such as which test failed, that more draws from the original prompt would leave out.

The General Pipeline: Generate, Score, Select, Stop

Start with a prompt xx. The generation policy pθ(y∣x)p_\theta(y\mid x) assigns a complete response yy the probability obtained by multiplying its conditional token probabilities in order, including the end token when it marks completion. A decoder sets temperature and truncation and samples a list S=(y1,…,yN)S=(y_1,\dots,y_N) of complete responses. The list can contain duplicates. The random seed fixes a realization of the decoding procedure. Repeated draws require advancing the random stream or using separate streams.

  1. Generate. Draw candidates from the configured decoder.
  2. Score. Assign each candidate yjy_j a scalar score sjs_j. A scorer can read the candidate and prompt, run tests, or count agreements in the pool.
  3. Select. Return y^=yj∗\hat y=y_{j^*}, where j∗∈arg⁡max⁡1≤j≤Nsjj^*\in\arg\max_{1\le j\le N}s_j is a highest-scoring index chosen by a tie rule.
  4. Stop or continue. Decide whether to return the selected answer, draw more candidates, or try a revision.

For test-time allocation, let B(x,r)B(x,r) be the cost incurred on prompt xx with random draws rr. One objective is to maximize expected accuracy under an expected budget bb per prompt:

max⁡policy  Ex,r[1{y^(x,r) is correct}]subject toEx,r[B(x,r)]≤b.\max_{\text{policy}} \; \mathbb{E}_{x,r}\left[\mathbb{1}\{\hat y(x,r)\text{ is correct}\}\right] \quad \text{subject to} \quad \mathbb{E}_{x,r}[B(x,r)]\le b.

Here xx comes from the target distribution and rr represents the policy's randomness. On a finite benchmark of MM prompts, a realized total budget instead takes the form ∑i=1MB(xi,ri)≤Btotal\sum_{i=1}^M B(x_i,r_i)\le B_{\mathrm{total}}. A separate condition B(x,r)≤Bmax⁡B(x,r)\le B_{\max} can cap any one request.

Best-of-NN draws a fixed pool and returns the candidate that scores highest under a specified rule. The scorer can use a model, a task checker, or aggregated process scores. Self-consistency uses agreement among sampled reasoning paths. Chain-of-thought prompts for an intermediate explanation before the answer. Tree of Thoughts expands and evaluates partial paths. Reflexion feeds feedback from an earlier attempt into a later one.

Anytime algorithm

An anytime implementation can return a valid incumbent when interrupted after it has one. Sampling and reranking can keep an incumbent from the first complete candidate onward. A beam can do the same if it retains a completed candidate or has a valid fallback. If existing candidates keep their scores, adding candidates cannot lower the best score. Selected accuracy can still fall.

Sampling: Coverage Before You Can Select

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.

Verifiers

A verifier scores a candidate or a partial derivation. For a learned verifier, distinguish what the score describes from what the model reads. An outcome-supervised model may read a whole derivation while learning from a final-answer label. Those labels can come from a task checker or human judgments. Voting instead scores candidates from agreement in the pool.

Outcome reward models

An outcome reward model (ORM) predicts whether the final answer is correct. It can predict that outcome from a prefix or a complete answer. Cobbe et al. labeled generated GSM8K solutions according to whether they reached the reference answer. Their default verifier learned to predict that final-outcome label after each solution token. At inference, they ranked complete solutions and returned the highest-scoring candidate.

Cobbe et al. reported that their 6B verification setup slightly outperformed their fine-tuned 175B baseline on the full GSM8K test setting. Both generator and verifier in the 6B setup used the same model size. This comparison used a candidate pool and should not be read as a comparison at the same per-query cost.

Automatic grading can avoid per-candidate human annotation. It still needs a grading rule, such as answer matching or a test suite, and a way to check that the labels reflect the task. A final-number match can approve an invalid derivation. Human judgments can train a scorer when automatic grading is unavailable, with additional collection costs.

Process reward models

A process reward model (PRM) can score each step sts_t in context: vϕ(x,s1,…,st)v_\phi(x,s_1,\dots,s_t). A reranker can combine those step scores into a score for the trajectory.

If the step scores are in [0,1][0,1], multiplying in an additional step can only keep or lower the product for the same prefix. A minimum makes the result sensitive to one low score, including a spuriously low one. A mean gives each step equal weight, so one low score has less effect in a longer trajectory.

Lightman et al. reported 78.2% for their large-scale process-supervised verifier, 72.4% for their large-scale outcome-supervised verifier, and 69.6% for voting when each selected from 1,860 candidates per problem on their held-out MATH subset. The two trained verifiers used data collected differently.

A PRM can guide beam search or pruning by scoring a partial derivation directly. A scorer that expects a completed answer can guide prefix search by scoring rollout completions and aggregating their results. Other search systems use prompted value estimates or feedback from the environment.

Rollout labels can replace human step annotations with additional computation. The fraction of successful completions estimates how often the rollout policy can finish from that prefix under the chosen checker. That quantity depends on the policy. A stronger completer may recover from a prefix that nearly always leads to failure under the original policy.

Implicit verifiers

Several scoring rules work without training a separate verifier on the task:

  • Self-consistency. Return the most frequent answer among sampled reasoning paths. This is a plurality vote. Wang et al.
  • Log-likelihood. Rank an answer by the probability the model assigns it under the stated scoring convention. Raw sequence log-likelihood sums token log probabilities, so both length and the model's familiarity with a continuation can affect the score.
  • LLM-as-judge. Prompt a model to evaluate the candidates. The judge can share errors or preferences with the generator, including when both calls use the same weights.

If a wrong label is uniquely most probable under a fixed answer distribution, plurality over independent draws selects it with probability approaching one. Log-likelihood can prefer a wrong answer when the model assigns it more probability. In Lee et al.'s EMBER benchmark, adding expressions of confidence or uncertainty to answers affected the tested judges' preferences. Compare each scoring rule on the candidate pools it will see.

Uniform selection and the coverage ceiling

Suppose you draw NN independent samples and each is correct with probability pp. Let C∼Binomial(N,p)C \sim \text{Binomial}(N, p) be the number of correct samples. Then:

  • Coverage (an oracle selector) has accuracy Pr⁡[C≥1]=1−(1−p)N\Pr[C \ge 1] = 1 - (1-p)^N. This is the ceiling.
  • A random selector, which picks uniformly among the NN samples, has accuracy E[C/N]=p\mathbb{E}[C / N] = p. Extra draws give this selector no gain in expected returned-answer accuracy.

The oracle gives an upper bound. Random selection is a reference point. A verifier that systematically favors the wrong answers can fall below that reference.

The expected fraction of correct candidates is pp, since each candidate has marginal correctness probability pp. Uniform selection gives the same expected accuracy as one draw while generating NN candidates. Actual compute depends on candidate lengths, shared work, and scoring.

Brown et al. found that coverage kept increasing on math word problems after majority voting and reward-model selection began to plateau. In their code and formal-proof evaluations, available automatic checkers let coverage gains translate into higher measured success rates.

A verifier can also fare worse as the candidate pool grows. If very high scores often go to a wrong answer, a larger pool gives that answer more chances to win. A feature such as confident phrasing can raise scores for incorrect candidates and still have little effect if correct answers consistently score higher. Measure end-to-end accuracy and resource use across budgets, with plurality voting as a comparator. Pairwise discrimination is a separate diagnostic.

The next cell simulates 400 problems with true labels from 1 through 9. Label 0 is always wrong. The verifier gives it a score bonus of 1.8, compared with a bonus of 1.0 for correct candidates. Argmax uses the earliest candidate if scores tie. The figure shows the result for this seeded pool.

PythonIn [3]
CollapseExpand
import numpy as np

bias_rng = np.random.default_rng(20240118)
bias_n_problems = 400
bias_n_choices = 10
bias_n_max = 32

bias_p = bias_rng.uniform(0.05, 0.85, size=bias_n_problems)
bias_truth = bias_rng.integers(1, bias_n_choices, size=bias_n_problems)
bias_answers = np.empty((bias_n_problems, bias_n_max), dtype=int)
bias_correct = np.empty((bias_n_problems, bias_n_max), dtype=bool)

for i in range(bias_n_problems):
    p = bias_p[i]
    hit = bias_rng.random(bias_n_max) < p
    wrong = (
        bias_truth[i] + bias_rng.integers(1, bias_n_choices, size=bias_n_max)
    ) % bias_n_choices
    bias_answers[i] = np.where(hit, bias_truth[i], wrong)
    bias_correct[i] = bias_answers[i] == bias_truth[i]

bias_scores = bias_rng.normal(
    loc=1.0 * bias_correct + 1.8 * (bias_answers == 0),
    scale=1.0,
)

bias_sample_counts = np.array([1, 2, 4, 8, 16, 32])
bias_selected = []
bias_coverage = []

for n in bias_sample_counts:
    block_answers = bias_answers[:, :n]
    block_scores = bias_scores[:, :n]
    idx = np.argmax(block_scores, axis=1)
    picked = np.take_along_axis(block_answers, idx[:, None], axis=1).ravel()
    bias_selected.append((picked == bias_truth).mean())
    bias_coverage.append(bias_correct[:, :n].any(axis=1).mean())

bias_selected = np.array(bias_selected)
bias_coverage = np.array(bias_coverage)
VisualizationOut [4]
CollapseExpand
Coverage rises with sample count. The biased verifier reaches its highest plotted accuracy at four draws, then ends lower at 32 draws.
Coverage rises from 0.460 to 0.9925 across the plotted budgets. Selected accuracy reaches 0.635 at four draws, fluctuates at the next two budgets, and ends at 0.600 at 32 draws. The verifier gives an extra score bonus to an always-wrong answer label.

What plurality voting requires

With independent, identically distributed binary votes that are each right with probability p>1/2p>1/2, the chance that the majority is right approaches one. The threshold changes when wrong votes are split across labels.

Suppose there are K≥2K\ge2 possible answers, with probability pp on the correct label and the remaining mass divided equally across the other K−1K-1. The correct answer is uniquely most probable when

p>1−pK−1⟺p>1K.p > \frac{1-p}{K-1} \quad \Longleftrightarrow \quad p > \frac{1}{K}.

With ten choices and uniform distractors, the threshold is p>0.1p>0.1. Under independent draws from a fixed distribution over the KK labels, observed vote proportions converge to their label probabilities. If one answer is uniquely most probable, it wins with probability approaching one. To check whether the true answer is that mode, compare pp with the largest individual distractor probability. At a finite budget, the full distribution and tie rule govern accuracy.

Reflection and Self-Correction

Some methods draw new answers and choose among them. Others revise an existing answer. When comparing revision studies, inspect what feedback the second attempt receives.

Search and feedback

Exploratory search draws new candidates and picks among them.

Externally informed correction revises an answer with evidence supplied by a separate source, such as a failing test, a compiler diagnostic, a retrieved document, or a person. The feedback may depend on the original answer or the tool call.

Unaided reflection prompts the same model to critique or revise an earlier answer without outside evidence. The original answer and the revision instruction are part of the new context.

What unaided reflection can and cannot do

Unaided reflection changes the prompt even when the model weights stay fixed. If the initial accuracy is pp, the net change in accuracy is (1−p)q01−pq10(1-p)q_{01}-pq_{10}, where q01q_{01} is the fraction of initially wrong answers repaired and q10q_{10} is the fraction of initially correct answers spoiled. Measure both transitions on labeled problems.

Overall accuracy improves when repairs outnumber spoiled correct answers. The balance depends on the initial accuracy as well as the two transition rates. With 90% initial accuracy, repairing half of the errors gains five percentage points. Spoiling one tenth of the correct answers loses nine.

Huang et al. found that intrinsic self-correction did not reliably improve their reasoning benchmarks and sometimes lowered accuracy under the prompts they tested. That result concerns the study’s models and evaluation conditions.

Use labeled answers to measure how well a critic's score ranks correct and incorrect attempts, for example with ROC AUC. A value near 0.5 indicates chance-level aggregate ranking in the chosen score direction. The ranking statistic alone does not give the repair or spoil rate at a revision threshold. Compare the full policy with the original answer and, if you have an extra generation budget, a fresh second draw.

What externally informed correction can do

A failing test or a retrieved reference can give the reviser information it did not use on the first attempt. Madaan et al. used self-generated feedback in Self-Refine and reported a separate correctness-oracle experiment for math in Appendix H.1. Measure whether the feedback is actually informative for the target task.

A revision prompt and another generation can change the output even without external feedback. A tool can also supply evidence that directs the revision. A failing compiler check may locate a line to inspect, while a failing test often only shows one input on which the behavior differs from the expectation. Measure whether acting on that feedback improves the final answers.

Search over thoughts

Tree of Thoughts (Yao et al., 2023) expands partial reasoning states, evaluates them, and uses breadth-first or depth-first search with pruning. Language Agent Tree Search (Zhou et al., 2023) uses Monte Carlo tree search and can use feedback from the environment.

A full unpruned tree of depth dd has 1+b+⋯+bd1+b+\dots+b^d nodes for branching factor bb, which is Θ(bd)\Theta(b^d) for fixed b>1b>1. Actual work depends on which nodes you expand and what each generation and scoring step costs. In Game of 24, you can check an intermediate move by confirming that it uses two available numbers and recalculating its result. When partial states give little guidance, compare tree search with complete-answer sampling under the same compute accounting.

Budget Allocation and Stopping

So far we have treated NN as a single global number. In practice the interesting question is how to distribute a total budget across a heterogeneous set of problems.

The value of another draw varies across problems. A uniform budget spends the same number of draws on problems with different success probabilities.

When changing the allocation helps

Consider coverage. The marginal value of one more sample on a problem with per-sample success probability pp is

ΔN(p)=[1−(1−p)N+1]−[1−(1−p)N]=p(1−p)N.\Delta_N(p) = [1-(1-p)^{N+1}] - [1-(1-p)^N] = p(1-p)^N.

For any fixed N≥1N\ge1, the gain is zero at p=0p=0 and p=1p=1 and peaks at p=1/(N+1)p=1/(N+1). These are gains in coverage with independent draws. A verifier-guided policy's gain in selected accuracy also depends on the scorer and may be negative.

The plot shows the next-draw coverage gain for several current sample budgets.

PythonIn [5]
CollapseExpand
import numpy as np

p_grid = np.linspace(0.01, 0.99, 240)
n_values = np.array([2, 5, 10, 20])
marginal_by_n = {int(n): p_grid * (1.0 - p_grid) ** n for n in n_values}
VisualizationOut [6]
CollapseExpand
Line chart of marginal coverage gain versus per-problem success probability.
Each curve shows the additional coverage from one independent draw after N draws. The peak is at p = 1/(N + 1) and moves toward lower per-draw success probabilities as N increases.

At a fixed budget, a very high pp leaves little uncovered. A very low pp leaves most problems uncovered but gives any one additional draw little chance to help. The peak balances the chance of having missed so far with the chance of succeeding on the next draw.

Fixed counts and adaptive stopping

A fixed-count baseline assigns the same NN to every problem. Giving it the adaptive policy's maximum NN lets us compare policies at a common per-problem cap.

An adaptive policy allocates per problem based on a signal available during generation:

  • Agreement. Draw an initial batch and spend more of the budget if answers disagree. A repeated wrong answer can trigger an early stop.
  • Verifier confidence. Stop when a candidate's score passes a threshold. Check calibration on the pools and budget range where you will apply the rule.
  • Difficulty prediction. Use a heuristic, a prompted estimate, or a trained predictor. Manvi et al. fine-tuned a model to estimate whether restarting would produce a better answer than continuing an attempt.
  • Vote margin. Stop when the leading answer clears a chosen margin. A formal sequential error guarantee requires explicit hypotheses, a likelihood ratio or other test statistic, and calibrated stopping boundaries.

The matched-cost trap

For a retrospective mean-budget comparison, match the total number of draws used across the benchmark. If the mean falls between integers, assign the two adjacent budgets in the required proportions and choose which tasks get the larger budget by a shuffle. A cap-matched policy instead gives every problem the largest number of draws allowed by the adaptive policy. The mean and cap answer different questions about work. For serving latency, measure the wall-clock distribution as well. A draw cap limits how many samples you generate, while the time taken also depends on output lengths, parallelism, and scoring. If you need comparable total computation, count those costs under the same convention for all policies.

Stopping on four unanimous answers can accept a wrong consensus. The probability of this event is a lower bound on the policy’s error rate.

With nine equally likely wrong labels and independent draws, the probability of an incorrect early stop is the chance that all four initial draws give the same wrong answer. That probability is 9((1−p)/9)4=(1−p)4/7299((1-p)/9)^4=(1-p)^4/729. One minus this probability is an upper bound on the accuracy of a policy that accepts unanimous answers immediately.

Compute-optimal reasoning

The strongest version of the test-time-compute claim is that it can substitute for model scale. Snell et al. (2024) studied this carefully, using a PaLM-2-class generator, a process reward model, and a FLOPs-matched comparison against larger pretrained models.

Their findings, stated with their bounds:

  • With a generation budget of 128 and verifier-based selection, the easier difficulty bins favored fully sequential revisions. The harder bins favored a mix of sequential revisions and parallel samples. Snell et al., Figure 7, right
  • In their revision experiments, choosing a sequential-to-parallel ratio by difficulty improved on the studied parallel best-of-NN baseline. The paper compares both oracle and estimated difficulty bins. Snell et al., Figure 8
  • In a separate FLOPs-matched analysis, Snell et al. compared additional inference on PaLM 2-S* with greedy decoding from a model roughly 14 times larger, holding the quantity of training data fixed. The result depended on the difficulty bin and the expected share of inference compute. Snell et al., Section 7

Wu et al. (2024) also studied when a smaller model with additional inference work can match a larger one. The comparison depends on the task, search method, scorer, and accounting convention. To choose NN, measure the selected accuracy curve and cost with the scorer you plan to use.

Chen et al. studied redundant reasoning on simple problems and evaluated a self-training approach that reduced computational overhead while preserving performance across their benchmark suite. This is a measured result for their setup.

Worked Example

Start with four problems to see how the coverage ceiling and the accuracy of two selection rules differ before we compare them on a larger simulated suite.

Take four problems with per-draw success probabilities p=0.9, 0.6, 0.3, 0.1p = 0.9,\, 0.6,\, 0.3,\, 0.1. For each problem, draw N=5N = 5 times independently from its fixed distribution.

The coverage ceiling, 1−(1−p)51 - (1-p)^5, is:

Coverage ceiling across four problems with five draws each.
Problempppass@5 =1−(1−p)5= 1-(1-p)^5
A0.90.99999
B0.60.98976
C0.30.83193
D0.10.40951
Mean0.4750.80780

A single sample averages 0.475, and an oracle selector over five samples averages 0.808. The number of generations goes up by a factor of five. The relative improvement in the coverage ceiling is

0.808−0.4750.475≈0.70,\frac{0.808 - 0.475}{0.475} \approx 0.70,

where:

  • 0.4750.475: the mean per-sample accuracy, the average of pp across the four problems
  • 0.8080.808: the mean coverage ceiling, the average of 1−(1−p)51-(1-p)^5 across the four problems
  • 0.700.70: the relative improvement of the ceiling over the single-sample baseline

Now apply two selection rules to the five-draw pools.

An uninformative verifier. A random ranking gives the same expected accuracy as one draw, which is pp on each problem and 0.475 averaged over the suite.

Plurality voting with ten choices and uniform distractors. Exhaustively weighting the five-draw sequences with uniform tie-breaking gives accuracies of about 0.998, 0.883, 0.455, and 0.100 on A through D. The mean is 0.609, between the single-draw baseline and the oracle ceiling. On D all ten labels are equally likely, so the vote still has 0.100 expected accuracy.

The worked example assigns an equal chance to every tied leader. Label zero represents the truth only for enumeration. When zero ties with other leaders, the contribution is one divided by the number of leaders. The simulation later uses a lowest-label tie rule with randomly assigned true labels.

PythonIn [7]
CollapseExpand
from itertools import product
from math import fsum

example_choices = 10
example_draws = 5
vote_weight_by_correct_count = [0.0] * (example_draws + 1)
for draw in product(range(example_choices), repeat=example_draws):
    counts = [draw.count(label) for label in range(example_choices)]
    correct_count = counts[0]
    maximum = max(counts)
    if correct_count == maximum:
        vote_weight_by_correct_count[correct_count] += 1 / counts.count(maximum)


def exact_example_vote_accuracy(p):
    wrong_label_p = (1 - p) / (example_choices - 1)
    return fsum(
        weight * p**count * wrong_label_p ** (example_draws - count)
        for count, weight in enumerate(vote_weight_by_correct_count)
    )


example_accuracy = [
    exact_example_vote_accuracy(p) for p in (0.9, 0.6, 0.3, 0.1)
]
print(
    "Five-draw plurality accuracy (A to D):",
    ", ".join(f"{a:.3f}" for a in example_accuracy),
)
print(f"Mean: {fsum(example_accuracy) / len(example_accuracy):.3f}")
ConsoleOut [7]
CollapseExpand
Five-draw plurality accuracy (A to D): 0.998, 0.883, 0.455, 0.100
Mean: 0.609

Allocation. Uniform N=5N=5 costs 20 samples. The next-draw coverage gains p(1−p)5p(1-p)^5 are about 0.0000090.000009, 0.0061440.006144, 0.0504210.050421, and 0.0590490.059049 on A through D. If the per-task success probabilities were known and the objective were oracle coverage, a sixth draw would buy the most on D.

Code Implementation

The simulation makes the distribution of candidate answers explicit. It draws 400 problems with varying per-draw correctness probabilities, scores their candidates under several verifier settings, and counts the draws used by an early-stopping policy.

Setup

We need a small task suite. Each problem has a latent per-sample success probability, drawn from a heterogeneous distribution so that difficulty varies across problems, and a true answer drawn from ten possibilities.

PythonIn [8]
CollapseExpand
import matplotlib.pyplot as plt
import numpy as np

rng = np.random.default_rng(20240117)

N_PROBLEMS = 400
N_CHOICES = 10
N_MAX = 32

# Latent difficulty: probability that a single independent sample is correct.
P_MIN, P_MAX = 0.05, 0.85
p_correct = rng.uniform(P_MIN, P_MAX, size=N_PROBLEMS)
true_answer = rng.integers(0, N_CHOICES, size=N_PROBLEMS)

The generator draws an answer for one problem: with probability pp it emits the true answer, otherwise it emits one of the other nine uniformly at random. This is the simplest error model that still exhibits the mode structure we discussed.

PythonIn [9]
CollapseExpand
def draw_samples(problem, n):
    """Draw n i.i.d. answers for one problem."""
    p = p_correct[problem]
    truth = true_answer[problem]
    hit = rng.random(n) < p
    wrong = (truth + rng.integers(1, N_CHOICES, size=n)) % N_CHOICES
    return np.where(hit, truth, wrong), hit

We draw the maximum budget once per problem and reuse its prefixes at smaller budgets. At any fixed length, the prefix has the same distribution as a fresh draw of that size. Sharing candidates pairs the comparisons across budgets.

PythonIn [10]
CollapseExpand
answers = np.zeros((N_PROBLEMS, N_MAX), dtype=int)
is_correct = np.zeros((N_PROBLEMS, N_MAX), dtype=bool)

for i in range(N_PROBLEMS):
    a, c = draw_samples(i, N_MAX)
    answers[i] = a
    is_correct[i] = c
ConsoleOut [11]
CollapseExpand
Problems in the suite: 400
Mean latent per-sample accuracy: 0.455
Empirical single-sample accuracy: 0.470

In this run, the model probabilities average 0.455 and the first draw succeeds on 0.470 of the problems.

Selectors and a dial-able verifier

Three selectors cover the range we care about: an oracle-free plurality vote, a verifier-guided best-of-NN, and (implicitly) random selection when the verifier has no signal.

PythonIn [12]
CollapseExpand
def plurality_vote(block):
    """Plurality vote over the answers in each row of `block`."""
    out = np.empty(block.shape[0], dtype=int)
    for i, row in enumerate(block):
        out[i] = np.argmax(np.bincount(row, minlength=N_CHOICES))
    return out


def best_of_n(block_answers, block_scores):
    """Pick the highest-scoring candidate in each row."""
    idx = np.argmax(block_scores, axis=1)
    return np.take_along_axis(block_answers, idx[:, None], axis=1).ravel()

The tie rule chooses the lowest label among tied leaders. With uniformly sampled true labels and symmetric distractors, this has the same aggregate expected accuracy as choosing uniformly among the leaders. It still favors lower predicted labels in ties and can change the observed accuracy of a particular run.

The simulator draws independent unit-variance normal scores around separation for correct candidates and around zero for incorrect ones. The difference between one correct and one incorrect score has variance 2 and mean separation. The chance that it is positive is Φ(separation/2)\Phi(\text{separation}/\sqrt{2}), where Φ\Phi is the standard normal cumulative distribution function. The probabilities at separations 0, 1, and 3 are about 0.50, 0.76, and 0.98.

PythonIn [13]
CollapseExpand
def score_with_verifier(block_correct, separation):
    return rng.normal(loc=separation * block_correct.astype(float), scale=1.0)

Measuring coverage versus selection

The sweep records five curves: coverage, plurality voting, and best-of-NN with each of three verifier settings.

PythonIn [14]
CollapseExpand
sample_counts = [1, 2, 4, 8, 16, 32]
separations = {"uninformative": 0.0, "weak": 1.0, "strong": 3.0}

# One verifier noise draw per quality level, reused as prefixes across N.
verifier_scores = {
    k: score_with_verifier(is_correct, s) for k, s in separations.items()
}

coverage_curve = []
vote_curve = []
bon_curves = {k: [] for k in separations}

for n in sample_counts:
    block_answers = answers[:, :n]
    block_correct = is_correct[:, :n]

    coverage_curve.append(block_correct.any(axis=1).mean())
    vote_curve.append((plurality_vote(block_answers) == true_answer).mean())

    for name in separations:
        picked = best_of_n(block_answers, verifier_scores[name][:, :n])
        bon_curves[name].append((picked == true_answer).mean())
ConsoleOut [15]
CollapseExpand
   N   coverage  plurality   rand-ver   weak-ver  strong-ver
   1      0.470      0.470      0.470      0.470       0.470
   2      0.682      0.510      0.490      0.585       0.677
   4      0.815      0.620      0.470      0.655       0.805
   8      0.920      0.703      0.460      0.685       0.920
  16      0.973      0.792      0.443      0.752       0.963
  32      0.995      0.807      0.477      0.790       0.983

Coverage rises from 0.470 at one draw to 0.995 at 32. At 32, plurality voting gives 0.807 and the strong verifier reaches 0.983. The random verifier fluctuates near the one-draw baseline. In this run the weak verifier scores below plurality at budgets of 8 and above.

VisualizationOut [16]
CollapseExpand
Line chart of accuracy versus sample count for coverage, plurality vote, and three verifier qualities.
Coverage and selected accuracy over 400 simulated problems. Coverage rises from about 0.47 at one draw to 0.995 at 32 draws. The strong verifier approaches coverage in this run.

Coverage grows most over the early part of the sweep. The strong verifier stays close to coverage throughout this run. The gap between coverage and the weak verifier’s selected accuracy is widest at N=8N=8 and narrows at the two larger budgets shown.

Adaptive stopping versus equal-total and fixed-cap baselines

All policies use each problem's existing sample pool. The adaptive policy stops after four unanimous responses and uses sixteen otherwise. The equal-total baseline uses the adaptive policy's observed aggregate count, then shuffles assignments of the two adjacent integer budgets without looking at any individual stopping decision. The fixed-cap baseline uses sixteen draws on every problem.

PythonIn [17]
CollapseExpand
N0 = 4
N1 = 12
initial_answers = answers[:, :N0]
stopped = np.all(initial_answers == initial_answers[:, [0]], axis=1)
wrong_stop = stopped & (initial_answers[:, 0] != true_answer)
adaptive_budgets = np.where(stopped, N0, N0 + N1)

total_budget = int(adaptive_budgets.sum())
lower_budget, round_up_count = divmod(total_budget, N_PROBLEMS)
mean_matched_budgets = np.full(N_PROBLEMS, lower_budget)
order = np.random.default_rng(17).permutation(N_PROBLEMS)
mean_matched_budgets[order[:round_up_count]] += 1
assert mean_matched_budgets.sum() == adaptive_budgets.sum()
cap_matched_budgets = np.full(N_PROBLEMS, N0 + N1)


def prefix_accuracy(budgets):
    selected = [
        np.argmax(np.bincount(row[:budget], minlength=N_CHOICES))
        for row, budget in zip(answers, budgets, strict=True)
    ]
    return np.mean(np.asarray(selected) == true_answer)


adaptive_acc = prefix_accuracy(adaptive_budgets)
fixed_acc = prefix_accuracy(mean_matched_budgets)
fixed_worst_acc = prefix_accuracy(cap_matched_budgets)

power = N0 + 1
correct_mass = P_MAX**power - P_MIN**power
wrong_mass = ((1 - P_MIN) ** power - (1 - P_MAX) ** power) / (
    N_CHOICES - 1
) ** (N0 - 1)
expected_stop_rate = (correct_mass + wrong_mass) / (power * (P_MAX - P_MIN))
ConsoleOut [18]
CollapseExpand
Adaptive: 0.792 accuracy, 14.38 samples per problem
Mean-matched non-adaptive: 0.775 accuracy, 14.38 samples per problem
Cap-matched fixed: 0.792 accuracy, 16.00 samples per problem
Early stop: 0.135; wrong early stops: 0
Expected early-stop rate under the simulation distribution: 0.111

The adaptive and mean-matched policies both use 5,752 draws. In this run the adaptive policy reaches 0.792 accuracy versus 0.775 for the mean-matched policy. The cap-matched policy also reaches 0.792 while using 6,400 draws. These are observed results from one shared set of pools and one shuffle of the non-adaptive budgets.

The early-stop rate is 0.135 in the seeded suite. The expected rate is 0.111 when averaging over the simulator's distribution of pp. On a problem with given pp, the chance of four unanimous draws is p4+(1−p)4/729p^4+(1-p)^4/729. The second term is positive for p<1p<1 even though this run has zero observed wrong early stops.

VisualizationOut [19]
CollapseExpand
Three bars compare mean-matched, adaptive, and cap-matched sampling policies.
Accuracy over 400 simulated problems. The non-adaptive policy uses the same total number of draws as the early-stopping policy. The cap-matched policy uses 16 draws on every problem.

Verifier accuracy at a fixed sample budget

Next, hold the candidate pool and its budget fixed and vary verifier separation.

PythonIn [20]
CollapseExpand
quality_levels = [0.0, 0.5, 1.0, 1.5, 2.0, 3.0]
N_SWEEP = 16
sweep_answers = answers[:, :N_SWEEP]
sweep_correct = is_correct[:, :N_SWEEP]
sweep_noise = rng.standard_normal(sweep_correct.shape)
sweep_bon = []
for q in quality_levels:
    picked = best_of_n(sweep_answers, sweep_noise + q * sweep_correct)
    sweep_bon.append((picked == true_answer).mean())

vote_at_n = (plurality_vote(sweep_answers) == true_answer).mean()
ConsoleOut [21]
CollapseExpand
Plurality vote at N=16: 0.792
verifier separation  0.0: best-of-16 accuracy 0.460  <- below voting
verifier separation  0.5: best-of-16 accuracy 0.613  <- below voting
verifier separation  1.0: best-of-16 accuracy 0.748  <- below voting
verifier separation  1.5: best-of-16 accuracy 0.848
verifier separation  2.0: best-of-16 accuracy 0.917
verifier separation  3.0: best-of-16 accuracy 0.963

At zero separation, the expected accuracy matches that of one draw. The observed result is 0.460, and the first-draw result is 0.470. At separation 1, best-of-16 scores 0.748, below the plurality result of 0.792. At 1.5 it reaches 0.848. The sweep holds NN and every candidate's noise fixed, so only the correct-candidate bonus changes. This is an accuracy comparison. A cost comparison would also count the verifier calls.

Key Parameters

  • N_MAX and sample_counts set the maximum pool size and the prefixes used for the sweep.
  • separation controls the mean score difference between correct and incorrect candidates. At zero, scores are independent noise and best-of-NN has the accuracy of one draw in expectation.
  • N_PROBLEMS sets the size of the synthetic suite.
  • N_CHOICES gives the number KK of answer labels. With uniform distractors, the correct label is uniquely most probable when p>1/Kp>1/K.
  • N0 and N1 give the initial batch size and the number of extra samples when the first batch disagrees.

Limitations & Impact

Coverage can grow while voting or learned reranking levels off. Brown et al. observed this gap on math word problems, where the correct reference answers were available to the benchmark but unavailable to the selector. In their checked code and formal-proof settings, coverage gains could translate into gains in measured success. For a new task, compare selected accuracy with both coverage and a vote over the same number of draws.

Report the resource you matched. Generated tokens, model FLOPs, tool execution, and wall-clock latency can each produce a different ranking of policies. Measure whether a policy tuned on one workload transfers when the difficulty mix or the scorer's candidate distribution changes.

Summary

  • Distinguish the work of generating, scoring, and revising candidates. The stopping policy decides how to allocate the budget across these operations.
  • Coverage is the accuracy ceiling for a selector that returns an existing candidate. For independent draws with the same success probability pp on a given problem, it is 1−(1−p)N1-(1-p)^N and is nondecreasing in NN and pp.
  • Uniform selection gives single-draw accuracy in expectation. A learned verifier can score better or worse than this baseline, and its selected accuracy can fall as the pool grows.
  • With independent draws from a fixed answer distribution, a uniquely most probable label wins the plurality with probability approaching one. The correct label is uniquely most probable above p=1/Kp=1/K when the K−1K-1 distractors divide the error mass equally.
  • Process reward models score intermediate steps. Lightman et al.'s process-supervised verifier outscored their outcome-supervised verifier in the cited MATH reranking comparison.
  • Measure the effect of revision by counting repaired errors and spoiled correct answers. Judge ranking and end-to-end revision accuracy measure different outcomes.
  • For a given positive sample budget, the next-draw coverage gain peaks at p=1/(N+1)p=1/(N+1). Mean-matched and cap-matched comparisons measure different properties of adaptive policies.
  • Snell et al. found benefits from difficulty-aware allocation in their experiments. When comparing extra inference work with a larger model, keep the scorer, task mix, and compute accounting in view.

Quiz

Ready to test your understanding? Take this quick quiz to reinforce what you've learned about search, reflection, and test-time compute.

Search, Reflection, and Test-Time Compute

Question 1 of 80 of 8 completed
With independent draws each correct with probability p, what does the coverage formula 1-(1-p)^N represent?
Join the discussionAsk a question or share what you learned.

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!

A different angle
All writing
Language AI Handbook · Vol. 13

Outcome and Process Reward Models

Compare outcome and process reward models: labeling schemes, verifiers versus learned graders, step-score aggregation, reranking, and reward hacking.

38 min read
Language AI Handbook · Vol. 13

Faithful, Hidden, and Latent Reasoning

Separate visible explanations from the computation that produces answers. Learn how perturbation tests and causal examples measure faithfulness.

38 min read
Language AI Handbook · Vol. 13

Cold Starts, Rejection Sampling, and Distillation

Learn how reasoning pipelines produce, filter, and imitate traces through cold-start supervision, verifier-filtered rejection sampling, and distillation.

42 min read

About the author

Reference

Citation details

Cite or share this article.

BIBTEXAcademic
@misc{brenndoerfer2026searchreflection, author = {Michael Brenndoerfer}, title = {Search, Reflection, and Test-Time Compute}, year = {2026}, url = {https://mbrenndoerfer.com/writing/search-reflection-test-time-compute-inference-scaling}, organization = {mbrenndoerfer.com}, note = {Accessed: 2026-12-03} }
APAAcademic
Michael Brenndoerfer (2026). Search, Reflection, and Test-Time Compute. Retrieved from https://mbrenndoerfer.com/writing/search-reflection-test-time-compute-inference-scaling
MLAAcademic
Michael Brenndoerfer. "Search, Reflection, and Test-Time Compute." 2026. Web. December 3, 2026. <https://mbrenndoerfer.com/writing/search-reflection-test-time-compute-inference-scaling>.
CHICAGOAcademic
Michael Brenndoerfer. "Search, Reflection, and Test-Time Compute." Accessed December 3, 2026. https://mbrenndoerfer.com/writing/search-reflection-test-time-compute-inference-scaling.
HARVARDAcademic
Michael Brenndoerfer (2026) 'Search, Reflection, and Test-Time Compute'. Available at: https://mbrenndoerfer.com/writing/search-reflection-test-time-compute-inference-scaling (Accessed: December 3, 2026).
SimpleBasic
Michael Brenndoerfer (2026). Search, Reflection, and Test-Time Compute. https://mbrenndoerfer.com/writing/search-reflection-test-time-compute-inference-scaling
Newsletter

Stay up to date

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

Unsubscribe at any time. Privacy policy