Prompts & AI use

Tree of Thoughts

AI-assisted editorial review:

Tree of Thoughts (ToT) is a reasoning technique for large language models that extends chain-of-thought prompting. Instead of following one line of reasoning, the model proposes several candidate intermediate steps, evaluates them, and keeps exploring the most promising ones, looking ahead or backtracking when needed.[1]

What does Tree of Thoughts mean in simple terms?

Chain of thought asks the model to write out one path to the answer. Tree of Thoughts asks it to lay out several paths, judge which look promising, and continue only along the best ones.[1] It resembles a team meeting where, instead of settling on the first idea, people list three options, score them, and develop only the strongest. Unlike a straight-line answer, the process can go back and try another branch when it hits a dead end.[1] In the original experiments this raised success rates sharply on puzzles and planning-style tasks that are hard to solve in one pass, but it needs many more model calls, so cost and response time grow as well.[2]

How can Tree of Thoughts be explained with an analogy?

It is like asking three suppliers for quotes, comparing them, adjusting the terms, and then choosing one, rather than accepting the first quote you receive.

Where is Tree of Thoughts used?

Case 1

Yao et al. (Princeton, Google DeepMind) — Game of 24, from 4% to 74%

The original paper used the same model, GPT-4, and varied the prompting and search strategy on 100 relatively hard Game of 24 puzzles, where four numbers must be combined into 24.[2] Success was 7.3% with standard input-output prompting and 4.0% with chain-of-thought prompting, but 74% with ToT using breadth-first search that kept the best five candidates (b = 5) at each step.[2] At every step the model proposed possible next equations and rated each one "sure", "maybe", or "impossible" to reach 24, so that clearly impossible branches were dropped.[2] Multi-step calculations where each branch needs checking, such as trying combinations of discounts in a quote, have a similar structure, though results on business tasks have not been measured in this study.
Result: Game of 24 success rate (GPT-4) — CoT 4.0% → ToT 74%.[2]

Case 2

The same paper — Creative Writing and Mini Crosswords

In a task to write a coherent four-paragraph passage, GPT-4's own coherence scores averaged 6.19 for input-output prompting, 6.93 for CoT, and 7.56 for ToT.[2] In a blind comparison by a subset of the authors over 100 passage pairs, ToT was preferred in 41 pairs, CoT in 21, and 38 were judged similar.[2] On 5×5 mini crosswords, word-level success was 14% for input-output and 15.6% for CoT, versus 60% for ToT; whole games solved rose from 0% and 1% to 20% (4 of 20).[2] Work that involves drafting several options and choosing one, such as outline or copy alternatives, has a similar shape, but the paper itself tested only these puzzle and writing tasks.
Result: 5×5 mini crosswords, games solved (GPT-4) — IO 0%, CoT 1% → ToT 20%.[2]

Case 3

IBM Think explainer — Framework, uses, and costs

IBM's prompt engineering explainer places ToT under agentic prompting and breaks it into four parts: thought decomposition, thought generation, state evaluation, and a search algorithm such as breadth-first or depth-first search.[4] It describes four applications: sudoku, Game of 24, creative writing, and 5×5 crosswords.[4] It also lists limitations: keeping several paths and backtracking is computationally intensive, which can make ToT hard to scale or use where fast responses are needed, and setting up the components is complex.[4]
Result: Positioned for tasks that need exploring several solutions, with computational overhead and implementation complexity as stated trade-offs.[4]

Case 4

Follow-up research — Search efficiency and code generation

Katz and colleagues at IBM Research (NeurIPS 2024) argue that many LLM planning methods spend large numbers of model calls without guarantees of finding a solution. In their Thought of Search approach, the model writes code for the search components instead; a simple search using that code solved all 1,362 Game of 24 instances, while ToT needed roughly 100 model calls per puzzle.[5] The December 2024 Tree-of-Code paper takes a tree-shaped exploration into code generation: each node is a complete executable program, and whether it runs successfully decides whether the branch keeps growing.[6]
Result: Follow-up work moves toward more efficient search and clearer evaluation signals, such as code execution results.[5][6]

Try it today

  1. Take a question you usually ask for a single answer and rephrase it: "Propose three options, score each from 1 to 10 with a reason, then develop the highest-scoring one."
  2. Use this approach for work that involves comparing branches, such as quotes, schedules, or copy options, and keep ordinary prompts for simple classification or short fact lookups.[2]
  3. Split generating and judging into separate messages so the model first produces candidates and then evaluates them.
  4. Write down how many candidates you keep per step (breadth) and how many steps you go (depth), then compare settings such as 3, 5, and 7 candidates for quality, response time, and token cost.[2]
  5. Read the Game of 24 "propose" and "value" prompts in the official repository to see how the original generation and evaluation prompts are written.[3] Running the scripts requires your own OpenAI API key and incurs usage fees.[3]

Limits and direction

The paper's appendix reports that ToT needs much more computation than input-output or CoT prompting, and that depending on the prompts and search algorithm it can require 5 to 100 times more generated tokens than CoT.[2] For tasks GPT-4 already handled well with CoT, such as GSM8K math word problems, the gain was only slight, so the authors recommend ToT for tasks that require deliberate reasoning where CoT struggles.[2] The evaluation step is also an imperfect heuristic: in the crossword experiment, the model sometimes judged correct but rare words "impossible" and pruned them, and the authors note that better pruning heuristics are critical.[2] Even the published code reproduced the Game of 24 run at 69% rather than 74% because of randomness in model decoding.[3] Follow-up work addresses the cost by having the model write search code instead of judging every step.[5]

Two directions are visible. One is reasoning models that learn exploration during training: OpenAI described o1 (September 2024) as trained with reinforcement learning to use a long internal chain of thought, recognize mistakes, and try a different approach when one is not working.[7] The other extends ToT-style tree search into code generation and planning, where execution results or generated code provide clearer evaluation signals.[5][6] In practice, it is worth testing whether a reasoning model or a simple prompt already handles your task before building a custom ToT pipeline.

The first practice step is a lightweight candidate-comparison exercise; a full ToT system also needs explicit intermediate states and a search procedure.

Which concepts are related to Tree of Thoughts?

  • Similar concept
    Prompt VersionA related concept often discussed alongside prompt and AI practice.
  • Similar concept
    Prompt LibraryA related concept often discussed alongside prompt and AI practice.
  • Similar concept
    Persona PromptingA related concept often discussed alongside prompt and AI practice.

Which sources explain Tree of Thoughts?

  1. Yao et al. (Princeton University, Google DeepMind) — Tree of Thoughts: Deliberate Problem Solving with Large Language Models (arXiv 2305.10601, 2023-05-17) — https://arxiv.org/abs/2305.10601
  2. Yao et al. — Tree of Thoughts, NeurIPS 2023 proceedings paper with appendix (2023-12) — https://proceedings.neurips.cc/paper_files/paper/2023/file/271db9922b8d1f4dd7aaef84ed5ac703-Paper-Conference.pdf
  3. Princeton NLP — princeton-nlp/tree-of-thought-llm, official code and prompts repository (GitHub) — https://github.com/princeton-nlp/tree-of-thought-llm
  4. IBM Think — What is tree of thoughts prompting? (2024-08-15) — https://www.ibm.com/think/topics/tree-of-thoughts
  5. Katz, Kokel, Srinivas, Sohrabi (IBM Research) — Thought of Search: Planning with Language Models Through the Lens of Efficiency (arXiv 2404.11833, NeurIPS 2024) — https://arxiv.org/abs/2404.11833
  6. Tree-of-Code: A Tree-Structured Exploring Framework for End-to-End Code Generation (arXiv 2412.15305, 2024-12) — https://arxiv.org/abs/2412.15305
  7. OpenAI — Learning to reason with LLMs (2024-09-12) — https://openai.com/index/learning-to-reason-with-llms/