GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
NeurIPS 2023

Tree of Thoughts: Deliberate Problem Solving with Large Language Models

Let the model propose several next steps, judge which are still promising, and search with backtracking. On the Game of 24, GPT-4 went from 4% to 74%, at a cost the paper itemizes.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2023
AUTHORS
Yao, Yu, Zhao, Shafran, Griffiths, Cao, Narasimhan
FROM
Princeton University, Google DeepMind
PUBLISHED
May 2023 · NeurIPS 2023
CITED BY
5,154Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 20% of this breakdown.

01

The paper in one minute

Chain-of-thought prompting asks a model to write out intermediate steps, but it still writes them once, left to right. If the first step is wrong, nothing later can undo it. Shunyu Yao and colleagues at Princeton and Google DeepMind, drawing on Newell and Simon's view of problem solving as search through a space of partial solutions, proposed Tree of Thoughts (ToT), presented at NeurIPS 2023.

A thought is a meaningful intermediate step: one equation in a math puzzle, one word in a crossword, one paragraph-level plan for an essay. Designing a ToT system means answering four questions. How should the problem be split into thoughts? How should candidate thoughts be generated, by sampling several independently or by asking for a list? How should states be evaluated, by rating each one ("sure", "maybe", "impossible") or by having the model vote for the best among several? And which search should run on top: breadth-first, keeping the best few states per level, or depth-first with pruning and backtracking?

The paper built three tasks that GPT-4 found hard. In the Game of 24 (combine four numbers to make 24), chain of thought solved 4% of 100 hard games; ToT with breadth-first search keeping five states solved 74%. In creative writing (four paragraphs ending in four given sentences), ToT plans were rated more coherent. In 5×5 mini crosswords, ToT with depth-first search got 60% of words right and solved 4 of 20 games, against under 16% of words for chain of thought.

The cost was stated plainly. A Game of 24 problem took about 5,500 generated tokens with ToT, close to 100 chain-of-thought samples, and cost $0.74 against $0.47.

THE IDEA, VISUALLY
BREADTH-FIRST SEARCH OVER THOUGHTS 4 9 10 13 13 − 9 = 4 left: 4 4 10 possible 13 − 10 = 3 left: 3 4 9 possible 4 + 9 = 13 left: 10 13 13 impossible 9 × 10 = 90 left: 4 13 90 impossible pruned by the evaluator 10 − 4 = 6 left: 4 6 possible 4 × 6 = 24 Each step: propose next equations, then ask the model 3 times whether 24 is still reachable (sure, maybe, impossible). Keep the best 5 states. About 60% of chain-of-thought samples had already failed after the first equation. Search lets the model back away from a bad first step; a single left-to-right chain cannot. GAME OF 24, 100 HARD GAMES, GPT-4 IO 7.3% Chain of thought 4% CoT self-consistency, 100 9% IO + refine ×10, with correctness feedback 27% Best of 100 IO (oracle pick) $0.13 per game 33% Best of 100 CoT (oracle pick) $0.47 per game 49% ToT, breadth 1 45% ToT, breadth 5 $0.74 per game 74% Creative writing (GPT-4 coherence score, 1 to 10): IO 6.19, CoT 6.93, ToT 7.56, but IO with refinement 7.67. Mini crosswords: ToT solved 4 of 20 games (20%), CoT 1%. Oracle picks need the right answer to choose; ToT does not.
Tree of Thoughts has the model propose next steps, rate whether each partial solution can still succeed, and keep the best few. On the Game of 24 that beat even an oracle pick of the best of 100 chains, but the gain depends on how well the model rates states and costs more per problem.
Research notes: the problem, approach and results
4% → 74%

Game of 24 success with GPT-4, chain of thought against ToT with breadth 5, on 100 hard games

$0.74

cost per Game of 24 problem for ToT, against $0.47 for 100 chain-of-thought samples

60%

of chain-of-thought samples that had already failed after the first equation

THE PROBLEM

A language model writes left to right and never revisits an early choice. On problems where the first step decides everything, such as arithmetic puzzles or crosswords, a bad opening ruins the answer, and sampling more chains does not fix it.

THE IDEA

Break the problem into steps called thoughts. At each step, have the model propose candidate thoughts, have it evaluate how promising each partial solution is, and run breadth-first or depth-first search over the resulting tree, pruning and backtracking.

THE RESULT

With GPT-4, Game of 24 success rose from 4% with chain of thought to 74%; mini crosswords went from 1% of games to 20%; creative writing coherence improved. ToT cost $0.74 per Game of 24 problem against $0.47 for 100 chain-of-thought samples.

02

Why it matters to an FDE

Most customer tasks do not need tree search; GPT-4 with chain of thought already did well on GSM8K in the paper's own appendix. But some do: scheduling with constraints, configuration that must satisfy many rules, multi-step plans where an early choice locks in the rest. ToT gives a vocabulary for those cases, and its numbers give you the trade-off.

Search helps when early mistakes are fatal and detectable. Sixty percent of the failed chains had gone wrong at the first equation. A rater that can say "this can no longer reach 24" lets the search drop those branches early.

The evaluator decides the outcome. ToT works only as well as the model's judgment of partial states. If you have a programmatic check, such as a constraint solver, a schema or a unit test, use it as the evaluator instead.

Ask whether a program would solve it outright. The Game of 24 is a few hundred milliseconds of exhaustive search in code. ToT shows how an LLM can search; for a customer task with a formal structure, letting the model write or call a solver is usually cheaper and exact.

Price it per problem. ToT spent five to a hundred times more generated tokens than chain of thought, by the authors' estimate. Work out the cost per resolved case before proposing it.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 99 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The four design choices, the results per task, and misreadings to avoid

    Free account
  2. 04How it works

    The prompts, the search loops and the settings used for each task

    Premium
  3. 05The numbers that matter

    Each result in context: sample sizes, oracles, model swaps, and the inconsistencies

    Premium
  4. 06Try it yourself

    Game of 24 with an exact solver and a simulated model whose proposer and evaluator you can weaken

    Premium
  5. 07Where it breaks

    The limits the authors state and the ones the setup hides

    Premium
  6. 08Using it on a deployment

    Applying propose, evaluate and search to customer problems without overspending

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →