Concept · Chapter 14: Reasoning Models
Search over Reasoning Steps
Search over reasoning steps keeps several partial solutions alive, scores them, and expands the most promising, so that one tempting early choice does not decide the whole answer.
The problem
Left-to-right generation commits to each step as it goes; when the locally attractive step leads nowhere, there is no way back.
The solution
Treat partial solutions as states in a search problem: propose continuations, evaluate states with a heuristic or a model, keep a frontier of the best, and backtrack or expand further.
The consequence
Search can solve problems that a single path misses, at a cost that grows with width and depth, and it is only as good as its evaluator and its budget.
You should understand first
- The Turing Test
- Symbolic AI
- Search
- Text as Data
- Probability and Distributions
- Conditional Probability and Bayes' Theorem
- Probability of Sequences
- Language Modeling
- Vectors
- Dot Product
- Embeddings
- Attention
- Softmax
- Self-Attention
- Causal Masking
- Entropy
- Loss Functions
- Cross-Entropy Loss
- Autoregressive Next-Token Prediction
- Pretraining at Scale
- GPT-1 → GPT-2 → GPT-3
- In-Context Learning
- Chain of Thought
- Search over Reasoning Steps
The trap of the nearest step
Start at 1. The moves are +2, ×2 and −3. Reach 19.
Always taking the move that lands closest to 19 gives 1 → 3 → 6 → 12 → 14 → 16 → 18. From 6 onward every number is even, and only −3 can make an even number odd, but −3 always looks like a step backwards. The route that works, 1 → 3 → 5 → 10 → 20 → 17 → 19, passes through 5, which looked worse than 6 at the second move.
This is the problem Chapter 1's search addressed for planning. Language models face it every time a reasoning step closes off options.
Search families
All of them repeat one cycle: propose continuations of current states, evaluate them, select which to keep, and expand again.
- Greedy keeps the single best state. Cheap, and trapped by any misleading early score.
- Beam search keeps the best distinct states each round. The lab implements exactly this over integers, ranking by distance to the target.
- Best-first / A* keeps a priority queue across depths and can return to an old state.
- Monte Carlo Tree Search repeatedly selects a path using visit counts and value estimates, expands a state, evaluates it (often with a rollout or a value network) and backs the value up through its ancestors. AlphaGo combined MCTS with policy and value networks. Established
A tiny count
In the lab, each kept state proposes three moves. With width , a round makes up to proposals, each costing one check.
| Width | Finds 19 in ≤ 6 moves? | Checks used |
|---|---|---|
| 1 (greedy) | No | 18 |
| 2 | Yes, at move 6 | 33 |
| 3 | Yes, at move 6 | 48 |
Width 3 spends more than width 2 for the same answer here; on target 29, only width 3 succeeds within six moves. There is no universally right width, only a budget and a task.
Over text instead of integers
Tree of Thoughts ran breadth- and depth-first search over “thoughts”, coherent chunks of text, using the language model both to propose next thoughts and to evaluate states; on the Game of 24 puzzle, GPT-4's success rate rose from 4% with chain-of-thought prompting to 74%. EstablishedThe integer lab hides the hard parts of doing this with text:
- What is a state? A line of a proof, a paragraph, a partial program? The granularity decides how many choices exist.
- Who scores it? A heuristic, the model judging itself, a trained verifier or an executable check. A model's opinion of its own partial work can be confidently wrong.
- When to stop? A known goal (19) is easy. Open-ended questions have no goal test, so search needs a separate verifier.
Reasoning models trained with RL may learn to explore and backtrack within a single long chain of thought, without an external search procedure. Interpretation Whether that internal behaviour amounts to search in the algorithmic sense is a research question; do not assume a product runs an explicit tree unless its documentation says so.
Mini experiment
In the lab, set target 29 and six moves. Try widths 1, 2 and 3 and note which succeed and the checks each uses. Then reduce the moves to 5 with width 3. Write one sentence on what width bought and one on what it could not buy.
What to remember
- Greedy search keeps one state per step; beam search keeps the best k; MCTS also backs values up the tree.
- Width preserves alternatives; depth allows enough steps; neither fixes a misleading evaluator.
- In the lab, target 19 fails with one path and succeeds with two or three within six moves.
- Count the cost: every proposed state is a model call or a check.
- Tree of Thoughts took GPT-4 from 4% to 74% on Game of 24, with many more model calls.
Key papers
Mastering the game of Go with deep neural networks and tree search
David Silver, Aja Huang et al. · 2016 · Nature
AlphaGo combined learned intuition (neural networks) with classical search — and beat top professionals at a game long thought decades away.
How to read it: A perfect bridge between this chapter's two halves: symbolic search, guided by learned networks.
Tree of Thoughts: Deliberate Problem Solving with Large Language Models
Shunyu Yao, Dian Yu et al. · 2023 · NeurIPS 2023
Made classical search explicit around a language model: propose partial solutions, evaluate them, and backtrack instead of committing left to right.
How to read it: For each task, write down what a state is, who scores it and how many model calls a solution costs; the gains come with a large call budget.