I · ReasoningEmerging

Tree of Thoughts

also known as ToT, Deliberate Reasoning

Search over a tree of partial reasoning states with explicit lookahead, evaluation, and backtracking.

This pattern helps complete certain larger patterns —

  • specialisesChain of Thought★★Elicit multi-step reasoning by prompting the model to produce intermediate steps before its final answer.
  • specialisesGraph of Thoughts·Model reasoning as an arbitrary DAG so thoughts can be merged, refined, and aggregated across branches.

Context

A team is solving problems where it pays to consider several candidate next moves before committing to one: small puzzles such as Game of 24 or crosswords, short-horizon planning tasks, or creative writing where opening choices constrain everything that follows. They have already tried plain chain-of-thought and observed that once an early step is wrong, the rest of the chain compounds the mistake instead of recovering.

Problem

Chain-of-thought produces a single linear reasoning trace and never reconsiders. If the first decision is wrong, the model has no machinery to back up, compare that decision against alternatives, or prune dead-end branches. It cannot weigh several candidate moves against each other at any node, which is exactly what is needed on tasks where the best opening is not obvious. The team needs explicit search vocabulary — lookahead, evaluation, backtracking — layered on top of reasoning so the model can recover from wrong commitments.

Forces

  • Search costs many model calls per problem.
  • A value or heuristic function is needed to score partial states.
  • Termination criteria are non-trivial.

Example

A puzzle-solving agent using chain-of-thought commits to its first reasoning trace; when an early step is wrong it cannot recover. The team rebuilds it as Tree of Thoughts: at each node the model samples several candidate next thoughts, evaluates each (model self-eval or programmatic check), and BFS or beam-explores the tree, backtracking from dead ends. Per-problem cost is higher but solve-rate on the harder puzzle class climbs because the agent can compare and unwind.

Diagram

Solution

Therefore:

Decompose the problem into thought steps. At each node, sample several candidate next thoughts. Evaluate each (model self-evaluation or programmatic check). Apply BFS/DFS/beam to explore the tree. Backtrack from dead ends. Return the best leaf.

What this pattern forbids. The agent may only commit to a final answer after exploring at least one full path; search depth and branching are bounded by configuration.

The smaller patterns that complete this one —

And the patterns that stand alongside it, or against it —

  • alternative-toAdaptive Branching Tree Search·At each node of an inference-time search tree, use Thompson sampling to decide whether to deepen an existing answer or branch a fresh attempt, optionally choosing per-node which underlying LLM to invoke.
  • complementsWorld Model as Tool·Let a planning agent invoke a generative world model as a tool to roll out hypothetical futures before committing to an action, treating the world model as a callable simulator rather than a training target.
  • alternative-toSingle-Path Plan Generator★★Generate one linear sequence of intermediate steps from current state to goal — the lightweight planning alternative to tree-of-thoughts and multi-path generation.
  • complementsMulti-Path Plan Generator★★Generate multiple candidate next-steps at each plan node enabling later selection — the planning generator pattern paired with tree-of-thoughts / LATS-style search.
  • complementsLatent-Space Reasoning·Let the model reason in continuous hidden-state space instead of decoding each step to text, feeding the last hidden state back as the next input embedding, so one latent step can hold several continuations.

Neighbourhood

Click any neighbour to follow the language. Scroll to zoom, drag to pan.