What Few-Shot Prompting Is
Few-shot prompting involves providing one to five input-output example pairs in your prompt before presenting the actual task. The model identifies the pattern from your examples and applies that same pattern to the new input. The 'few' refers to the number of examples — as opposed to zero-shot (no examples) or fine-tuning (hundreds or thousands of examples baked into the model's weights). Few-shot is a middle ground that's available to anyone at runtime without any additional training: you're teaching the model the pattern you want by showing rather than telling.
When Few-Shot Dramatically Outperforms Zero-Shot
Few-shot shines when the desired output has a specific structure, style, or format that's hard to describe in words. Classification tasks with unusual categories, writing in a very particular tone that matches existing content, data extraction in a specific schema, scoring or rating with precise criteria — all of these improve dramatically with examples. The key indicator that you need few-shot is when zero-shot with good instructions keeps producing technically correct but structurally wrong output. Once you've seen that pattern twice, add an example instead of trying to describe the structure differently.
How to Write Good Examples
Few-shot examples need to be representative of the actual inputs you'll provide and demonstrate the exact output quality and format you want. Bad examples teach bad habits — inconsistent format, inappropriate length, wrong level of detail — and the model will faithfully reproduce those flaws. Each example should mirror a real input you'd expect to encounter and show the ideal response you'd want to receive. Use your three best historical outputs as examples if you have them. If you're starting from scratch, write the ideal outputs manually for 2-3 representative cases and use those.
How Many Examples Do You Need?
Two to three high-quality examples reliably outperform five mediocre ones. More examples use more tokens, increasing cost and latency, so the ROI of additional examples drops off quickly. For most tasks, start with one example; if the model still isn't calibrated correctly, add a second. Rarely do you need more than three. The exception is tasks where outputs need to be highly varied and the examples might cause the model to over-pattern on specific surface features — in that case, a more varied set of 4-5 examples reduces over-fitting to the examples themselves.
Structuring Few-Shot Examples in Your Prompt
The clearest way to structure few-shot examples is with explicit Input/Output labels: 'Input: [example input] Output: [example output]'. This makes the pattern unambiguous for the model. After your examples, present the actual task with 'Input: [real input] Output:' and let the model complete it. Some practitioners use Q/A, User/Assistant, or custom labels — any consistent structure works as long as it clearly separates inputs from outputs and real cases from examples. Consistency between example labels and real task labels is important: don't use 'Question' in examples and 'Input' for the real case.
Few-Shot for Style Matching
One of the most powerful applications of few-shot prompting is matching a specific writing style or brand voice. Instead of trying to describe the style ('write in a warm, direct, slightly informal tone with short sentences and no jargon'), paste in 2-3 examples of existing content you want to match and say 'write a new item in the same style as these examples.' The model is remarkably good at capturing style from examples — often better than it is at interpreting style descriptions, because style is easier to show than to define.