What is Few-Shot Prompting?
Including a small number of input-output examples in a prompt to guide an AI model's behavior.
Definition
Few-shot prompting is a technique where you include a small number of example input-output pairs in your prompt to demonstrate the desired behavior to the model. This is particularly useful for structured outputs (specific formats), style matching (match this writing style), or domain-specific classification (categorize using my specific categories with these examples). Typically 2–5 examples are sufficient.
Example
Instead of just saying 'classify this support ticket', you include: 'Example 1: {input: "I can't log in", output: "access"} Example 2: {input: "why was I charged?", output: "billing"} Now classify: {input: "your app crashed"}'. The model reliably outputs 'bug'.
Few-Shot Prompting vs fine-tuning: What's the difference?
Including a small number of input-output examples in a prompt to guide an AI model's behavior.
Few-shot examples are included in the prompt at inference time — no training needed, changes can be made instantly. Fine-tuning bakes examples into the model weights through additional training.