AI Infra
0%
Part IV · Chapter 25

Structured Reasoning as Search

AuthorChangkun Ou
Reading time~9 min

Once a model is allowed to write intermediate work, the next question is how to move through that work. A chain commits to one path. A tree keeps its alternatives alive, and a graph goes further still, letting partial results be combined, revised, and reused. Search is the family of methods that turns reasoning from "produce the next token" into "choose which partial state deserves the next unit of compute." It is still inference-time work on a frozen model, as in Chapter 24, but the control problem is now explicit.

2026-06-23T11:08:15.903439 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ chain tree search graph reuse value-guided
Figure 25.1. Schematic map of reasoning search. A fixed prompt can be decoded as one chain, expanded as a tree, reconnected as a graph, or guided by a value model. The useful budget is the part spent on states that survive selection.

The State Space Under a Thought

Treat a reasoning trace as a path through partial states. The prompt is xx. After tt reasoning steps, the state is st=(x,z1,,zt)s_t = (x, z_1, \ldots, z_t), where each ztz_t is a short thought, subgoal, program fragment, proof step, or tool result. The model proposes the next step with a policy πθ(zt+1st)\pi_\theta(z_{t+1} \mid s_t), the model itself viewed as a rule for choosing the next step. Some scorer v(st)v(s_t) estimates whether the partial state is promising, and a terminal verifier V(sT)V(s_T) says whether a finished state is correct. The search problem is:

s^=argmaxsTSB(x)V(sT),\hat{s} = \arg\max_{s_T \in \mathcal{S}_B(x)} V(s_T),

where SB(x)\mathcal{S}_B(x) is the set of terminal states reachable under budget BB. This notation is deliberately broad. In self-consistency, SB(x)\mathcal{S}_B(x) is a bag of independent chains and VV is often a vote. Tree of Thoughts builds the set by expanding and pruning nodes (Yao et al. 2023). Under AlphaZero-like decoding, the next rollout goes where vv or a learned value model points (Feng et al. 2023).

The budget accounting is simple enough to matter:

CNgenCdecode+NscoreCscore+NverifyCverify.C \approx N_{\text{gen}} C_{\text{decode}} + N_{\text{score}} C_{\text{score}} + N_{\text{verify}} C_{\text{verify}}.

Here NgenN_{\text{gen}} counts generated states, NscoreN_{\text{score}} counts partial state evaluations, and NverifyN_{\text{verify}} counts terminal checks. The constants are not interchangeable. A Python unit test may be cheap, a model-written score may be another full decode, and a formal checker may be cheap to run but costly to author. This is why the verifier ladder in Chapter 27 is not a detail of training alone. It sets the economics of search.

Chains, Beams, Trees, and Graphs

A chain is the degenerate case. It has branching factor one and no memory of alternatives. Its cost is linear in the number of thoughts, and its failure mode is early commitment. Beam search keeps ww states after each step, the ww best partial solutions found so far. It is useful when a local score is meaningful, but brittle when the score cannot see a delayed payoff. Tree search opens the design further: expand bb children, score them, keep a frontier, and allow backtracking. Tree of Thoughts made this pattern concrete by letting the model propose and self-evaluate intermediate thoughts, then running breadth-first or depth-first search over them (Yao et al. 2023).

Graph search removes a hidden assumption of trees. A tree says every partial state has exactly one parent. Many reasoning tasks do not behave that way. A proof can reuse a lemma. Two equivalent states in a planning problem can be merged into one. A data-analysis question can compute two statistics and then combine them. Graph of Thoughts models these intermediate units as vertices and lets edges represent dependency, aggregation, refinement, or feedback, so a later step can consume several earlier thoughts rather than only one parent (Besta et al. 2023). The gain is reuse and composition. The cost is bookkeeping: the system must decide when two thoughts are compatible, redundant, or contradictory.

# A minimal verifier-guided tree search. The details vary, but the control
# problem is stable: generate candidates, score partial states, keep a frontier,
# and spend verification only on finished states.
def search(prompt, budget, width, expand, score, verify):
    frontier = [State(prompt)]
    finished = []
    while budget.remaining() and frontier:
        candidates = []
        for state in frontier:
            for child in expand(state):
                budget.charge_decode(child)
                if child.is_terminal():
                    budget.charge_verify(child)
                    if verify(child):
                        finished.append(child)
                else:
                    budget.charge_score(child)
                    child.value = score(child)
                    candidates.append(child)
        frontier = sorted(candidates, key=lambda s: s.value, reverse=True)[:width]
    return select_best(finished, frontier)

This sketch also shows why search is not a free layer above prompting. If score is noisy, the frontier fills with states that look good rather than states that are good. Near-duplicate proposals from expand spend width on repetition. And when verify is unavailable, the search falls back to a learned reward model and inherits the over-optimization problem of Chapter 19.

Figure 25.2. Search budget allocation. Increase branching and depth to spend more compute on generation, then raise verifier quality to see when that extra coverage becomes useful. The display is synthetic: it shows the shape of the trade-off, not measured benchmark numbers.

Value Guidance and the Board-Game Temptation

The analogy to board-game search is productive but easy to over-read. AlphaZero works because a game state is compact, legal moves are enumerable, the simulator is exact, and win or loss is eventually known. Language reasoning lacks all four properties in their clean form. The state is a text prefix, the action space is a vocabulary or a free-form thought, the transition is another model decode, and terminal correctness may be unavailable. This is why many LLM search systems use the AlphaZero shape without importing the full AlphaZero setting.

The useful import is the separation between proposal and value. The proposal policy says "what could come next." The value model, a learned scorer of how promising a partial state is, says "which partial state is worth another rollout." Self-evaluation guided beam search asks the model to score its own intermediate steps (Xie et al. 2023). AlphaZero-like tree search learns a value function and uses it to guide decoding and later training (Feng et al. 2023). Both methods spend compute on a bet: scoring a partial state is cheaper than fully expanding it, and accurate enough to avoid wasting most of the tree.

That bet fails in predictable regimes. When the value model cannot see the hidden mistake, search amplifies it. A verifier that scores only final answers leaves partial pruning to guesswork. Where the problem has no useful branching structure, a tree only repackages self-consistency with more overhead. Search pays when partial states differ in value before the final answer, and when the system can measure that difference well enough.

What the Search Layer Belongs To

Search can be read three ways in the rest of the book.

  • As elicitation. The fixed model already contains useful solution paths, and search is a way to find and select them. This is the view of Chapter 24 and the amplification side of the RLVR debate in Chapter 28.
  • As verification infrastructure. Search is only as strong as the scorer or checker in its loop. This connects directly to Chapter 27 and to the model-judge cautions in Chapter 50.
  • As agent control. Once a state includes tool results, memory, and actions, this same loop becomes an agent harness. ReAct interleaves reasoning traces and environment actions (Yao et al. 2022); Chapter 41 later treats that loop as production software rather than a prompting pattern.
What's Contested

The field still lacks a stable answer to when structured search beats simpler sampling. Tree of Thoughts reports large gains on tasks with explicit branching, such as the Game of 24 (Yao et al. 2023). Graph of Thoughts reports gains when intermediate results can be merged or refined (Besta et al. 2023). Yet many benchmarks reward a cheaper recipe: draw more independent samples and let a verifier choose. The comparison is often confounded by verifier quality, prompt engineering, temperature, and task choice. Treat "search helps reasoning" as a claim about a task's state structure and checker, not a property of language models in general. The strongest evidence runs the same way: where the evaluator is exact and cheap, search at scale has produced new artifacts, among them AlphaEvolve's first improvement in 56 years over Strassen's 1969 scheme for 4×44 \times 4 complex matrix multiplication, plus a scheduling heuristic that recovers 0.7% of Google's fleet-wide compute (Novikov et al. 2025).

Constraint Arrow

Search spends the same scarce resource that serving has to sell: generated tokens, scorer calls, verifier calls, and wall-clock latency. A search method that looks strong in an offline table may be unusable once Chapter 31 adds batching, cache residency, and tail latency. The constraint also runs upward: if Chapter 27 cannot provide a reliable checker, wider search mostly buys more plausible candidates for a weak selector.

Search makes the middle layer visible. Below it are model proposals and serving costs. Above it are verifiers, agents, and product latency budgets. The next chapter changes the state itself: instead of making every reasoning step a natural-language thought, it asks the model to hand part of the work to a program, a solver, or a proof checker.

Further reading

  • Besta et al., “Graph of Thoughts: Solving Elaborate Problems with Large Language Models,” 2023. arXiv:2308.09687
    Graph of Thoughts generalizes chain and tree prompting into arbitrary graphs of LLM-generated thoughts, enabling aggregation, refinement, and feedback loops over intermediate reasoning units.
  • Besta et al., “Reasoning Language Models: A Blueprint,” 2025. arXiv:2501.11223
    This blueprint unifies reasoning language model components, including chains, trees, graphs, MCTS, beam search, value models, process supervision, test-time compute, tools, and agent systems.
  • Ke et al., “A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systems,” 2025. arXiv:2504.09037
    This survey organizes LLM reasoning by inference-time versus training-time regimes and standalone versus agentic compound architectures, covering prompting, selection, RL, verifiers, and agent workflows.
  • Novikov et al., “AlphaEvolve: A Coding Agent for Scientific and Algorithmic Discovery” (evolutionary search over programs; first improvement on Strassen's 1969 4x4 complex matrix multiplication in 56 years), 2025. arXiv:2506.13131
    AlphaEvolve runs an evolutionary coding-agent loop with automated evaluators, finding a 48-multiplication algorithm for 4x4 complex matrices (beating Strassen's 1969 result) and a scheduling heuristic recovering 0.7

Comments

Log in to comment