Search, Reflection, and Test-Time Compute › The General Pipeline: Generate, Score, Select, Stop
Language AI HandbookAll chapters Start with a prompt . The generation policy assigns a complete response 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 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.
- Generate. Draw candidates from the configured decoder.
- Score. Assign each candidate a scalar score . A scorer can read the candidate and prompt, run tests, or count agreements in the pool.
- Select. Return , where is a highest-scoring index chosen by a tie rule.
- Stop or continue. Decide whether to return the selected answer, draw more candidates, or try a revision.
For test-time allocation, let be the cost incurred on prompt with random draws . One objective is to maximize expected accuracy under an expected budget per prompt:
Here comes from the target distribution and represents the policy's randomness. On a finite benchmark of prompts, a realized total budget instead takes the form . A separate condition can cap any one request.
Best-of- 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.
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!