Advanced Reasoning Strategies / Multi-Path Reasoning

Tree of Thought

Expert [5/5]
ToT Tree-of-Thoughts prompting Deliberative reasoning

Definition

Tree of Thought (ToT) extends chain-of-thought by exploring multiple reasoning paths simultaneously in a tree structure. At each step, the model generates several possible "thoughts," evaluates them, and decides which branches to pursue further.

This enables deliberate problem-solving with lookahead and backtracking, similar to how humans approach complex puzzles.

Key Concepts

  • Thought generation: Produce multiple candidate reasoning steps
  • State evaluation: Assess progress toward solution at each node
  • Search algorithm: BFS or DFS to explore the thought tree
  • Backtracking: Abandon poor paths and try alternatives

Examples

Visual Structure
ToT for Game of 24
Problem: Use 4, 5, 6, 10 to make 24 (using +, -, *, /) [4, 5, 6, 10] │ ┌───────────────┼───────────────┐ │ │ │ [10-4=6] [5*4=20] [6+4=10] [5,6,6] [6,10,20] [5,10,10] │ │ │ evaluate evaluate evaluate "promising" "promising" "less promising" │ │ ┌────┴────┐ ┌────┴────┐ │ │ │ │ [6*6=36] [6-5=1] [20+10=30] [20-6=14] [5,36] [6,1] [6,30] [10,14] │ │ │ │ "too high" "stuck" "close!" "stuck" │ [30-6=24] ✓ Solution: (5*4) + 10 - 6 = 24? No... Actually: 10 * 6 / (5 - 4) = 60... backtrack Try: 4 * 6 = 24, but need to use 5 and 10... Final: (10 - 4) * (6 - 5) * 4? No... (10 - 6) * (5 + 4) - 4 - 5... exploring...
Implementation
ToT Algorithm
def tree_of_thought(problem, model, breadth=3, depth=4): # Initialize with problem state root = ThoughtNode(state=problem, parent=None) frontier = [root] for step in range(depth): candidates = [] for node in frontier: # Generate multiple thoughts thoughts = model.generate_thoughts( node.state, n=breadth ) for thought in thoughts: # Evaluate each thought new_state = apply_thought(node.state, thought) score = model.evaluate_state(new_state) child = ThoughtNode( state=new_state, parent=node, score=score ) candidates.append(child) # Select best candidates to continue frontier = select_top_k(candidates, k=breadth) # Check for solution for node in frontier: if is_solution(node.state): return reconstruct_path(node) return best_partial_solution(frontier)

Interactive Exercise

Design a Thought Tree

Sketch a tree of thought for this problem:

Problem: "Arrange these words to form a valid sentence: [dog, the, brown, runs, quickly]"

Pro Tips
  • Best for problems requiring exploration (puzzles, planning)
  • Breadth parameter controls exploration vs exploitation
  • State evaluation is crucial—design good heuristics
  • Consider computational cost: ToT is much more expensive than CoT

Related Terms