Tree of Thoughts: Deliberate Problem Solving with Large Language Models

Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Thomas L. Griffiths, Yuan Cao, Karthik Narasimhan

2023 · NeurIPS

Tree of Thoughts: Deliberate Problem Solving with Large Language Models

Problem

Framing

LLM inference stayed token-local and greedy at test time, which breaks on tasks that need lookahead, branching, and backtracking. The paper replaces single-chain decoding with search over semantically coherent thoughts plus LM-based self-evaluation. On Game of 24, GPT-4 rises from 4% with CoT to 74% with ToT.

Currently Used Methods

Direct antecedents

Proposed Method

Architecture

ToT represents inference as a tree whose nodes are partial thoughts and whose edges are LM-generated continuations. The LM alternates between generating candidate thoughts, scoring states, and applying a search policy such as BFS or DFS. The thought granularity is task-specific: 3 arithmetic steps, a writing plan, or crossword fills.

Schematic comparison of IO, CoT, self-consistency, and Tree of Thoughts, where ToT branches over intermediate thought nodes and selects promising paths.

Loss / Objective

The framework changes inference, not model training.It still queries the base LM autoregressively:

pθ(yx)=t=1npθ ⁣(ytx,y1:t1)p_\theta(y \mid x) = \prod_{t=1}^{n} p_\theta\!\left(y_t \mid x, y_{1:t-1}\right)

Algorithm

At each step, ToT expands candidate thoughts and keeps or explores states using LM-scored heuristics.

St=Search ⁣(St1,Gθ(x,St1),Vθ(x,St))S_t = \operatorname{Search}\!\left(S_{t-1},\, G_\theta(x, S_{t-1}),\, V_\theta(x, S_t)\right)

For Game of 24, BFS keeps the best b=5b=5 states per depth. For Mini Crosswords, DFS explores one clue fill at a time and backtracks after low-value states.

Training Procedure

Evaluation

Datasets

Metrics

Headline results

Verified results page showing Table 2 for Game of 24 success rates and Figure 3 with scale and error analyses.

Table 2: Game of 24 Results.

MethodSuccess
IO prompt7.3%
CoT prompt4.0%
CoT-SC (k=100)(k=100)9.0%
ToT (ours) (b=1)(b=1)45%
ToT (ours) (b=5)(b=5)74%
IO + Refine (k=10)(k=10)27%
IO (best of 100)33%
CoT (best of 100)49%

Ablations

Method Strengths and Weaknesses

Strengths

Weaknesses

Suggestions from the authors

Links

Prior Papers

Further Papers