Few-shot prompting — providing one or more concrete examples of the exact input-output pattern you want, directly in your prompt, rather than only describing what you want in the abstract — remains one of the more reliable, durable prompting techniques discussed across this section, precisely because it works through the same underlying mechanism the model is built on: pattern-matching and continuation, discussed in the what-llms-actually-do guide elsewhere on this site.
For another practical perspective on prompt structure and iteration, Google AI prompting strategies is useful further reading.
Why an example works better than a description
Describing a desired format in words (“format each item as a short title followed by a one-sentence summary”) requires the model to translate your abstract description into a concrete pattern, which introduces room for a slightly different interpretation than what you actually had in mind. Providing one or two concrete examples of exactly that pattern gives the model something to directly match and continue, rather than something to interpret and translate — which is closer to what the underlying mechanism is fundamentally built to do well, and produces noticeably more consistent formatting as a result, especially across a batch of many similar outputs.
How many examples actually helps, and when more stops mattering
A single well-chosen example often produces most of the available improvement over no examples at all, particularly for a straightforward formatting pattern. Two or three examples, particularly ones that vary slightly from each other, tend to help further specifically when the pattern has some genuine variation you want the model to handle correctly (different lengths, different edge cases) rather than a single, completely uniform structure. Beyond three or four examples, the additional benefit tends to diminish for most straightforward tasks, though a genuinely complex or unusual pattern may still benefit from more.
As this kind of work becomes a repeatable team process, this reference page can provide additional operational context for time, workload, and delivery decisions.
- Provide at least one concrete example of your exact desired input-output pattern for any task where consistent formatting matters, rather than relying on a purely verbal description.
- Use two or three examples, with some genuine variation between them, when the actual task has meaningful variation you want handled correctly — not just a single uniform case repeated.
- Choose examples that are genuinely representative of the real range of inputs you'll actually be processing, not just the easiest or most typical case — an example set skewed toward simple cases won't teach the pattern needed for harder ones.
- For a batch task (processing many similar items the same way), invest more upfront effort in strong examples — the effort pays off multiplied across every item in the batch, not just once.
- If output is still inconsistent after two or three examples, the underlying pattern itself may be more ambiguous or context-dependent than a fixed example set can fully capture — worth reconsidering whether a rigid format is the right ask for this specific task.
- Examples can demonstrate what to avoid as well as what to include — a brief counter-example, clearly labeled as what not to do, can sharpen the model's understanding of a boundary that's otherwise easy to cross.
Why this technique is likely to remain durable
Unlike some of the more model-specific tricks discussed in the prompt-engineering guide elsewhere in this section, few-shot prompting works through pattern-continuation, a mechanism close to the actual, fundamental core of how these models operate, discussed elsewhere on this site — which makes it more likely to remain effective across future model generations than techniques tied to a specific model's particular training quirks. It's a reasonable technique to invest real time in learning well, since that investment is less likely to go stale quickly.
This technique pairs naturally with the prompt-templates guide elsewhere in this section: a strong example set, once developed for a recurring task, is itself a reusable asset worth saving and reapplying rather than reconstructing from scratch each time.