AutomateMyJob
Back to BlogPrompt Engineering

The One-Shot vs Few-Shot Decision: When Examples Matter

David Park11 min read

The One-Shot vs Few-Shot Decision: When Examples Matter

Here's a scenario: You want AI to write product descriptions in a specific style. You could write paragraphs describing the tone, structure, and word choices you want. Or you could show it one example and say "like this."

Often, showing beats telling. This is the power of example-based prompting—also called one-shot (one example) or few-shot (multiple examples) learning. Understanding when and how to use examples is a crucial prompt engineering skill.

Why This Matters

Examples communicate in ways that descriptions cannot:

  • Format precision: An example shows exactly how to structure output
  • Style capture: Tone and voice are easier to demonstrate than describe
  • Ambiguity elimination: Examples resolve interpretation questions
  • Implicit patterns: Sometimes you can't articulate what you want, but you know it when you see it

The difference between "write in a conversational but professional tone" and showing an actual sentence in that tone is the difference between a compass bearing and GPS coordinates.

The Terminology

Zero-shot: No examples provided—just instructions One-shot: One example provided Few-shot: Multiple examples provided (typically 2-5)

The "shot" refers to each example. Adding examples is like adding reference points that guide the AI's output.

The Technique Explained

Example-based prompting works by showing the AI what good output looks like. The AI identifies patterns in your examples and applies them to new inputs.

Basic Structure

Prompt
[Optional: Explain the task]

Here's an example:
Input: [example input]
Output: [example output]

Now do the same for:
Input: [your actual input]
Output:

Why It Works

AI models are exceptional at pattern recognition. When you provide examples, the model:

  1. Identifies the transformation between input and output
  2. Recognizes stylistic and structural patterns
  3. Applies those patterns to new inputs

The more examples you provide, the more patterns the AI can detect—but there are diminishing returns after 3-5 examples.

Examples in Action

Example 1: Consistent Formatting

Before (Zero-Shot):

Prompt
Write a product description for running shoes. Make it 
catchy and focus on benefits.

After (One-Shot):

Prompt
Write product descriptions in this style:

Example:
Product: Wireless earbuds
Description: Lose the wires. Keep the music. Our 
ultralight earbuds deliver studio-quality sound for 
8 hours straight. Water-resistant, sweat-proof, and 
designed to stay put during your toughest workouts. 
Because nothing should interrupt your flow.

Now write for:
Product: Running shoes
Description:

Why It's Better: The example communicates the exact length, sentence structure, tone, and benefit-focused approach. No amount of description could convey this as precisely.

Example 2: Data Transformation

Before (Zero-Shot):

Convert this customer feedback into actionable insights.

After (Few-Shot):

Prompt
Convert customer feedback into actionable insights using 
this format:

Example 1:
Feedback: "The checkout process has too many steps. I 
almost abandoned my cart."
Insight: [UX] Simplify checkout - reduce steps from X 
to fewer. Impact: Cart abandonment. Priority: High.

Example 2:
Feedback: "I wish you had a mobile app. The website is 
hard to use on my phone."
Insight: [Mobile] Improve mobile experience - consider 
responsive redesign or app development. Impact: Mobile 
users. Priority: Medium.

Now convert:
Feedback: "Your search function never finds what I'm 
looking for. I end up browsing manually."
Insight:

Why It's Better: The examples establish a consistent structure (category tag, action, impact, priority) that would require extensive explanation otherwise.

Example 3: Tone Matching

Before (Zero-Shot):

Write an email declining a request, friendly but firm.

After (One-Shot):

Prompt
Write decline emails in this style:

Example:
Situation: Vendor requesting a meeting
Email: Hi Marcus, Thanks for reaching out about the demo. 
I appreciate you thinking of us! We're not in a position 
to evaluate new vendors right now, but I've made a note 
to circle back in Q2 when our budget planning reopens. 
I'll reach out then if it makes sense to connect. Best, 
Sarah

Now write for:
Situation: Colleague asking me to join a committee I 
don't have time for
Email:

Why It's Better: "Friendly but firm" is subjective. The example shows exactly what that means in practice—warm opener, clear decline, future door left open, professional close.

Copy-Paste Prompts

One-Shot Template

Prompt
[Task description]

Here's an example of what I'm looking for:

Input: [example input]
Output: [example output]

Now apply the same approach to:

Input: [your actual input]
Output:

Few-Shot Template

Prompt
[Task description]

Learn from these examples:

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

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

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

Apply the same pattern to:

Input: [your input]
Output:

Pattern Extraction Template

Prompt
I'll show you some examples. Identify the pattern, then 
apply it to a new case.

Example outputs:
1. [example 1]
2. [example 2]
3. [example 3]

What pattern do you notice?

Now create a new one following the same pattern for: 
[your case]

Choosing: Zero vs One vs Few Shot

Use Zero-Shot When:

  • The task is simple and unambiguous
  • You want variety and creativity
  • You don't have good examples
  • Speed matters more than precision
  • You're exploring what's possible

Use One-Shot When:

  • You have one perfect example
  • The pattern is straightforward
  • You want to establish format and tone
  • You're testing before committing to few-shot
  • Token/length limits are a concern

Use Few-Shot When:

  • The pattern is complex or nuanced
  • Consistency across outputs is critical
  • You want to show variations within a pattern
  • The task has multiple valid approaches you want to include
  • Edge cases need to be demonstrated

Common Mistakes

Mistake: Using examples that don't represent what you actually want ✅ Fix: Select examples that exemplify your best outputs

Mistake: Providing too many examples (7+) ✅ Fix: Stick to 2-5 examples; diminishing returns after that

Mistake: Examples that are too similar to each other ✅ Fix: Show variety within the pattern to help AI generalize

Mistake: Not explaining what makes the examples good ✅ Fix: Add brief notes about what patterns to follow

Mistake: Using examples when simple instructions would work ✅ Fix: Start with zero-shot; add examples only if needed

When to Use This Technique

  • Format-sensitive outputs (structured data, specific layouts)
  • Style-specific writing (brand voice, tone matching)
  • Classification tasks (categorizing, labeling)
  • Data transformation (reformatting, extracting)
  • Consistent outputs (batch processing similar items)

When NOT to Use This Technique

  • You want creative, varied outputs
  • The examples might bias toward unwanted patterns
  • You don't have representative examples
  • The task is simple enough without them
  • Token limits make examples impractical

Advanced Variations

Diverse Few-Shot

Show variety to help AI generalize:

Prompt
Here are examples of good product descriptions for 
different types of products:

Example 1 (Tech product):
[tech-focused example with specs emphasis]

Example 2 (Lifestyle product):
[emotion-focused example with aspirational tone]

Example 3 (Professional service):
[credibility-focused example with expertise emphasis]

Now write a description for [your product], drawing on 
the appropriate style for its category.

Annotated Examples

Explain what to notice:

Prompt
Here's an example—pay attention to the marked elements:

[Example output]

Notice:
- Opening hook: [what makes it effective]
- Structure: [pattern used]
- Closing: [what it accomplishes]

Apply these same principles to: [your request]

Negative Examples

Show what NOT to do:

Prompt
Good example:
[example of what you want]

Bad example (avoid this):
[example of what you don't want]

The difference: [key distinction]

Now write: [your request]

Progressive Few-Shot

Start simple, build complexity:

Prompt
I'll show you examples of increasing complexity:

Simple case:
Input: [basic input]
Output: [basic output]

Medium complexity:
Input: [more complex input]
Output: [more detailed output]

Complex case:
Input: [complex input with edge cases]
Output: [comprehensive output handling edges]

Now handle this: [your input]

How Many Examples Do You Need?

ScenarioRecommended
Simple format1 example
Standard pattern2-3 examples
Complex or nuanced task3-5 examples
Multiple valid variations4-5 diverse examples
Simple task with clear instructions0 examples

Research suggests 3-5 examples hit the sweet spot for most tasks. Beyond that, you get marginal improvement for significant prompt length increase.

Practice Exercise

Try this approach:

Prompt
I need AI to [your task] in a specific style.

Step 1: Write out one example of excellent output for 
this task.

Step 2: Use this one-shot prompt and evaluate:
"[Task description]
Here's an example:
[your example]
Now do the same for: [new input]"

Step 3: If the output isn't consistent enough, add 2 
more examples that show variation within the pattern.

Step 4: Compare one-shot vs few-shot results.

Key Takeaways

  • Examples often beat descriptions for communicating style and format
  • One-shot works for straightforward patterns
  • Few-shot (2-5 examples) handles complex or nuanced tasks
  • Diversity in examples helps AI generalize
  • Zero-shot is fine for simple, creative, or exploratory tasks
  • Annotate examples to highlight what matters
  • Negative examples clarify boundaries

Conclusion

Example-based prompting is one of the most practical techniques in prompt engineering. It bridges the gap between what you can articulate and what you actually want, using demonstration instead of description.

Start with your next prompt that needs consistent formatting or specific style. Add one good example. Notice how the output aligns more closely with what you want. Then experiment with few-shot when patterns are complex.

The best communicators know when to explain and when to show. With AI, showing is often the more effective choice.

One good example is worth a thousand words of description.

Sponsored Content

Interested in advertising? Reach automation professionals through our platform.

Share this article