Back to Glossary
Prompting

Tree of Thoughts

Definition

Tree of Thoughts (ToT) extends chain-of-thought by exploring multiple reasoning paths in parallel, allowing the model to consider different approaches and backtrack from dead ends.

Why It Matters

Some problems have multiple possible approaches, and the first path might not be the best. Tree of Thoughts enables the model to explore alternatives, evaluate intermediate states, and backtrack when a path seems unpromising. This mimics how humans solve complex problems through exploration and revision.

How It Works

ToT structures problem-solving as a tree:

  1. Generate multiple possible next steps (branches)
  2. Evaluate each branchโ€™s promise
  3. Expand the most promising branches
  4. Backtrack if a path reaches a dead end
  5. Continue until reaching a solution

This can be implemented through prompting patterns or explicit tree search algorithms.

When to Use

Use Tree of Thoughts for: problems with multiple valid approaches, creative tasks requiring exploration, puzzles and games (like 24, crosswords), tasks where initial approaches often fail, and when you can afford higher compute costs. For straightforward problems, simpler techniques are more efficient.

Source

Tree of Thoughts enables exploration of coherent text generation with language models by considering multiple reasoning paths and self-evaluating choices.

https://arxiv.org/abs/2305.10601