Search, Reflection, and Test-Time Compute › The General Pipeline: Generate, Score, Select, Stop

Michael BrenndoerferNovember 29, 20262 min read
Language AI HandbookAll chapters
Part 40 of 67Reasoning Post-Training and Verifiable Rewards
Chapter 304Search, Reflection, and Test-Time Compute › The General Pipeline: Generate, Score, Select, Stop
Reading section 4 of 14 · The General Pipeline: Generate, Score, Select, Stop · 2 minSection 4 of 14 · 2 min

Section 4 of 14 · 2 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

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.

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