The Power of "Show, Don't Tell"
You've probably heard the writing advice: "Show, don't tell." The same principle applies to prompting AI! Instead of describing what you want, you can SHOW the AI examples, and it will learn the pattern.
This is called Few-Shot Learning—teaching the AI by giving it a few examples.
Real-World Example: Instead of saying "write in a casual, friendly tone," you could show two examples of casual, friendly writing. The AI will match that exact style much better than following a description!
What is Few-Shot Learning?
Few-shot learning is a prompting technique where you provide examples of input-output pairs to demonstrate the pattern you want.
Few-Shot Learning Definition: A prompting technique where you teach the AI by showing it a few examples (usually 2-5) of what you want, rather than just describing it. The AI learns the pattern from your examples and applies it to new inputs, resulting in more consistent and accurate outputs.
The Three Types:
Zero-Shot vs Few-Shot vs Many-Shot
| Feature |
|---|
Zero-Shot Learning Definition: Asking the AI to perform a task without providing any examples, relying only on its training and your description. For example, "Summarize this article" with no example summaries. Zero-shot works well for common tasks the AI already understands.
Why Few-Shot Works So Well
AI models are trained on patterns. When you give examples, you're showing the AI exactly what pattern to follow. It's like:
- Zero-shot: "Cook me dinner" (vague)
- Few-shot: "Cook me dinner. Yesterday you made pasta with tomato sauce. Tuesday you made stir-fried vegetables with rice." (now the AI knows your style!)
Let's see this in action:
How to Write Effective Examples
Not all examples are created equal! Here's how to write examples that work:
Rule 1: Examples Should Be Similar to Your Target
❌ Bad Examples (Not Similar):
Convert this product feature to a customer benefit:
Example 1:
Feature: "Bluetooth 5.0"
Benefit: "Connect to devices"
Example 2:
Feature: "7-day battery life"
Benefit: "Never worry about charging during your week"
Example 3:
Feature: "50MP camera"
Benefit: "Pictures look good"
Now convert: "IP68 water resistance"
Problems:
- Example 1 is too vague
- Example 2 is perfect (good!)
- Example 3 is too simple
- Inconsistent quality confuses the AI
✅ Good Examples (Consistent Quality):
Convert this product feature to a customer benefit:
Example 1:
Feature: "7-day battery life"
Benefit: "Go an entire week without charging—perfect for busy professionals"
Example 2:
Feature: "50MP camera"
Benefit: "Capture every detail—print poster-sized photos without blur"
Example 3:
Feature: "5G connectivity"
Benefit: "Download movies in seconds—never wait for content again"
Now convert: "IP68 water resistance"
Why it works: Consistent format, consistent quality, consistent level of detail
Rule 2: Use 2-5 Examples (Sweet Spot)
Example Count Guide
| Feature |
|---|
Rule 3: Cover Edge Cases
If your task has variations, show examples of each:
Example: Sentiment Analysis
Classify the sentiment of customer reviews as Positive, Negative, or Neutral:
Example 1 (clearly positive):
Review: "This product changed my life! Best purchase ever."
Sentiment: Positive
Example 2 (clearly negative):
Review: "Broke after two days. Complete waste of money."
Sentiment: Negative
Example 3 (mixed/neutral):
Review: "It works fine, but nothing special. Average product."
Sentiment: Neutral
Example 4 (subtle negative):
Review: "I guess it's okay if you don't have high expectations."
Sentiment: Negative
Now classify: "Fast shipping, but the product itself is disappointing."
Why this works: Covers obvious cases AND edge cases (mixed reviews, subtle negativity)
Practical Examples by Use Case
Use Case 1: Data Formatting
Task: Convert addresses to a specific format
Use Case 2: Tone Matching
Scenario: You need the AI to match a specific writing style
❌ Without Examples:
Write a product description for noise-canceling headphones.
Make it casual and friendly.
✅ With Examples:
Write a product description in the same style as these examples:
Example 1 (Coffee maker):
"Your mornings just got 10x better. This little beauty brews
barista-quality coffee while you're still half-asleep. One button.
Perfect coffee. Every time."
Example 2 (Fitness tracker):
"Meet your new workout buddy. Tracks your steps, cheers you on,
and never judges you for that midnight snack. (We've all been there.)"
Example 3 (Bluetooth speaker):
"Tiny but mighty. This speaker punches way above its weight class.
Pool party? Check. Road trip? Check. Shower concert? Oh yeah."
Now write for: Noise-canceling headphones
The AI will match:
- Short, punchy sentences
- Casual, conversational tone
- Direct address ("you," "your")
- Personality and humor
- Benefit-focused, not feature-focused
Use Case 3: Code Generation with Specific Style
Common Mistakes and Fixes
Mistake 1: Too Many Examples
Problem:
[Provides 15 examples for a simple task]
Why it's bad:
- Wastes tokens (= higher cost)
- Slower responses
- Diminishing returns after 5-6 examples
Fix: Start with 2-3 examples. Only add more if needed.
Mistake 2: Inconsistent Examples
Problem:
Example 1: Very detailed, 3 paragraphs
Example 2: One sentence
Example 3: Medium detail
Why it's bad: AI doesn't know which style to match
Fix: Make all examples similar in length, detail, and quality
Mistake 3: Examples That Don't Match the Task
Problem:
Teaching AI to write emails, but examples are social media posts
Why it's bad: Different formats, different audiences, different conventions
Fix: Examples should be from the same domain as your task
Token Warning: Each example uses tokens from your context window! If you have a 4,000-token limit and use 1,500 tokens on examples, you only have 2,500 left for your prompt and the AI's response. Balance thoroughness with efficiency.
Advanced Few-Shot Patterns
Pattern 1: Progressive Difficulty
Show examples from simple to complex:
Extract the main topic from these sentences:
Example 1 (simple):
Sentence: "I love pizza."
Topic: Food
Example 2 (medium):
Sentence: "The new restaurant downtown serves amazing Italian food."
Topic: Food/Dining
Example 3 (complex):
Sentence: "After trying the new Italian place, I'm convinced that authentic
pizza requires a wood-fired oven and imported ingredients."
Topic: Food/Cooking/Quality
Now extract from: "Climate change affects global food supply chains."
Pattern 2: Chain of Thought in Examples
Show your reasoning:
Chain of Thought Definition: A technique where you show the AI your step-by-step reasoning process in examples, not just the final answer. This helps the AI understand how to think through problems logically and produce more accurate, explainable results for complex tasks.
Solve these word problems:
Example:
Problem: "Sarah has 5 apples. She gives 2 to John. How many does she have?"
Reasoning: Start with 5, subtract 2 that were given away
Answer: 3 apples
Example:
Problem: "A book costs $12. You buy 3 books. What's the total?"
Reasoning: Multiply unit price ($12) by quantity (3)
Answer: $36
Now solve: "Tom runs 3 miles per day. How far in a week?"
Pattern 3: Error Correction
Show what's wrong and what's right:
Fix grammatical errors in these sentences:
Example:
Wrong: "Me and him went to the store."
Right: "He and I went to the store."
Reason: Use "I" not "me" as subject
Example:
Wrong: "The data shows a trend."
Right: "The data show a trend."
Reason: "Data" is plural (datum is singular)
Now fix: "Between you and I, this seems wrong."
Interactive Few-Shot Builder
When to Use Few-Shot vs Zero-Shot
Choosing Your Approach
| Feature |
|---|
Test Your Understanding
Key Takeaways
🎯 Show, Don't Tell
- Examples are more powerful than descriptions
- 2-3 good examples > long explanations
- AI learns patterns from examples naturally
🎯 Quality Over Quantity
- 2-5 examples is usually optimal
- Keep examples consistent in quality and format
- Cover edge cases if your task has variations
🎯 When to Use Few-Shot
- Specific format or style needed
- Data transformation tasks
- Tone/voice matching
- Classification with multiple categories
🎯 Watch Your Tokens
- Each example uses tokens
- Balance thoroughness with efficiency
- Start with fewer examples, add more if needed
Practice Challenges
Challenge 1: Tone Matching Find 3 pieces of writing you like (emails, blog posts, etc.). Create a few-shot prompt that teaches the AI to match that exact tone. Test it!
Challenge 2: Data Formatting You have messy data (addresses, dates, names). Create a few-shot prompt that reformats it consistently. Start with 2 examples, test, then add a 3rd if needed.
Challenge 3: Creative Writing Write 2-3 examples of very short stories (2-3 sentences each) in a specific style. Then have the AI write another in the same style.
Next Level: Start a "Few-Shot Library" where you save your best example sets. When you create a great few-shot prompt for email writing, save it! Reuse successful patterns for similar future tasks.
What's Next?
In the next lesson, "Chain of Thought: Teaching AI to Think Step-by-Step", you'll learn how to make AI show its reasoning process—one of the most powerful techniques for complex problem-solving!
You'll discover:
- What Chain of Thought prompting is
- When and why to use it
- How to structure step-by-step reasoning
- Real examples of complex problems solved with CoT