Overview
Direct Answer
Few-shot prompting is a technique in which a language model receives a small number of demonstration examples (typically 2–10) embedded directly within a prompt to establish a pattern for generating contextually appropriate responses. This method leverages in-context learning without requiring model retraining or fine-tuning.
How It Works
The model observes the provided input–output pairs and infers the desired task structure, tone, and format from those examples. During inference, the model applies this learned pattern to new, unseen inputs within the same prompt. The proximity and ordering of examples significantly influence the model's behaviour, as the demonstrations provide implicit instruction through pattern recognition rather than explicit algorithmic rules.
Why It Matters
Organisations adopt this approach to reduce engineering overhead and deployment latency—no retraining cycles or specialised datasets are required. It enables rapid adaptation to domain-specific tasks, improved accuracy on niche problems, and cost-effective customisation without infrastructure investment.
Common Applications
Applications include customer service chatbots performing intent classification, legal document analysis extracting specific clause types, financial services automating transaction categorisation, and healthcare systems interpreting clinical notes for structured data extraction.
Key Considerations
Performance gains plateau with model size and task complexity; some tasks benefit minimally from additional examples. Token consumption increases linearly with demonstration count, raising inference costs for resource-constrained deployments.
Cross-References(1)
More in Artificial Intelligence
Turing Test
Foundations & TheoryA measure of machine intelligence proposed by Alan Turing, where a machine is deemed intelligent if it can exhibit conversation indistinguishable from a human.
ROC Curve
Evaluation & MetricsA graphical plot illustrating the diagnostic ability of a binary classifier as its discrimination threshold is varied.
Hyperparameter Tuning
Training & InferenceThe process of optimising the external configuration settings of a machine learning model that are not learned during training.
AI Chip
Infrastructure & OperationsA semiconductor designed specifically for AI and machine learning computations, optimised for parallel processing and matrix operations.
AI Watermarking
Safety & GovernanceTechniques for embedding imperceptible statistical patterns in AI-generated content to enable reliable detection and provenance tracking of synthetic outputs.
AutoML
Training & InferenceAutomated machine learning that automates the end-to-end process of applying machine learning to real-world problems.
Federated Learning
Training & InferenceA machine learning approach where models are trained across decentralised devices without sharing raw data, preserving privacy.
AI Democratisation
Infrastructure & OperationsThe movement to make AI tools, knowledge, and resources accessible to non-experts and organisations of all sizes.