Few-shot prompting is a technique where you include a handful of example input-output pairs inside your prompt so the AI copies the pattern when it answers your real request. You are not training the model; you are showing it, in the moment, exactly what good output looks like. Give it two or three examples of a task done right, then your new input, and it follows suit. This is one of the fastest ways to control format, tone, and structure without any fine-tuning. This guide explains how it works, how it compares to zero-shot, and when to reach for it.
How few-shot prompting works
Language models are strong pattern matchers. When your prompt contains a clear pattern — say, three examples of a product name turned into a tagline — the model infers the rule and applies it to the next item. This in-context learning happens entirely within the single request; nothing about the model changes afterward.
The examples do the teaching. Good ones, consistent in format and quality, produce reliable output. Sloppy or contradictory examples confuse the model. The craft is in choosing representative examples that pin down exactly what you want.
Zero-shot, one-shot, and few-shot
| Style |
Examples given |
Best for |
| Zero-shot |
None, just instructions |
Simple, common tasks |
| One-shot |
A single example |
Setting a basic format |
| Few-shot |
Several examples |
Tricky formats or edge cases |
Start with zero-shot — just ask. If the output drifts in format or misses edge cases, add an example or two. Few-shot earns its keep when the task is unusual, the format must be exact, or the model keeps making the same mistake. It is a core part of writing prompts that work.
When to use it
- You need a strict, consistent output format the model keeps getting slightly wrong.
- The task is niche enough that plain instructions are ambiguous.
- You want a specific tone or style and find it easier to show than describe.
- You are classifying or transforming text and can demonstrate the categories.
- You want to reduce variability across many similar requests.
Few-shot pairs naturally with chain-of-thought prompting: include examples that show the reasoning steps, and the model imitates both the format and the thinking.
Few-shot versus fine-tuning, and what to skip
Few-shot guides one request using examples in the prompt; fine-tuning permanently adapts a model by training it on many examples. Few-shot is instant and free of training, but the examples eat into your context budget and must be resent every time. Fine-tuning costs effort up front but bakes the behavior in.
- Do not pile in dozens of examples when three good ones suffice; extras cost tokens and can even hurt.
- Do not use contradictory or low-quality examples; the model will copy the flaws.
- Do not reach for fine-tuning when a few examples in the prompt already solve it.
- Do not forget that capable 2026 models often nail tasks zero-shot, so try the simplest approach first.
FAQ
What does few-shot prompting mean?
It means giving the model a few example input-output pairs in your prompt so it copies the pattern for your actual request, without any training. The examples teach by demonstration.
How is it different from zero-shot?
Zero-shot gives only instructions and no examples. Few-shot adds several worked examples. Use zero-shot for simple tasks and few-shot when format or accuracy needs reinforcing.
Is few-shot the same as fine-tuning?
No. Few-shot guides a single request through examples in the prompt and changes nothing permanently. Fine-tuning trains the model on many examples to bake in the behavior for good.
How many examples should I use?
Usually two to five strong, consistent ones. More is not always better; extras cost tokens and can confuse the model. Start small and add only if quality needs it.
Where to go next
Learn how to write prompts that work, understand chain-of-thought prompting, and see what a system prompt is.