🎯 Core Goals
- Understand the power of examples in prompting.
- Learn why 2-3 examples are better than 10 paragraphs of text.
Explaining what you want is good. Showing the AI exactly what you want is 10x better. Providing just two or three examples can solve almost any formatting or tone problem!
👁️ Visuals & Interactives
Show, Don't Just Tell
See how adding examples (Few-Shot) fixes messy formatting instantly.
Zero-Shot
Prompt:
Convert these dates to MM/DD/YYYY:
- Jan 5
- March 21
Convert these dates to MM/DD/YYYY:
- Jan 5
- March 21
AI Output:
- 01/05/2024
- 03/21/24 (Inconsistent!)
- 01/05/2024
- 03/21/24 (Inconsistent!)
double_arrow
Few-Shot
✨ 10x More Reliable
Prompt:
Convert to MM/DD/YYYY:
- Jan 5 -> 01/05/2024
- March 21 -> 03/21/2024
- Dec 1 ->
Convert to MM/DD/YYYY:
- Jan 5 -> 01/05/2024
- March 21 -> 03/21/2024
- Dec 1 ->
AI Output:
- 12/01/2024 (Perfect!)
- 12/01/2024 (Perfect!)
lightbulb
Why it works: LLMs are pattern-matching engines. By giving 2-3 examples, you create a pattern for the AI to follow, which is much more effective than long text instructions.
📝 Key Concepts
- Zero-Shot: Just instructions, no examples. (e.g., “Convert dates to MM/DD/YYYY”)
- Few-Shot: Instructions + 2-3 examples of the desired pattern. (e.g., “January 5th -> 01/05/2024. March 21st -> 03/21/2024. Now convert: December 1st”)
- Pattern Matching Power: LLMs are incredibly good at mimicking the exact tone, structure, and logic of your examples (as we saw when we explored building intuition).
Rule of thumb: 2-3 examples is usually enough. Adding more than 5 often yields diminishing returns and wastes tokens!
🧠
QUIZ
What's the most effective way to get an LLM to match a specific output format?
Write a detailed paragraph describing exactly what you want
Provide 2-3 examples of the desired output
Use more technical vocabulary in your instructions