Chain of Thought (CoT)
Make AI show its reasoning process
đź§ What is Chain of Thought?
Chain of Thought prompting asks the AI to "think step-by-step" and show its reasoning before giving the final answer. This dramatically improves accuracy on complex problems.
❌ Without CoT:
Q: If 5 machines make 5 widgets in 5 minutes, how long for 100 machines to make 100 widgets?
A: 100 minutes ❌ (Wrong!)
âś… With CoT:
Q: Let's think step-by-step. If 5 machines make 5 widgets in 5 minutes...
1. Each machine makes 1 widget in 5 min
2. 100 machines each make 1 widget in 5 min
3. Total time = 5 minutes
A: 5 minutes âś…
📝 How to Trigger CoT
Simple! Just add one of these phrases to your prompt:
⚡ CoT Best Practices (Google's Rules)
Put Answer AFTER Reasoning
The AI must generate the reasoning first, then the final answer. This changes which tokens the model sees when predicting the answer.
PROMPT: "Solve 15% of 80. Show your work, then give the final answer."
Set Temperature to 0
CoT uses greedy decoding (picks highest probability). Since there's usually ONE correct answer, use temperature=0 for deterministic results.
Config: temperature = 0 (always for CoT reasoning)
Extract Final Answer Separately
Structure your output so you can parse the final answer from the reasoning.
Reasoning: [steps...]
Final Answer: 12
🎯 Real-World Example
Indian business calculation with CoT:
PROMPT:
"A shop sold 120 items on Monday at ₹50 each with 18% GST. On Tuesday, they gave 15% discount on same items but sold 150 units. Let's think step-by-step: what was their total revenue (including GST) over both days?"
AI RESPONSE (with CoT):
Step 1: Monday revenue
• Base price: ₹50 × 120 = ₹6,000
• GST (18%): ₹6,000 × 0.18 = ₹1,080
• Monday total: ₹6,000 + ₹1,080 = ₹7,080
Step 2: Tuesday revenue
• Discounted price: ₹50 × 0.85 = ₹42.50
• Base revenue: ₹42.50 × 150 = ₹6,375
• GST (18%): ₹6,375 × 0.18 = ₹1,147.50
• Tuesday total: ₹6,375 + ₹1,147.50 = ₹7,522.50
Step 3: Total over both days
• ₹7,080 + ₹7,522.50 = ₹14,602.50
Final Answer: ₹14,602.50
🎓 When to Use CoT
âś… Perfect For:
❌ Not Needed For:
🎓 Key Takeaways
Chain of Thought = asking AI to show step-by-step reasoning
Dramatically improves accuracy on complex problems
Always set temperature to 0 for CoT reasoning
Put final answer AFTER the reasoning steps
Use phrases like 'Let's think step-by-step'
Best for math, logic, and multi-step problems
Not needed for simple questions or creative tasks
Module 6 of 10 Complete