Few-Shot Prompting
Simple Definition
Few-shot prompting means giving an AI a few examples of what you want before you ask it to do the actual task. By showing it two or three examples of the input-output pattern, the model understands your expectation better and produces more accurate results.
“Few” typically means 2–5 examples. “Shot” refers to each example.
Example
Without few-shot (zero-shot):
Classify the sentiment of this review as Positive, Negative, or Neutral: “The shipping was fast but the product broke after one day.”
With few-shot:
Classify the sentiment of these reviews as Positive, Negative, or Neutral.
Review: “Great product, exactly what I needed.” → Positive Review: “Arrived late and broken.” → Negative Review: “It’s okay, nothing special.” → Neutral
Review: “The shipping was fast but the product broke after one day.” →
The examples teach the model the exact format and judgment you expect.
When to Use Few-Shot Prompting
- When you need consistent formatting or classification
- When the task has an unusual or specific style you want the model to match
- When zero-shot results are inconsistent or don’t match your expectations
- When working with specialized tasks the model might not handle well by default
Few-Shot vs. Fine-Tuning
Few-shot prompting puts examples in the prompt itself — no training required. Fine-tuning trains the model on many more examples to bake the behavior in permanently. For most use cases, few-shot prompting is faster and more flexible.
Related Terms
- Zero-Shot Prompting — asking the model with no examples at all
- Prompt Engineering — the broader skill of crafting effective prompts
- Chain-of-Thought — another prompting technique for complex reasoning
- LLM — the models few-shot prompting works with
See AI terms in action
Browse practical AI workflows that use the concepts in this glossary.
Last updated: