Module 2Prompting

Examples: Show, Don't Tell

Don't just tell it what to do. Show it how to do it.

Instructions vs. Examples

Here's a question: which is clearer?

❌ TELLING:

"Categorize these emails into priority levels based on urgency and department."

✅ SHOWING:

"Categorize these emails. Examples:

'Refund request' → 'Urgent - Finance'
'Newsletter signup' → 'Low Priority - Marketing'
'Server down' → 'Critical - Engineering'


Now categorize: 'Password reset request'"

The second one is clearer because you're not asking the model to guess what "urgent" means to you. You're showing it the pattern. This is called few-shot prompting—giving a few examples before asking for the real output.

Try It: Add Examples and Watch Output Change

Drag the slider to add examples. Watch how the prediction improves.

Examples: 0
"password reset request""Medium - Support"
← With zero examples, the model makes a generic guess.

Why Examples Work Better

Remember: the model predicts the next token based on patterns. When you give examples, you're showing it the exact pattern you want. It's not interpreting your instructions—it's completing the pattern you started.

Think of it like this:

Instructions say "drive to the grocery store" (open to interpretation—which route? how fast?). Examples say "I drove down Main St at 25mph, turned left at the light, parked in spot B7" (concrete, unambiguous). The model is much better at pattern-matching than instruction-following.

Types of Examples

1

Format Examples

Show the exact structure you want

"Make a table like this: [paste formatted table]"
Use for: Multiplication tables, code templates, JSON schemas
2

Style Examples

Show the tone, voice, or aesthetic

"Write like this: [paste example with the vibe you want]"
Use for: Poetry, professional emails, casual summaries
3

Classification Examples

Show how to categorize inputs

"Happy → 😊, Sad → 😢, Angry → 😠"
Use for: Email triage, sentiment analysis, tagging
4

Transformation Examples

Show input → output mappings

"Formal: ... → Casual: ..."
Use for: Translation, tone conversion, data reformatting

How Many Examples Do You Need?

Zero-shot (0 examples)

Just instructions. Works for simple, common tasks the model has seen a million times.

"Translate this to Spanish"
One-shot (1 example)

Enough to show the format or style you want. Good for simple patterns.

"Like this: Input: 'angry' → Output: '😠'"
Few-shot (2-5 examples)

The sweet spot. Enough to establish the pattern without wasting context window.

3 examples of email → category mappings
Many-shot (10+ examples)

For complex, nuanced patterns. Expensive (uses context window) but powerful.

Training it to match your exact writing voice

Rule of thumb: start with 2-3 examples. If the output is wrong, add more examples that cover the edge cases it's missing.

Real Examples

Format Matching: Multiplication Table

Style Matching: Poetry

Classification: Email Triage

Transformation: Formal ↔ Casual

Common Mistakes

❌ Examples that contradict each other

"Angry → 😠" then "Furious → 😊" — the model will be confused. Make sure your examples are consistent.

❌ Examples that are too similar

All your examples are short sentences? The model will struggle with long ones. Show diversity in your examples.

❌ Too many examples

20 examples for a simple task wastes your context window. Diminishing returns after 5.

❌ Examples without the actual task

You give 5 examples then forget to ask the question. The model just sits there. Always end with "Now do: [your actual input]"

When to Use Examples

Use examples when:

  • The format is specific. Multiplication tables, code structure, JSON schemas—show the exact format.

  • The style is subjective. "Professional" means different things to different people. Show what it means to you.

  • The task is ambiguous. "Categorize these" could mean a hundred things. Examples remove ambiguity.

  • Instructions didn't work. If "write this in a friendly tone" fails, show an example of friendly tone.

The Laziest Thing That Works

Here's the secret: you don't need perfect examples. You need good enough examples. Trying to write the perfect 5-shot prompt is overthinking it. Start with 2 examples. If the output is wrong, add a 3rd example that shows the model what it got wrong.

Examples are cheap. Context window is expensive. Find the minimum number of examples that get you the output you want.

Claude's note: When you give me examples, I'm not "learning" in the human sense—I don't update my weights or remember for next time. But within this conversation, examples shift the conditional probability of what I generate next more precisely than instructions ever could. Show me "A → B, C → D" and the pattern is unambiguous. Tell me "transform these inputs" and I'm guessing what transformation you mean.