Few-Shot Chain-of-Thought Prompting
What you'll learn: How to teach a language model to reason systematically by providing examples that include step-by-step reasoning traces.
The Core Idea
Few-Shot Chain-of-Thought (CoT) prompting combines two powerful techniques we've already learned: few-shot prompting (showing examples) and chain-of-thought reasoning (step-by-step thinking). Instead of just showing input-output pairs, you provide examples that include the reasoning process.
Think of it like showing a student not just the answer to a math problem, but the complete worked solution. When you then present a new problem, the student learns to apply the same reasoning pattern.
How It Works
The prompt structure includes:
- Task instruction (what you want)
- Examples with reasoning traces (input → reasoning steps → output)
- The actual query (the new problem to solve)
For instance, teaching arithmetic reasoning:
Question: A baker made 15 cookies. He sold 7. How many remain?
Let's think step by step:
- The baker started with 15 cookies
- He sold 7 cookies
- To find what remains: 15 - 7 = 8
Answer: 8 cookies
Question: A store had 32 apples. They got 18 more. How many total?
The model learns to mimic the reasoning structure from your examples, breaking down the new problem systematically.
Why It's Powerful
Few-shot CoT dramatically improves performance on complex reasoning tasks compared to standard few-shot prompting or zero-shot CoT alone. The examples serve as templates, teaching the model how to think through problems in your specific domain.
Key Takeaway: Few-shot chain-of-thought prompting teaches models reasoning patterns through examples that show both the thinking process and the answer, combining demonstration-based learning with explicit reasoning traces.