Self-Consistency & Tree of Thoughts
Advanced techniques for complex reasoning
🔄 Self-Consistency
Instead of generating one answer, generate multiple reasoning paths and pick the most common answer. This reduces random errors.
How It Works:
Generate 5-10 different reasoning paths (set temperature > 0)
Each path reaches a final answer independently
Pick the answer that appears most frequently
Example Output (5 generations):
Path 1: Answer = 12 âś“
Path 2: Answer = 12 âś“
Path 3: Answer = 11
Path 4: Answer = 12 âś“
Path 5: Answer = 12 âś“
→ Final Answer: 12 (4 out of 5)
⚠️ Important Settings:
Set temperature = 0.7 to get diverse reasoning paths (unlike CoT which uses 0)
🌳 Tree of Thoughts (ToT)
For very complex problems, explore multiple solution branches like a decision tree, backtrack if needed, and find the best path.
ToT Process:
STEP 1: Generate Multiple Next Steps
→ Option A: Try method 1
→ Option B: Try method 2
→ Option C: Try method 3
STEP 2: Evaluate Each Option
• Option A: Seems promising ✓
• Option B: Dead end ✗
• Option C: Worth exploring ✓
STEP 3: Explore Best Options
Continue with A and C, backtrack on B
STEP 4: Repeat Until Solution
Keep branching and evaluating until you find the answer
âś… Best For:
- Complex strategic planning
- Game-playing (chess moves, etc.)
- Algorithmic problem-solving
- Creative brainstorming with evaluation
📊 Quick Comparison
| Technique | How It Works | Temperature | Complexity |
|---|---|---|---|
| CoT | 1 reasoning path | 0 | Low |
| Self-Consistency | Multiple paths, vote | 0.7 | Medium |
| Tree of Thoughts | Branch, evaluate, backtrack | 0.7 | High |
🎯 Decision Guide
Use CoT when:
You have straightforward multi-step problems with clear logic
Use Self-Consistency when:
You need higher accuracy and can afford multiple API calls
Use Tree of Thoughts when:
You have highly complex problems require exploring different solution strategies
🎓 Key Takeaways
Self-consistency = generate multiple answers, pick most common
Use temperature > 0 for diverse reasoning paths
Tree of Thoughts explores solution branches like a decision tree
CoT < Self-Consistency < ToT in complexity and accuracy
Higher techniques cost more (more API calls)
Choose based on problem complexity and accuracy needs
Module 7 of 10 Complete