Few-Shot Learning
Last updated June 11, 2026
What is Few-Shot Learning in simple terms?
In simple terms, few-shot learning is showing an AI a few examples of what you want and letting it copy the pattern. Like a new hire who watches a couple of demonstrations and then does the job.
What is Few-Shot Learning?
Few-shot learning is when an AI is given just a handful of examples of a task and uses them to perform it, rather than needing thousands of training examples to learn what to do.
Traditionally, teaching a machine learning system to do a task meant collecting a large labeled dataset — thousands or millions of examples — and training the model on all of them. Few-shot learning is the contrasting idea: the system manages the task after seeing only a few examples, sometimes just two or three. This is one of the headline abilities of modern large language models. Because they've already absorbed an enormous amount during their initial training, you don't have to retrain them for a new task — you simply show them a small number of examples right in your prompt, and they pick up the pattern and apply it to a new case on the spot.
In the language-model world this usually happens through the prompt itself, with no retraining at all. You write out a few examples of input-and-desired-output, then give a fresh input and let the model continue the pattern — "here are three product reviews and whether each is positive or negative; now classify this fourth one." The model isn't being permanently taught; it's recognizing the pattern from your examples and extending it for that request. This sits on a spectrum: zero-shot learning gives no examples and relies purely on the instruction, few-shot gives a small handful, and providing examples often lifts accuracy considerably, especially when the task is unusual or you want the output in a particular format. The examples act less as training and more as a precise demonstration of exactly what you mean.
Few-shot learning is valuable because it's fast and cheap — no gathering of big datasets, no training runs, just a few well-chosen examples in a prompt — which puts custom behavior within reach of anyone who can write a good prompt. The catch is that quality depends heavily on the examples: poorly chosen, ambiguous, or unrepresentative ones can mislead the model as easily as good ones guide it, and a handful of examples can't convey a genuinely complex task the way a large dataset or fine-tuning could. Picking a few examples that clearly capture what you want is itself a small skill, and a core part of prompt engineering.
Real-world example of Few-Shot Learning
Imagine you want an AI to turn messy event details into a tidy one-line format. Rather than explain the rules, you give it two examples in your prompt: "Sat 3pm, town hall, bake sale" becomes "Bake Sale — Saturday 3:00 PM, Town Hall," and "fri eve, library, book club" becomes "Book Club — Friday Evening, Library." Then you hand it a third messy line and it produces the same neat shape without being told the rules — it inferred them from your two examples. You didn't train anything or write any code; two demonstrations in the prompt were enough for the model to lock onto exactly the format you had in mind. That's few-shot learning at work.
Related terms
Frequently asked questions about Few-Shot Learning
What is the difference between few-shot learning and zero-shot learning?
The difference is how many examples you provide. Zero-shot learning gives the AI none — just an instruction — and relies on what it already knows to handle the task. Few-shot learning gives it a small handful of examples to copy the pattern from. Few-shot generally produces more reliable, better-formatted results, especially for unusual tasks, because the examples show the model exactly what you mean; zero-shot is quicker and simpler when the instruction alone is clear enough.
How does few-shot learning work?
With modern language models it usually happens entirely in the prompt, with no retraining. You write out a few examples of the input paired with the output you want, then give a new input and let the model continue the pattern. Because the model already learned broadly during its initial training, it recognizes the pattern your examples demonstrate and extends it to the new case. The examples aren't permanently teaching the model anything — they're a precise, in-the-moment demonstration of the task for that single request.
What is few-shot learning used for?
It's used to get a model to perform a specific task quickly without gathering data or retraining: classifying or tagging text, converting messy input into a fixed format, mimicking a particular writing style, or handling a niche task by showing a few representative cases. It's a core prompt-engineering technique because it's fast and cheap. It works best when a few clear examples can capture the task; genuinely complex behavior still calls for a large dataset or fine-tuning, which examples in a prompt can't fully convey.