← AI Terminology

Tree of Thoughts

Tree of Thoughts (ToT) is a prompting and inference framework that extends chain-of-thought by allowing LLMs to explore multiple reasoning paths simultaneously — maintaining a tree of partial solutions, evaluating them, and using search strategies (BFS, DFS, beam search) to find the most promising path to a solution.

It dramatically improves performance on complex multi-step reasoning tasks.
Why It Matters in AI
Chain-of-thought generates one reasoning path and commits to it — if the path is wrong, there's no recovery. Tree of Thoughts enables deliberate exploration: generate multiple candidate next steps, evaluate which are most promising, continue the best, backtrack from dead ends. This is how humans solve hard problems — trying multiple approaches, abandoning unproductive ones. ToT showed 74% success on the "Game of 24" where standard CoT achieved 4% — a dramatic demonstration of the value of search in reasoning.
Key Points
Aspect Description
vs CoT CoT: single linear chain; ToT: branching tree with evaluation and backtracking
Thought A coherent reasoning step that is evaluated independently — may be a sentence, paragraph, or calculation
Evaluator LLM (or separate model) scores each thought: promising / uncertain / impossible
Generator LLM proposes k candidate next thoughts given the current state
Tree structure Root = problem; nodes = partial reasoning states; leaves = terminal answers
Search algorithm BFS: explore all thoughts at depth d before d+1; DFS: explore one path deeply then backtrack
Simple Analogy
A chess player considering multiple moves: instead of playing the first decent-looking move (CoT), they mentally simulate several candidate moves, evaluate the resulting board state, follow the most promising line further, and backtrack from losing positions. ToT gives LLMs this look-ahead ability for any reasoning task.
Common Usage Examples
  • ToT paper: Yao et al. 2023 — "Tree of Thoughts: Deliberate Problem Solving with Large Language Models"
  • Game of 24: ToT with BFS achieves 74% vs 4% for standard prompting — canonical ToT benchmark
  • LangChain: TreeOfThoughtChain(thoughts_per_step=5, max_steps=4, search="bfs") — ToT implementation
  • tree_of_thoughts Python library: pip install tree-of-thoughts; ToTAgent(model=llm, branching=3)
  • Practical use: ToT for code debugging — generate multiple fix hypotheses, test each, keep successful
Summary
In short: Tree of Thoughts extends chain-of-thought by exploring multiple reasoning paths simultaneously and using search to find the best — enabling LLMs to backtrack and try alternatives on hard reasoning tasks, dramatically improving performance where single-path reasoning fails.