Chain-of-Thought Prompting
Chain-of-Thought Prompting
Chain-of-Thought (CoT) prompting is a technique that dramatically improves AI performance on complex reasoning tasks by forcing the model to think step-by-step before giving a final answer.
Research from Google DeepMind showed that CoT prompting improves accuracy on complex reasoning tasks by 40–70%. For math problems, logical puzzles, multi-step analysis, and strategic planning, it's the single most effective technique you can use.
The Core Idea
Without CoT, the model jumps straight to an answer — which works for simple questions but fails on complex ones because it skips intermediate reasoning steps.
With CoT, you instruct the model to show its work. By externalizing the reasoning process, the model catches errors it would otherwise skip over.
Without CoT: "What's the best pricing strategy for my SaaS product?"
→ Gets a generic list of pricing strategies
With CoT: "Think through this step by step:
1. First, identify what type of product this is and who the buyer is
2. Then, analyze the buyer's pain point intensity and ability to pay
3. Consider the competitive landscape and substitutes
4. Evaluate each major pricing model (per-seat, usage-based, flat-rate, freemium)
5. Finally, recommend the best model with specific price range justification
My product: [description]"
→ Gets a reasoned analysis with specific, justified recommendation
Three CoT Patterns
Pattern 1: Explicit Steps
The most common approach — tell the model the exact steps to follow:
"Analyze this investment opportunity step by step:
Step 1: Identify the market size and growth rate
Step 2: Assess the competitive moat
Step 3: Evaluate the founding team's qualifications
Step 4: Identify the top 3 risks
Step 5: Give an investment thesis in 2 sentences
Investment: [description]"
Pattern 2: "Think Before You Answer"
A simple but powerful phrase that triggers CoT behavior in modern models:
"Think carefully before answering. What are the potential unintended
consequences of implementing a 4-day work week at a 200-person software company?"
Other trigger phrases:
- "Let's think through this carefully"
- "Walk me through your reasoning"
- "Reason through this step by step"
- "Before giving your answer, consider [X], [Y], and [Z]"
Pattern 3: Verification Loop
Ask the model to solve a problem, then verify its own answer:
"Solve this problem: [problem]
After solving it, verify your answer by:
1. Checking if your logic is internally consistent
2. Testing it against an edge case
3. Stating your confidence level (0-100%) and why"
CoT for Code Debugging
CoT is especially powerful for debugging complex code:
"Here is my Python function that is supposed to [goal], but it [specific bug]:
[paste code]
Debug this step by step:
1. Trace through the code with input: [example input]
2. Identify where the logic diverges from what's expected
3. Explain why that causes the bug
4. Provide the corrected code
5. Add a comment explaining the bug to prevent future issues"
CoT for Decision Making
One of the most powerful applications — structured decision analysis:
"I need to decide between [Option A] and [Option B].
Think through this systematically:
1. Define the key criteria I should evaluate these on (consider: cost, time, risk, long-term impact)
2. Score each option on each criterion (1-10)
3. Weight the criteria by importance for my situation: [your context]
4. Calculate weighted scores
5. Make a recommendation with your top 3 reasons
Be direct with your recommendation — don't hedge."
Zero-Shot vs Few-Shot CoT
Zero-shot CoT: Simply adding "Let's think step by step" to any prompt. Surprisingly effective even without examples.
Few-shot CoT: Providing example reasoning chains before your actual question. More powerful for specialized domains.
Zero-shot: "Q: [question]. Let's think step by step."
Few-shot:
"Q: [example question]
A: First, I consider [reasoning step 1]. Then [reasoning step 2].
Therefore, the answer is [example answer].
Q: [your actual question]
A:"
When to Use CoT
| Task Type | Use CoT? | Why |
|---|---|---|
| Simple factual questions | No | Adds unnecessary complexity |
| Math/logic problems | Yes | Prevents arithmetic errors |
| Strategic decisions | Yes | Surfaces assumptions |
| Creative writing | No | Hurts flow and creativity |
| Code debugging | Yes | Traces execution logically |
| Complex analysis | Yes | Breaks down multifaceted problems |
Practice Exercise
Take a decision you're currently facing — a career choice, a business decision, a technical architecture question. Write a CoT prompt that walks through the decision systematically with 4-6 explicit steps. Compare this output to a simple "what should I do about X?" prompt.
The structured reasoning will reveal considerations you hadn't thought of. That's the power of CoT.
Get this course's notes on Telegram!
Free cheat sheets, summaries & practice exercises