Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Prompting for Reasoning  ›  Lesson

Tree of Thoughts

Tree of Thoughts (ToT) Prompting 14 minTree of thoughts has the model propose several partial ideas, judge them, and expand only the promising ones, backtracking from dead ends.

Tree of Thoughts

Saturday at Spoke & Chain: six repair jobs, two mechanics, eight hours each, and a few customers who need their bikes back by noon. Asked to "plan the day step by step", the model assigned the longest job first to the wrong mechanic, then spent every later step patching around that choice. A single chain of reasoning cannot go back. A tree can.

The rule

Branch, judge, prune — and back up from dead ends.

Tree of thoughts (ToT) treats problem-solving as a search. Instead of writing one line of reasoning from start to finish, the model:

  1. Branches — proposes several different next steps, or "thoughts", from the current state.
  2. Judges — evaluates each one: promising, uncertain, or a dead end.
  3. Prunes — keeps only the best few and expands those further.
  4. Backtracks — if every branch below a choice fails, returns to an earlier point and tries another.

Chain-of-thought is a single path. Self-consistency is several independent paths, compared only at the end. Tree of thoughts compares partial paths along the way and steers toward the good ones.

In practice, ToT is usually run by a small program that calls the model many times — one call to propose options, another to rate them — and keeps track of the tree. A lighter version fits in a single prompt: ask the model to list options, rate each against the constraints, and continue only from the best.

Constraints: 2 mechanics x 8 hours. Jobs (hours): wheel build 4,
full service 3, gear tune 1, brake bleed 2, puncture 0.5, fork service 3.
Puncture and gear tune are promised by noon.

Step 1: Propose three different ways to assign the three longest jobs.
Step 2: Rate each against the hours and the noon promises.
Step 3: Expand only the best one; if it fails, return to the next best.

The shortcut

Use ToT when an early choice can ruin everything after it and you can judge a partial solution. Scheduling, puzzles and design trade-offs qualify; a one-step classification does not.

Branching the Saturday scheduleStep 1 of 4
  1. Branch

    Option A: Mechanic 1 does the wheel build, Mechanic 2 the full service and fork service. Option B: Mechanic 1 does the wheel build and fork service; Mechanic 2 does the full service and brake bleed, then the small jobs. Option C: both start with the promised small jobs.

The cost is high: many model calls per problem. Reserve ToT for genuinely branching problems where a wrong early turn is expensive.

Drills

Answer fast — trust the rule.

quick drill

What can tree of thoughts do that a single chain of thought cannot?

quick drill

How does ToT differ from self-consistency?

quick drill

Which problem is the best fit for tree of thoughts?

quick drill

In the Saturday example, how many hours does Mechanic 2 work in the expanded option A plan?

Remember

  • Branch, judge, prune — and back up from dead ends.
  • Shortcut: use ToT when an early choice can ruin the rest and partial plans can be judged.
  • Trap: paying for a tree search on problems a single pass solves.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainGrow and prune

Describe how you would use tree of thoughts to plan a weekend repair schedule that fits six jobs into two mechanics' time, and explain why a single chain of thought might fail here.