Back to Docs
Prompt Engineering

Tree of Thought Prompting

Explore multiple reasoning paths simultaneously, evaluate each branch, and converge on the optimal solution — all within a single prompt structure.

What It Is

Tree of Thought (ToT) prompting instructs the model to generate several candidate reasoning steps at each decision point, critique them, and select the most promising branch before proceeding. This mimics human deliberation — brainstorming options, weighing tradeoffs, then committing.

When to Use

  • Complex planning tasks with branching decisions
  • Creative writing where multiple plot directions exist
  • Mathematical proofs requiring exploration of lemmas
  • Strategy games, puzzle solving, or optimization problems

Template

# Tree of Thought Prompt

Problem: [describe problem]

For each step:

1. Generate 3 distinct possible next steps.

2. Evaluate each — pros, cons, feasibility (1-10).

3. Select the best step and explain why.

4. Continue from that step. Repeat until solved.

Present final answer with the full tree trace.

Example

Problem:

Plan a 3-day trip to Tokyo with a $500 budget.

Step 1 candidates:

A) Book capsule hotel ($30/night) — score 8

B) Couchsurfing (free) — score 6 (unreliable)

C) Airbnb split with friend — score 7

→ Selected A: reliable, cheap, central.

Pro Tip

Combine ToT with chain-of-thought by asking the model to verbalize its evaluation criteria before scoring each branch. This surfaces hidden assumptions and improves branch selection quality.