---
title: "Tree-of-Thought Reasoning"
summary: "Expands a tree of candidate reasoning steps, scores partial states, prunes weak branches, and picks the best path instead of one linear chain"
status: "established"
category: "Orchestration & Control"
url: "https://agentic-patterns.com/patterns/tree-of-thought-reasoning"
source: "https://arxiv.org/abs/2305.10601"
authors: ["Nikola Balic (@nibzard)"]
tags: ["branching","deliberate-reasoning","search"]
signals: ["Complex planning, math, or code tasks where the first path often fails","A good evaluation function or external verifier exists","Task needs explicit backtracking"]
anti_signals: ["Simple linear tasks","Tight latency or token budget (explicit trees cost substantially more tokens than chain-of-thought)"]
updated_at: "2026-10-13"
---

# Tree-of-Thought Reasoning

> Expands a tree of candidate reasoning steps, scores partial states, prunes weak branches, and picks the best path instead of one linear chain

## Use when

- Complex planning, math, or code tasks where the first path often fails
- A good evaluation function or external verifier exists
- Task needs explicit backtracking

## Avoid when

- Simple linear tasks
- Tight latency or token budget (explicit trees cost substantially more tokens than chain-of-thought)

## Problem

Linear reasoning commits early to one path and can fail silently when intermediate assumptions are wrong. On complex planning or synthesis tasks, this causes premature convergence, weak recovery from mistakes, and missed alternatives that a broader search would discover.

## Solution

Explore a search tree of intermediate thoughts instead of a single chain. Generate multiple candidate continuations, score partial states, prune weak branches, and continue expanding the most promising paths until a stopping condition is met.

This turns reasoning into guided search: backtracking is explicit, branch quality is measurable, and the final answer can be chosen from competing candidates rather than the first trajectory.

The quality of the evaluation function significantly impacts performance—external verifiers (code execution, tests) outperform self-reflection scoring.

```pseudo
queue = [root_problem]
while queue:
    thought = queue.pop()
    for step in expand(thought):
        score = evaluate(step)
        queue.push((score, step))
    prune_weak_branches(queue)
select_best(queue)
```

## How to use it

Apply when tasks benefit from exploring many potential strategies—puzzles, code generation, or planning. Use heuristics or a value function to prune unpromising branches.

Algorithm variants: BFS for exhaustive exploration, DFS for deep paths with limited memory, Beam search for memory-constrained scenarios with good heuristics.

**Reasoning-model context (2024-2026):** RL-trained reasoning models such as OpenAI's o1 and its successors internalize much of this deliberate search at inference time ([Learning to Reason with LLMs](https://openai.com/index/learning-to-reason-with-llms/)). This pushes explicit ToT scaffolds toward verifier-guided work (where an external evaluator still prunes branches) and non-frontier models. See [Language Agent Tree Search (LATS)](language-agent-tree-search-lats.md) and [Inference-Time Scaling](inference-time-scaling.md).

## Trade-offs

* **Pros:** Covers more possibilities; improves reliability on hard search tasks (on Game of 24, the paper reports 4% accuracy for chain-of-thought prompting versus 74% for ToT); enables explicit backtracking from failed paths.
* **Cons:** Higher compute cost (substantially more tokens than chain-of-thought; the paper does not publish a token multiplier); needs a good evaluation function to guide search; inherently slower latency. Best for complex planning, mathematical reasoning, and code generation—overkill for simple linear tasks.

## References

* [Tree of Thoughts: Deliberate Problem Solving with Large Language Models](https://arxiv.org/abs/2305.10601) (Yao et al., 2023)
* [Self-Consistency Improves Chain of Thought Reasoning](https://arxiv.org/abs/2203.11171) (Wang et al., 2022) — foundational multi-path exploration method that ToT extends
* [Language Agent Tree Search](https://arxiv.org/abs/2310.04406) (Zhou et al., 2023) — extends ToT with MCTS and value backpropagation
* [Graph of Thoughts](https://arxiv.org/abs/2308.09687) (Besta et al., 2024) — generalizes ToT to arbitrary graph structures with thought aggregation
