Describing exactly what you want in words is hard. Showing a few examples is often easier and more effective. Few-shot prompting puts a handful of example inputs and ideal outputs into the prompt, and the model infers the pattern for the new input. A prompt with no examples is called zero-shot; one example is one-shot. It is one of the simplest and most reliable tools in prompt engineering, and often the step that makes an AI feature consistent enough to use.
How it works
The prompt includes a short set of examples before the real input. For a ticket classification build, that might look like:
- An email about a double charge, labelled "billing".
- An email about a broken login link, labelled "technical".
- An email praising a support agent, labelled "feedback".
Then the new email follows, and the model returns a label in the same style.
Choosing examples is the skill:
- Cover the range. Include typical cases and the tricky ones, such as ambiguous messages or edge cases where categories overlap.
- Keep them consistent. Examples that disagree with each other or with the instructions confuse the model.
- Show the exact format. If software reads the output, the examples should show precisely the structured output expected.
- Avoid bias. If most examples carry one label, the model may favour it.
Some builds select examples dynamically, retrieving the most similar past cases for each new input instead of using a fixed set. Examples can also demonstrate reasoning, which combines few-shot prompting with chain-of-thought.
What it means for cost
Few-shot prompting is cheap to build: it needs a set of good examples, usually drawn from the business's own records, and some testing. It adds running cost, because the examples are sent with every request and count as input tokens. With many long examples and high volume, that adds up.
At that point, fine-tuning on a larger set of examples can become cheaper per request, because the behaviour moves into the model and the prompt shrinks. Ask a builder how examples were chosen, who in the business checked them, and at what volume fine-tuning would start to pay off.
Common questions
How many examples does few-shot prompting need?
Often a handful is enough, and more is not always better. The right number depends on how varied the task is, and it is best found by testing different sets on real cases.
What is the difference between few-shot prompting and fine-tuning?
Few-shot prompting shows examples in each request and leaves the model unchanged. Fine-tuning trains the model on many examples so it behaves that way by default. Few-shot is quicker to start and change; fine-tuning can be cheaper and more consistent at scale.
Can examples include real customer data?
They can, but personal details should be removed or replaced, since the examples are sent to the model provider with every request.