← Lessons

quiz vs the machine

Platinum1880

Machine Learning

The Tree Of Thoughts

How exploring branching reasoning paths and pruning weak ones beats a single chain.

5 min read · advanced · beat Platinum to climb

From a line to a tree

A chain of thought walks one reasoning path. Tree of thoughts instead branches: at each step the agent generates several candidate next thoughts, scores them, and explores the promising ones, like a search over ideas.

How it runs

  • Expand: from the current node, propose a few different next steps.
  • Evaluate: score each candidate for how likely it leads to a good answer.
  • Select: keep the top branches and prune the rest.
  • Repeat down the tree until a branch reaches a solution.

This is a deliberate search, often breadth first or with a value heuristic, rather than committing to the first idea.

Why it wins

  • Hard puzzles have dead ends; branching lets the agent back out.
  • Scoring partial paths catches bad directions early.
  • Diversity at each step raises the chance one path works.

The cost

Every branch is more model calls, so the tree grows expensive fast. Tight pruning and a shallow depth keep it affordable. Tree search helps most on problems with clear intermediate checks, such as math or planning puzzles.

Key idea

Tree of thoughts turns reasoning into a search that branches into several candidate steps, scores them, and prunes weak paths, which solves puzzles a single chain cannot but costs many more model calls.

Check yourself

Answer to earn rating on the learn ladder.

1. How does tree of thoughts differ from a single chain of thought?

2. What is the main cost of tree of thoughts?