Skip to the workspace
Pebellslearn by building
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.

prompt engineering / Tree of Thoughts

Explore each scene at your own pace.

01 · The rule

The rule

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.
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.