Prompting Mastery
Lesson 2 of 6
0%
Lesson 2
25 min

Zero-shot vs Few-shot Prompting

Listen to the full lesson
AI Narration
Quick Summary

Zero-shot asks the model cold; few-shot shows it 2-5 input/output examples first. Examples almost always beat instructions for unusual formats, brand voice, or ambiguous classification.

What you will learn
  • ·Understand zero-shot vs. few-shot prompting and when to use each
  • ·Construct effective few-shot examples for classification and generation tasks
  • ·Understand why examples are often more powerful than instructions

Zero-shot prompting asks the model to perform a task it hasn't been given examples for. "Classify this customer review as positive, negative, or neutral" — no examples provided. Modern frontier models (GPT-4, Claude) are excellent zero-shot performers for common tasks because their training data exposed them to countless examples of similar tasks. For well-defined, common tasks, zero-shot is often sufficient.

Few-shot prompting provides examples of the desired input-output pattern before asking the model to process the actual input. Instead of describing what you want, you show it. "Here are three examples of how I want you to classify reviews: [example 1] → Positive. [example 2] → Negative. Now classify: [your review]." Few-shot works especially well when your desired output format is unusual, when you have a specific style or voice to match, or when the task is ambiguous.

The power of few-shot examples is that they communicate style, format, and nuance in ways that instructions often can't. If you want model outputs in your exact brand voice, instructions like "write in a warm, conversational tone" are imprecise. Three examples of your past writing are far more precise. This is the "show don't tell" principle applied to AI prompting.

For classification tasks, aim for balanced examples — if you have 5 categories, include at least 1-2 examples of each. For generation tasks, 3-5 high-quality examples are usually sufficient; more examples consume context tokens without proportional improvement. If your examples are long, consider using 2 high-quality examples rather than 5 mediocre ones. Quality of examples matters more than quantity.

Key Insights

  • Zero-shot: no examples — works well for common, well-defined tasks with frontier models
  • Few-shot: provide input→output examples — better for unusual formats, specific styles, or ambiguous tasks
  • Examples communicate nuance better than descriptions — 'show don't tell' is powerful
  • For classification: include balanced examples across all categories
  • 3-5 high-quality examples usually outperform 10 mediocre ones

Why It Matters

When teams cannot get a model to produce output in their voice, the instinct is to write longer instructions. The right move is usually to paste in three examples of the actual voice. "Show, don't tell" is the cheapest and most reliable accuracy upgrade in prompt engineering, and it works across every frontier model.