AI State of the Art
SOTA/Reasoning Models/22 min
Section 176

MCTS (Monte Carlo Tree Search) for LLM Reasoning

Listen as a podcast →

From the Game of Go to Math Problems

In 2016, AlphaGo beat the world champion of Go thanks to Monte Carlo Tree Search (MCTS). The algorithm is elegant: faced with a gigantic tree of possibilities (Go has more positions than atoms in the universe), MCTS explores intelligently by balancing exploration (testing new branches) and exploitation (deepening promising branches).

The analogy with reasoning is direct: when an LLM solves a complex problem, each thinking step is a "move," and solving the complete problem is like winning the "game." Reasoning becomes a game, and MCTS knows how to play.

The chess analogy

In chess, MCTS explores possible moves, simulates entire games, then focuses its efforts on branches that seem to lead to victory. For LLM reasoning, each "move" is a thinking step ("let's apply the derivative," "let's factor"), and each "complete game" is an end-to-end problem resolution.

The Four Phases of MCTS

The algorithm repeats four phases in a loop, each iteration refining its understanding of the possibility tree.

Four-panel diagram enclosed in a loop, labelled from left to right Selection, Expansion, Simulation and Backpropagation. Each panel shows the same small tree of circles. In Selection, bold arrows descend from the root to a bold node, under the label Tree Policy. In Expansion, a new bold circle is added below that node. In Simulation, a dotted arrow runs from the new circle down to an isolated triangle, under the label Default Policy. In Backpropagation, arrows travel back up to the root and triangles appear inside the nodes along the path. The caption reads one iteration of the general MCTS approach.
One full MCTS iteration, as described in the reference 2012 survey. You walk down the existing tree to a promising leaf, add a child to it, play a quick game from that child to a result (the isolated triangle), then carry that result back up the path you took. The rounded frame around the four panels is a reminder that the cycle restarts, dozens or hundreds of times.Source : Browne et al., A Survey of Monte Carlo Tree Search Methods (2012, figure 2), via czxttkl

Phase 1: Selection

Starting from the root (the problem posed), you descend through the tree by choosing at each node the most promising child according to the UCB formula (Upper Confidence Bound):

UCB(node)=Q(node)N(node)+c⋅ln⁡N(parent)N(node)UCB(\text{node}) = \frac{Q(\text{node})}{N(\text{node})} + c \cdot \sqrt{\frac{\ln N(\text{parent})}{N(\text{node})}}
  • Q(node)Q(\text{node}) = total reward accumulated by this node
  • N(node)N(\text{node}) = number of times this node has been visited (N(parent)N(\text{parent}): same, for its parent)
  • cc = a hand-tuned coefficient that doses the weight of exploration (large cc = try little-known branches more willingly)
  • First term: exploitation, the node's average reward (Q/NQ/N), we favor what has performed well so far
  • Second term: exploration, we give a chance to rarely visited nodes

In one sentence: a node's score is its average performance, plus a bonus that grows when the node has been visited little compared to its parent, and cc sets the size of that bonus.

It's this tension between "go toward what works" and "try what we don't know" that makes MCTS so powerful. Without the second term, you'd get stuck in a local optimum. Without the first, you'd explore randomly.

Phase 2: Expansion

When you reach a leaf (a node with no children), you generate new reasoning steps via the LLM. Concretely, the model proposes multiple possible continuations of the partial reasoning, and each becomes a new node in the tree.

Phase 3: Simulation (Rollout)

From the new node, you complete the reasoning all the way to a final answer. It's like playing a quick game to the end to get an idea of the outcome. The LLM generates the rest of the reasoning greedily or by sampling.

Phase 4: Backpropagation

The simulation result (correct or incorrect) is propagated back along the path taken. The QQ and NN statistics of each visited node are updated. Over iterations, nodes that often lead to correct answers build a good reputation.

Adaptation to LLMs

State = A Partial Reasoning

Each node of the tree represents reasoning under construction:

Root: Solve f(x)=2x2+3x−5f(x) = 2x^2 + 3x - 5, find f′(x)f'(x)

  • Node 1: Apply differentiation rules
    • Node 1.1: ddx(2x2)=4x\frac{d}{dx}(2x^2) = 4x ✓
    • Node 1.2: ddx(2x2)=2x\frac{d}{dx}(2x^2) = 2x ✗
  • Node 2: Use polynomial derivative formula
    • Node 2.1: f′(x)=4x+3f'(x) = 4x + 3

The tree naturally captures different approaches and their variants, including dead ends.

Three-band diagram. Top, Inputs: a question asking whether Emperor Heraclius fought against the Fifth Dynasty of ancient Egypt, plus a stack of source documents. Middle, MCTS band: a tree whose nodes are text bubbles, each carrying a Q score between 0 and 1. A book icon marks a document retrieval action, a light bulb icon an attempt to answer. One branch scored Q equals 0.3 wrongly claims Heraclius fought India, another scored Q equals 0.8 finds a relevant source. Bottom, Output: the final answer scored Q equals 0.9, concluding that the Fifth Dynasty lived centuries before Heraclius. On the right, two boxes list the components (agent LLM, evaluation LLM, retrieval tool) and the two available actions, RETRIEVE and ANSWER.
The same tree, applied to a real question. Each node is no longer a game move but a reasoning step written out in full, with a Q score attached. The wrong branch, which invents a war against India, gets a low score and will soon be abandoned; the branch that goes and fetches a source scores high and will be explored further.Source : inovex blog, MCTS meets LLMs

Reward Function

This is the crux of the matter. How do you know if a branch is promising? Several options exist:

  • ORM (Outcome Reward Model): you only look at whether the final answer is correct (when it's verifiable)
  • PRM (Process Reward Model): you evaluate each step individually, a much richer signal
  • Self-evaluation: the LLM itself rates the quality of each step
  • External verification: code execution, symbolic computation, proof assistant

The LLM as Game Policy

The LLM plays the role of the policy (in the reinforcement-learning sense: the strategy that picks the next action, refresher here): it decides which reasoning steps to propose. Temperature controls diversity. Low temperature = conservative reasoning. High temperature = creative but risky explorations.

MCTS + PRM: the winning combo

The PRM (Process Reward Model) provides a reward signal at each step, which guides exploration in a fine-grained way. Clearly bad branches are penalized early. Good branches receive more attention. It's the most powerful combination for mathematical reasoning.

1. Exploration-Exploitation Balance

The UCB formula naturally manages this dilemma. Classic beam search simply keeps the K best candidates at each step, which can trap it in a local optimum. MCTS goes back to explore forgotten branches when favorite branches disappoint.

2. Adaptive Compute Allocation

Difficult problems automatically receive more iterations, because the tree doesn't converge quickly. Easy problems converge rapidly and consume little. Compute distributes itself intelligently.

3. Natural Backtracking

If a branch turns out to be bad after simulation, MCTS doesn't blindly pursue it. It redistributes attention to other branches. It's elegant backtracking, without an explicit backtracking mechanism.

Concrete Use Cases

rStar and rStar-Math (Microsoft)

rStar has two small models collaborate at inference time: one explores reasoning paths with MCTS, the other evaluates them. Its follow-up, rStar-Math, closes the loop: the reasoning paths validated by MCTS become training data to retrain the model and its evaluator, and the improved pair launches a new round of exploration. The model improves by playing against itself, exactly as AlphaGo did for Go.

Three-panel diagram. Panel a, titled MCTS-driven deep thinking: a tree whose nodes carry scores such as 0.8 or minus 0.7, with green leaves marked 1 for correct answers and red leaves marked minus 1 for wrong ones; each step is checked by a verifier, either the PPM preference model or Python code execution. Panel b: construction of per-step preference pairs from the Q values, from the first step through to full solutions. Panel c: four rounds of self-evolution, where the small language model and the preference model produced in one round are used to launch the next.
How self-play works in rStar-Math, the follow-up to rStar. On the left, MCTS explores solution steps and each one is scored then verified. In the middle, winning and losing branches are paired up to form training data. On the right, four successive cycles: the model and its evaluator produced in one round are used to launch the next, and the level climbs each time.Source : Microsoft Research blog post on rStar-Math

AlphaProof (DeepMind)

AlphaProof applies tree search to formal mathematical proofs: the LLM generates proof steps, Lean (a proof assistant, software that mechanically checks every step of a demonstration) verifies each step with certainty, and the search explores the space of possible proofs. The result DeepMind announced in 2024: together with AlphaGeometry 2, it solved 4 of the 6 problems of that year's International Mathematical Olympiad, silver-medal level, a domain long considered out of AI's reach.

MCTS vs Tree of Thoughts

Tree of Thoughts uses simple beam search: good for basic exploration. MCTS is superior when the search space is immense and per-step rewards are available (via a PRM). If you don't have a reliable PRM, ToT remains an excellent choice, simpler and less expensive.

The Cost: The Price of Power

Orders of Magnitude

A typical MCTS for reasoning:

MetricValue
Iterations per problem50-500
Each iteration1 expansion + 1 simulation
Total LLM calls per problem100-1000

For comparison, self-consistency requires 10-40 calls. MCTS is 10 to 100 times more. Much more expensive, but potentially far more effective on truly difficult problems.

Parallelization

MCTS simulations can be partially parallelized (leaf parallelization, root parallelization). This reduces latency, but makes exploration slightly less optimal since updates aren't instantaneous.

MCTS: research rather than production

MCTS for LLM reasoning remains a research technique more than a production one. The high cost and the need for a good reward signal limit it to high-value problems: advanced math, critical code, formal proofs, complex planning.

For everyday applications, CoT or self-consistency offer a much better quality-to-cost ratio.

The Convergence of Two Worlds

MCTS applied to LLM reasoning embodies the fusion between classical AI planning techniques (MCTS comes from game theory and operations research) and the generative capabilities of modern LLMs. These are not two separate worlds: tree search and text generation complement each other naturally.

As PRMs and base models improve, MCTS for LLMs could unlock even more advanced reasoning capabilities, particularly in domains where verification is automatable.

Check your understanding0 / 4

1. In the UCB formula that drives the selection phase, what is the second term for, the one that grows when a node has rarely been visited?

2. Compared with the beam search used by Tree of Thoughts, what is MCTS's decisive advantage?

3. Your company wants to improve the answers of a general-purpose customer assistant. Is deploying MCTS a good idea?

4. Why does the page present the MCTS + PRM pairing as the winning combo for mathematical reasoning?