AI builder glossary
Few-shot prompting
Including a handful of worked input-and-output examples in a prompt so the model copies the format, tone, and judgment you want instead of guessing.
Few-shot prompting means showing rather than telling. Instead of describing a tone or a labeling rule in abstract terms, you include a few examples of real inputs paired with the outputs you want. Models are very good at picking up patterns from examples, often better than from paragraphs of instructions.
It shines where the target is hard to describe: a brand voice, a borderline classification, the right level of detail in a summary, or a house style for extracted fields. It is also a cheap way to fix a recurring mistake, by adding an example that covers exactly the case the model keeps getting wrong.
The trade-offs are subtle. Models copy examples closely, so three examples that all start the same way or share the same length produce outputs that do too. Examples should vary along the dimensions that matter and include at least one tricky case. They also cost tokens on every call, though caching a stable block of examples reduces that.
Pick examples from real data, label them carefully, and keep them separate from your eval set so you aren't grading the model on cases it was just shown.
A support-tagging feature includes four example tickets: a clear billing case, a clear bug report, an angry message that is really a feature request, and a vague one labeled needs-info, which cuts the miscategorized edge cases.
Learn more in the course
Related terms
Go from definitions to doing
Learn to build AI-powered apps in 132 practical lessons.