๐Ÿš€
Prompting Techniques
Tree of Thoughts
Article Header Backdrop
Engineering

Tree of Thoughts (ToT) ๐ŸŒณ

Explore a powerful framework that generalizes over Chain-of-Thought, enabling LLMs to perform deliberate reasoning with lookahead and backtracking.

Mar 20268 min read
๐ŸŒ
References & Disclaimer

This content is adapted from Prompting Guide: Tree of Thoughts. It has been curated and organized for educational purposes on this portfolio. No copyright infringement is intended.

Introduction

For complex tasks that require strategic exploration or lookahead, traditional prompting techniques often fall short. Tree of Thoughts (ToT), proposed by Yao et al. (2023) (opens in a new tab) and Long (2023) (opens in a new tab), is a framework that encourages exploration over "thoughts" that serve as intermediate steps for problem-solving.


How it Works

ToT maintains a tree of thoughts, where each node represents a coherent language sequence serving as an intermediate step. This allows the model to:

  1. Self-Evaluate: The LLM assesses its own progress through these intermediate steps.
  2. Search Regionally: Combined with algorithms like BFS (Breadth-First Search) or DFS (Depth-First Search), the system can systematically explore different branches, look ahead, or backtrack when it hits a dead end.

Tree of Thoughts Framework Image Source: Yao et el. (2023)


The "Game of 24" Benchmark

A classic demonstration of ToT is the Game of 24, a mathematical puzzle where the goal is to use four numbers and basic arithmetic to reach 24.

While standard Chain-of-Thought (CoT) often fails this task, ToT succeeds by decomposing the problem into 3 steps. At each step, the model evaluates potential candidates as "sure / maybe / impossible" and only proceeds with the most promising "maybe" or "sure" paths.

ToT Process in Game of 24 Image Source: Yao et el. (2023)

Performance Impact

As shown in the researchers' results, ToT substantially outperforms standard prompting and CoT in complex reasoning benchmarks:

ToT Performance Comparison Image Source: Yao et el. (2023)


Single-Prompt Alternative: Three Experts

For those who don't want to implement a full tree-search infrastructure, Hulbert (2023) (opens in a new tab) proposed a clever "single-prompt" version that mimics the ToT process:

๐Ÿง 

Sample ToT Prompt:
"Imagine three different experts are answering this question. All experts will write down 1 step of their thinking, then share it with the group. Then all experts will go on to the next step, etc. If any expert realizes they're wrong at any point then they leave. The question is..."

This "mental committee" approach forces the model to simulate the evaluation and elimination process within a single generation.


[!TIP] Tree of Thoughts represents the peak of deliberate reasoning. For tasks involving real-time interaction with external tools, the ReAct Framework is the next logical step.

ยฉ 2026 Driptanil Datta. All rights reserved.

Software Developer & Engineer

Disclaimer:The content provided on this blog is for educational and informational purposes only. While I strive for accuracy, all information is provided "as is" without any warranties of completeness, reliability, or accuracy. Any action you take upon the information found on this website is strictly at your own risk.

Copyright & IP:Certain technical content, interview questions, and datasets are curated from external educational sources to provide a centralized learning resource. Respect for original authorship is maintained; no copyright infringement is intended. All trademarks, logos, and brand names are the property of their respective owners.

System Operational

Built with Love โค๏ธ | Last updated: Mar 16 2026