Few-shot prompting
Few-shot prompting is a technique in which you include a small number of worked examples of a task in the prompt, so the model can infer the pattern and apply it to a new input. It was popularised by research published in 2020 showing that large language models can learn tasks from examples alone.
Instead of describing a task in the abstract, you show it: two to five input-output pairs, followed by the new input. The model continues the pattern. Brown et al. (2020) described this "in-context learning" in large language models and compared zero-shot (instructions only), one-shot and few-shot settings. No model weights change; the learning happens within the prompt.
Why it matters: few-shot examples are one of the most reliable ways to control format, tone and edge cases without fine-tuning. They are especially useful for classification, extraction and writing in a house style, and many AI products include examples in their hidden prompts for this reason.
Example: to label support tickets, a prompt lists three tickets with their correct labels (billing, bug, feature request) and then asks the model to label a fourth.
Limits: examples cost tokens on every request, and the model may copy their surface features too closely. Choose varied, representative examples and test whether they actually improve results.
Related terms
Learn it step by step
Sources
- Language Models are Few-Shot Learners. Brown et al., arXiv, May 2020
Topic: Prompt engineering
Last updated