RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Prompt Engineering Fundamentals
  6. /Ch. 15
Prompt Engineering Fundamentals

15. Tree-of-Thought

Chapter 15 of 25 · 15 min
KEY INSIGHT

Branching explicitly at reasoning decision points rather than at output planning points determines whether ToT produces genuinely diverse explorations or apparent parallelism. ```python prompt = """Problem: [USER_PROBLEM] Generate THREE distinct solution approaches. For each approach: 1. State initial assumptions 2. Show 2 reasoning steps 3. Identify the strongest evidence for this path 4. Identify the strongest evidence against this path After presenting all approaches, select the strongest one and explain why alternative approaches were rejected. Output format: APPROACH A: [name] REASONING: ... EVIDENCE FOR: ... EVIDENCE AGAINST: ... [repeat for B and C] FINAL SELECTION: [A/B/C] RATIONALE: [2-3 sentences] ---""" ``` **Failure mode:** Generating branches without evaluation criteria produces three plausible-sounding answers with no mechanism for selection. The model defaults to majority-mention selection, which correlates weakly with actual solution quality. ```python # This ToT variant commonly produces incoherent synthesis prompt = """ Consider multiple perspectives. Option 1: ... Option 2: ... Option 3: ... What do you think?" """ # Consistent ToT variant includes explicit evaluation prompt = """ Consider these three approaches against CRITERIA: - Criteria 1: Factual accuracy under scrutiny - Criteria 2: Practical implementability - Criteria 3: Alignment with stated user constraints [three approaches] SYNTHESIS: For each criterion, identify which approach scores highest. Recommend the approach with majority criterion wins.""" ``` Tested with GPT-4o on optimization problems, ToT with explicit criteria outperformed chain reasoning by 23% on benchmark tasks (HumanEval, MATH). ToT without criteria matched chain reasoning performance within margin of error.

Tree-of-Thought (ToT) prompting extends chain reasoning by exploring multiple solution branches simultaneously. Where chain reasoning commits to one path, ToT maintains parallel considerations and selects the strongest path after evaluation.

The mechanism uses explicit branching markers and evaluation criteria defined before reasoning begins. Each branch generates intermediate states that undergo criterion-based pruning before final synthesis.


EXERCISE

Implement ToT reasoning for a customer service escalation decision. Define three branching paths based on customer sentiment (negative/neutral/positive), generate reasoning steps for each, and write evaluation criteria for selecting the final response. Test with 5 customer scenarios.

← Chapter 14
Model-Specific: DeepSeek
Chapter 16 →
Self-Consistency