Few-shot learning is a machine learning paradigm in which a model is expected to generalize to a new task or class after seeing only a small number of labeled examples, often as few as one (one-shot) or none (zero-shot). It contrasts with traditional supervised learning, which typically requires large labeled datasets to achieve strong performance. The approach became especially prominent with large language models, which can interpret instructions and examples provided directly in their input prompt.
How few-shot learning works
Most modern few-shot learning systems start with a large pre-trained model that has already absorbed broad knowledge from massive datasets. To perform a new task, the model is given a small set of demonstrations inside its input, a technique known as in-context learning. For example, to teach a model to classify customer feedback as positive, negative, or neutral, a developer might include three labeled examples in the prompt: "Great service!" → positive, "Slow response." → negative, and "It was okay." → neutral. The model then applies the same pattern to new, unlabeled inputs without any weight updates.
Beyond prompting, few-shot learning can also be implemented by fine-tuning a pre-trained model on a small labeled dataset, or by using meta-learning approaches that explicitly train a model to learn new tasks rapidly. In all cases, the goal is the same: leverage prior knowledge so that a few examples are enough to specify a new behavior.
Why it matters
Few-shot learning dramatically lowers the cost and time required to adapt AI to specialized tasks. In domains where labeled data is scarce, expensive, or sensitive, such as medical diagnosis, legal review, or rare-language translation, collecting thousands of examples is often impractical. Few-shot methods make it feasible to build useful applications from small, carefully chosen examples. They also enable faster iteration, since teams can prototype and refine prompts or fine-tunes without waiting for large annotation projects.
Key types
- One-shot learning: the model is given a single example per class to learn from.
- Few-shot learning (k-shot): the model is given a small number, typically 2 to 10, of examples per class.
- Zero-shot learning: the model performs the task with no examples at all, relying on instructions or descriptions alone.
- Prompt-based few-shot learning: examples are provided directly in the input prompt, as popularized by GPT-3 and successors.
- Meta-learning: the model is explicitly trained across many related tasks so it can adapt to new ones with minimal data, a family that includes methods like MAML and prototypical networks.
Few-shot learning is one of the defining capabilities of modern foundation models, and it sits at the heart of techniques like prompt engineering, retrieval-augmented generation, and lightweight fine-tuning such as LoRA. As base models continue to improve, the number of examples required for reliable task performance tends to shrink, making AI customization accessible to teams without dedicated data-labeling pipelines.