Few-Shot Prompting: How to Teach AI by Showing, Not Telling

Stop explaining what you want—show AI instead. Learn few-shot prompting, the technique that teaches AI through examples. Includes copy-paste templates.

You know how frustrating it is to explain something to someone, and they just don’t get it?

Then you show them one example, and suddenly everything clicks?

AI works the same way.

This is the core insight behind few-shot prompting—one of the most reliable techniques for getting AI to do exactly what you want.

The Problem With Explaining

When you write a prompt, you’re usually explaining what you want:

“Write a product description that’s casual but professional, highlights benefits over features, uses short sentences, and ends with a soft call-to-action.”

That’s a lot of instructions. And AI might interpret “casual but professional” differently than you do. It might think “short sentences” means something different than what you have in mind.

Words are imprecise. Especially when describing tone, style, and format.

The Solution: Show, Don’t Tell

Few-shot prompting flips the script. Instead of explaining what you want, you show AI examples of it.

Here’s the structure:

Example 1:
Input: [example input]
Output: [example output you want]

Example 2:
Input: [another example input]
Output: [another example output]

Now do this one:
Input: [your actual input]
Output:

AI analyzes your examples, identifies the pattern, and applies it to your new input.

No lengthy explanations needed. The examples do the teaching.

A Real Example

Let’s say you want AI to write product taglines in a specific style.

Without few-shot (explaining):

Write a tagline for a fitness app. Make it punchy,
use active verbs, imply transformation, and keep it under 8 words.

With few-shot (showing):

Here are taglines I like:

Product: Running shoes
Tagline: "Run faster. Feel lighter. Go further."

Product: Meditation app
Tagline: "Quiet your mind. Find your calm."

Product: Coffee subscription
Tagline: "Wake up to better mornings."

Now write one for:
Product: Fitness app
Tagline:

The few-shot version doesn’t explain the style—it demonstrates it. AI picks up on the pattern (short phrases, active verbs, implied benefit) without you having to articulate those rules.

Zero-Shot vs One-Shot vs Few-Shot

These terms describe how many examples you provide:

TypeExamplesBest For
Zero-shot0Simple tasks AI already knows
One-shot1Tasks needing light guidance
Few-shot2-5Tasks needing clear patterns

Start with one example. If the output doesn’t match what you want, add another. Usually 2-3 examples are enough. More than 5 rarely helps and wastes context space.

When Few-Shot Prompting Shines

Classification Tasks

Teaching AI your categories:

Classify these customer messages:

Message: "When will my order arrive?"
Category: Shipping inquiry

Message: "This product broke after one week"
Category: Quality complaint

Message: "Do you have this in blue?"
Category: Product question

Message: "I want my money back"
Category: Refund request

Now classify this:
Message: "Can I change my delivery address?"
Category:

Style Matching

Getting AI to write like something specific:

Convert formal text to casual:

Formal: "We regret to inform you that your application has been unsuccessful."
Casual: "Sorry, but we won't be moving forward with your application this time."

Formal: "Please find attached the requested documentation."
Casual: "Here's that doc you asked for!"

Formal: "Your inquiry has been received and will be addressed within 48 hours."
Casual:

Format Transformation

Teaching a specific output structure:

Turn meeting notes into action items:

Notes: "Discussed Q4 budget. Sarah needs to get final numbers from finance.
Launch pushed to November. Mike will update the timeline."

Action items:
- [ ] Sarah: Get Q4 numbers from finance
- [ ] Mike: Update project timeline for November launch

Notes: "Website redesign review. Homepage approved. Need new copy for
About page. Design team starting next sprint."

Action items:

Data Extraction

Pulling specific information:

Extract contact info from these messages:

Message: "Hi, I'm John Smith from Acme Corp. You can reach me at
john@acme.com or 555-123-4567."
Extracted: Name: John Smith | Company: Acme Corp | Email: john@acme.com | Phone: 555-123-4567

Message: "This is Sarah Chen, marketing director. My direct line is
555-987-6543. Email sarah.chen@bigco.io"
Extracted: Name: Sarah Chen | Company: BigCo | Email: sarah.chen@bigco.io | Phone: 555-987-6543

Message: "Hey, Mike here from StartupXYZ. Best way to reach me is
mike@startupxyz.com"
Extracted:

Best Practices

1. Use Representative Examples

Your examples should cover the range of inputs you expect. If you’re classifying sentiment and most of your data is neutral, include a neutral example—not just positive and negative.

2. Keep Examples Consistent

Every example should follow the same format. If your first example uses bullet points, all examples should use bullet points. Inconsistency confuses the pattern matching.

3. Order Matters

Research shows example order affects performance significantly. Put your best, clearest examples first. If you have a particularly tricky edge case, put an example of it last, right before your actual input.

4. Quality Over Quantity

Three excellent examples beat ten mediocre ones. Each example should be unambiguous and clearly demonstrate what you want.

5. Combine With Instructions

Few-shot doesn’t mean no instructions. You can—and often should—include both:

You're a customer service classifier. Categorize messages into:
Billing, Technical, General, or Urgent.

Examples:
[your examples]

Now classify this message:
[actual input]

The instructions provide context. The examples show exactly how to apply that context.

When NOT to Use Few-Shot

Few-shot isn’t always the answer:

  • Simple factual questions: “What’s the capital of France?” doesn’t need examples.
  • Creative tasks where you want variety: Examples can constrain creativity. If you want diverse ideas, don’t show a pattern.
  • Very long outputs: If your examples are each 500 words, you’ll eat up context space quickly.
  • Tasks AI already does well: If zero-shot works fine, don’t overcomplicate it.

The Template

Here’s a reusable template:

[Optional: Brief instruction about the task]

Example 1:
Input: [input]
Output: [output]

Example 2:
Input: [input]
Output: [output]

Example 3:
Input: [input]
Output: [output]

Now process this:
Input: [your actual input]
Output:

Adjust the labels (Input/Output) to match your task. For classification, you might use “Text” and “Category.” For style transfer, “Original” and “Rewritten.”

Taking It Further

Few-shot prompting works even better when combined with other techniques:

  • Few-shot + Chain of Thought: Show examples where you reason through the answer step by step
  • Few-shot + Role prompting: Give AI a persona AND examples of how that persona responds
  • Few-shot + Format constraints: Examples plus explicit format requirements

The more specific you can be—through whatever combination of techniques—the better your results.

The Bottom Line

Few-shot prompting works because showing is more precise than telling.

Instead of trying to explain exactly what you want in words, demonstrate it with examples. AI is remarkably good at picking up patterns and applying them to new inputs.

Next time you’re struggling to get the output you want, stop adding more instructions. Add an example instead.

Sometimes one good example is worth a thousand words of explanation.