Lesson 4 +15 XP

Chain-of-Thought (CoT) & Step-by-Step Reasoning

When humans solve complex logic puzzles or math problems, we write down intermediate steps. LLMs work better when forced to do the exact same thing!

What is Chain-of-Thought (CoT)?

Chain-of-Thought prompting asks the LLM to break down its reasoning into intermediate steps before giving a final answer.

💡 Tip

> The Magic Trigger Phrase: Adding "Let's think step by step" to a prompt forces the model to generate intermediate reasoning tokens, boosting accuracy on complex tasks by up to 50%!

Example Comparison

❌ Direct Prompting:

"A store has 15 apples. They sell 4 on Monday and double their stock on Tuesday. How many apples do they have?" AI might jump to an incorrect mental math estimate.

✅ Chain-of-Thought Prompting:

"Solve this problem step by step:

  1. Start with initial count.
  1. Subtract Monday sales.
  1. Double remaining count for Tuesday.
  1. State the final total."*

Self-Consistency Technique

For critical calculations or logic puzzles, ask the AI to generate 3 independent reasoning chains and take the majority consensus answer!