Few-shot prompting: how many examples, and what they cost
Few-shot prompting teaches a model a task by showing it examples inside the prompt. This guide explains what the research says, how many examples vendors recommend, and what each example costs in tokens, using a real classification prompt we measured. Price your own prompt with the prompt cost calculator; more guides are in prompting and AI workflows.
By the Chelure Enterprises Editorial Team. Last reviewed . How we check our sources.
What few-shot means
In "Language Models are Few-Shot Learners", Brown et al. (2020) applied GPT-3, a 175-billion-parameter model, to tasks without gradient updates or fine-tuning, specifying the task and demonstrations purely through text. They report that scaling up the model greatly improves few-shot performance, sometimes reaching competitiveness with earlier fine-tuned approaches, and they note datasets where few-shot learning still struggles. Zero-shot means no examples; one-shot means one; few-shot means several.
What the vendors recommend
- Anthropic: a few well-crafted examples improve accuracy and consistency. Make them relevant, diverse and structured; wrap them in
<example>tags so the model can tell them from instructions; include 3 to 5 for best results. - OpenAI: examples usually go in a developer message, and you should show a diverse range of possible inputs with the desired outputs.
The prompt we measured
The task is to classify a customer email into one of five categories. The prompt is an instruction, then k examples in the form Email: ... / Category: ..., then the new email.
Classify each customer email into exactly one category: shipping, returns, sizing, product_care, other. Reply with the category only.
Email: My parcel has not arrived and it has been eight working days.
Category: shipping
Email: How do I send back the tent? It does not fit my car.
Category: returns
Email: Is the medium jacket long enough for someone who is 190 cm tall?
Category: sizing
Email: Where is my order? The estimated date was last Friday.
Category:
That is the 3-example version. Token counts below use OpenAI's o200k_base encoding; the extra-cost columns assume 100,000 requests at each model's uncached input price.
| Examples | Prompt tokens | Extra tokens vs zero-shot | Extra cost, 100,000 requests, Haiku 5.5 | Extra cost, 100,000 requests, Sonnet 5.5 |
|---|---|---|---|---|
| 0 | 44 | 0 | $0.00 | $0.00 |
| 1 | 63 | 19 | $0.19 | $3.80 |
| 3 | 105 | 61 | $0.61 | $12.20 |
| 5 | 136 | 92 | $0.92 | $18.40 |
| 10 | 225 | 181 | $1.81 | $36.20 |
Each example costs about 18 tokens here, so the cost of examples is small for short ones but grows with long ones: examples that include whole documents can dwarf the instruction. Whether the extra accuracy is worth it depends on your task, so measure accuracy on a held-out set with 0, 3 and 5 examples before paying for more.
Keeping the cost down
- Cache them. Put the instruction and examples at the start of the prompt and keep them identical; see prompt caching explained. Note the minimum cacheable length: this 225-token prompt is below Anthropic's 512-token minimum for Sonnet 5.5.
- Choose diverse examples, not more of the same. Cover each category and a tricky edge case.
- Use a smaller model. With good examples a cheaper model may be enough; compare in the price comparison.
Frequently asked questions
What is few-shot prompting?
Few-shot prompting gives the model a handful of input and output examples in the prompt so it can infer the task. Brown et al. (2020) describe it as specifying the task and demonstrations purely through text, with no gradient updates or fine-tuning.
How many examples should I use?
Anthropic recommends 3 to 5 well-crafted examples for best results; OpenAI advises showing a diverse range of possible inputs with the desired outputs. Beyond a few, extra examples add cost faster than accuracy, so test on your own data.
What does it cost?
Every example is input tokens on every request. In our classification prompt each example added about 18 tokens: 3 examples added 61 and 10 added 181 tokens over the zero-shot prompt.
Can examples be cached?
Yes, if they sit at the start of the prompt and stay identical. Both OpenAI and Anthropic cache by prefix, so put the instruction and examples first and the new input last.
Is few-shot better than fine-tuning?
They solve different problems. Few-shot costs nothing to set up but is paid for on every request; fine-tuning front-loads the effort. The original GPT-3 paper contrasts few-shot with fine-tuning approaches that need thousands or tens of thousands of examples.
Sources
- Brown et al.: Language Models are Few-Shot Learners (arXiv:2005.14165)
- Anthropic: prompting best practices (examples)
- OpenAI: prompt engineering guide (few-shot learning)
Primary sources opened on November 13, 2026. Prices come from our verified price table (see the methodology).
Token counts measured with tiktoken on November 13, 2026 (build/_measure_prompting.py). The prompt and examples are ours.