Few-Shot Prompting
Providing 2-5 examples of desired input-output pairs in your prompt before asking the AI to perform the task. Significantly improves output quality for specialized tasks.
Why it matters
Few-shot prompting is the easy fix when zero-shot gives inconsistent or oddly formatted answers. By showing the AI two or three examples of exactly what you want, you teach it the pattern without any coding or training. It matters because it's the most reliable way to lock in a consistent style or output format, which is exactly what trips people up in real work.
A concrete example
Want product names turned into short taglines? Show the pattern: "Product: bamboo toothbrush -> Tagline: Brush greener. Product: steel water bottle -> Tagline: Ditch the plastic." Then add "Product: cotton tote ->" and let it finish. Those two examples teach length, tone, and format in one shot, so you get consistent taglines instead of the AI guessing what style you had in mind.
How to use it
Choose examples that cover the range of what you expect, including one awkward case, and make sure they are consistent with each other. The model copies the pattern it sees, so two examples that punctuate differently teach it that punctuation does not matter. Three to five good examples is usually the sweet spot; beyond that you are spending context for diminishing returns. The behaviour was first characterised at scale in Language Models are Few-Shot Learners.
The common mistake
Using examples that are all easy or all the same shape. The model then handles the easy cases beautifully and falls apart on the real ones, and because your examples looked fine you conclude the model is unreliable rather than the demonstration being unrepresentative.
Related terms
Zero-Shot Prompting
Asking an AI to perform a task without providing any examples. Relies entirely on the model's pre-trained knowledge. Works well for common tasks.
Prompt Engineering
The skill of crafting effective AI prompts to achieve desired outputs. Techniques include role-setting, few-shot examples, chain-of-thought reasoning, and constraint specification.
Structured Output
AI model responses formatted in a specific schema like JSON, XML, or tables rather than free-form text. Essential for integrating AI into software pipelines where downstream systems need predictable, parseable data formats.
A/B Testing (for Prompts)
Running two or more prompt variations against the same AI model to compare output quality. Data-driven prompt optimization that consistently outperforms intuition-based prompting.
Chain-of-Thought (CoT)
A prompting technique that instructs the AI to reason step-by-step before giving a final answer. Dramatically improves accuracy on complex reasoning, math, and logic tasks.
System Prompt
A special instruction set given to an AI model before the user's message, defining the model's persona, behavior rules, output format, and constraints. The foundation of custom AI assistants and chatbots.