Guide
Few-shot prompting
Few-shot prompting means the prompt includes a few completed examples of the task, then the new input. One-shot prompting is the same pattern with a single example. The examples teach format and judgment that a paragraph of instructions often misses.
Updated 2026-09-23
Before and after
Before
Rewrite this support reply so it sounds like us: We can't refund that.
After
Rewrite the new ticket in the same voice as the examples. Keep it under 40 words. Do not apologize twice. Example 1 Customer: The export failed. Reply: The export failed because the file is over 25 MB. Split it and send the first part — we'll rerun it today. Example 2 Customer: Can I change the email on the invoice? Reply: Yes. Reply with the correct email and we'll reissue the invoice. The total stays the same. New ticket Customer: We can't get a refund. Reply:
How to do it
1. Pick examples that match the real task
Use the same input type and the same output shape you want back. A tweet example will not teach a legal memo.
2. Keep the examples consistent
If three examples use different labels or different field names, the model averages them. One pattern, repeated, is stronger than five clever variations.
3. Put the new case last
Show the examples, then the unlabeled input, then an instruction such as “Reply in the same format.”
4. Choose one-shot when you only have one good sample
One-shot prompting is few-shot with a single example. It is enough to lock a format. Add a second and third example when the decision is subtle.
When to use this
Use few-shot prompting when the output has a shape you can show: labels, JSON keys, a tone of voice, or a classification. Two to five examples are usually enough. Use one-shot when you have only one gold example. Use zero-shot when the task is obvious and examples would only add noise.
Few-shot, one-shot, and zero-shot
Zero-shot means no examples, only instructions. One-shot means one example. Few-shot means more than one. Brown et al. used this scale when describing GPT-3: the model conditions on the examples in the prompt instead of on a separate training run.
Examples are not a substitute for a clear task. If the instruction and the examples disagree, models often follow the examples. Make them agree.
How many examples
Start with two. Add an example only when the model keeps missing a case you care about, such as an edge label or a refusal. Past five examples, you are often paying for repetition. Put the most representative example first and the closest analogue to the new task last.
Sources
Questions
What is few-shot prompting?
Few-shot prompting puts a few completed input-output examples in the prompt, then asks the model to handle a new input in the same format.
What is one-shot prompting?
One-shot prompting uses a single example before the new task. It is the smallest version of few-shot prompting and is enough when you mainly need to lock a format.
How many examples should a few-shot prompt include?
Two to five consistent examples are enough for most tasks. Add another only when the model keeps missing a case you can demonstrate.