← Lessons

quiz vs the machine

Platinum1780

Machine Learning

Tree of Thoughts Deep Dive

Exploring multiple reasoning branches and searching for the best.

6 min read · advanced · beat Platinum to climb

Beyond a single chain

Chain of thought commits to one line of reasoning. Tree of Thoughts explores several at once. The agent generates multiple candidate next steps, evaluates each, and searches the tree for a promising path, backtracking when a branch looks weak.

Building blocks

  • Thought generation propose several candidate next steps from a state
  • State evaluation score how promising each candidate is
  • Search use breadth first or depth first traversal to expand good nodes
  • Backtracking abandon dead ends and return to a better branch

Searching the tree

Each node is a partial solution. The agent expands the most promising nodes, prunes weak ones, and stops when a leaf solves the task.

Cost versus quality

Exploring many branches multiplies model calls, so Tree of Thoughts is expensive. It pays off on puzzles where a single greedy chain often fails, such as planning games or constraint problems. For simple tasks the overhead is not worth it.

Key idea

Tree of Thoughts treats reasoning as search over branching thoughts, evaluating and backtracking to find strong paths at the cost of many more model calls.

Check yourself

Answer to earn rating on the learn ladder.

1. How does Tree of Thoughts differ from chain of thought?

2. What is the main cost of Tree of Thoughts?