P

Tree Of Thought: Definition and Examples

Tree of Thought (ToT) is an advanced prompting technique that allows a language model to explore multiple reasoning paths in parallel, in a tree-like structure, before selecting the most relevant solution.

Full definition

Tree of Thought (ToT) is a prompting method inspired by human problem-solving processes. Unlike classic Chain of Thought, which follows a linear step-by-step reasoning, ToT allows the model to simultaneously explore multiple lines of thought, evaluate them, and backtrack if a branch proves unproductive.

Specifically, the model generates multiple intermediate 'thoughts' at each reasoning step, forming a tree of possibilities. Each node represents a partial state of reasoning, and the model can evaluate the promise of each branch before deciding which to pursue. This exploration and self-evaluation mechanism mirrors the human ability to consider different approaches to a complex problem.

This technique was formalized in 2023 by researchers at Princeton and Google DeepMind (Yao et al.) in their paper "Tree of Thoughts: Deliberate Problem Solving with Large Language Models." Their work demonstrated significant improvements on tasks requiring planning, strategic search, and decision-making, such as the 24 game, creative writing, and logic puzzles.

ToT can be implemented in two main ways: through carefully crafted prompts that explicitly ask the model to explore multiple branches, or via an external framework that orchestrates model calls using search algorithms like BFS (breadth-first search) or DFS (depth-first search). This flexibility makes it a powerful tool for tasks where a direct answer would be insufficient.

Etymology

The term "Tree of Thought" is a direct extension of "Chain of Thought" introduced by Wei et al. in 2022. The analogy moves from a chain (linear structure) to a tree (branched structure), reflecting the shift from sequential reasoning to multi-branch exploratory reasoning. The concept is also inspired by search trees used in computer science (decision trees, minimax algorithms) and cognitive science.

Concrete examples

Solving a complex math problem requiring multiple approaches exploration

I want to solve this problem: [PROBLEM]. Generate 3 different approaches to solve it. For each approach, develop the reasoning over 2-3 steps. Then evaluate each approach (promising, uncertain, or impossible) and continue only the most promising one until the final solution.

Strategic business decision-making with multiple options to evaluate

Our startup must choose between 3 growth strategies: [A, B, C]. For each strategy, explore the consequences at 6 months and 18 months considering risks and opportunities. Evaluate each branch on cost, feasibility, and impact criteria. Recommend the best option, justifying why the others were discarded.

Creative writing where multiple narrative directions are possible

I am working on a short story whose beginning is: [EXCERPT]. Propose 3 different narrative directions for the rest. For each, develop a continuation paragraph. Evaluate which creates the most dramatic tension and coherence with the beginning, then develop that direction in 500 words.

Practical usage

To apply Tree of Thought in your prompts, explicitly ask the model to generate multiple reasoning paths before converging on an answer. Structure your prompt in three phases: exploration (generate N approaches), evaluation (rate each approach by specific criteria), and selection (deepen the best branch). This technique is particularly effective for logic problems, strategic planning, and creative tasks where the first intuition is not always the best.

Related concepts

Chain of ThoughtSelf-ConsistencyGraph of ThoughtPrompt Chaining

FAQ

What is the difference between Chain of Thought and Tree of Thought?
Chain of Thought (CoT) guides the model along a single linear reasoning path, step by step. Tree of Thought (ToT) explores multiple paths simultaneously and allows the model to backtrack to try another branch if a path proves unfruitful. ToT is therefore more suitable for complex problems where the first approach is not necessarily the right one.
Can Tree of Thought be used with any language model?
Tree of Thought works best with large models capable of self-evaluation (like Claude, GPT-4, or Gemini). Smaller models may struggle to correctly assess the quality of their own intermediate reasoning. However, ToT can be implemented via an external framework that orchestrates calls, making it usable with less powerful models.
Does Tree of Thought consume more tokens than a standard prompt?
Yes, ToT consumes significantly more tokens because it generates multiple reasoning branches instead of one. The token cost is generally multiplied by the number of branches explored. It is therefore recommended to reserve this technique for problems complex enough to justify the extra cost, and to limit the number of branches and exploration depth according to the available budget.

See also

How to use this prompt

  1. Copy the prompt with the button above.
  2. Paste it into ChatGPT, Claude or your favorite AI assistant.
  3. Replace the bracketed variables with your details, then refine the result.

About Prompt Guide

Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.

More definitions

Get new prompts every week

Join our newsletter.