Few shot learning teaches an AI model a task with a few examples placed in the prompt. Learn how it works, how it differs from fine-tuning and how to use it.

On this page
Summary
Few shot learning is a technique in which a language model learns a new task from a small number of examples, usually a handful, placed directly in the prompt. Each example shows an input and the output you want. The model infers the pattern and applies it to your question, without changing its weights.
Want to go further? Ask
Few shot learning is the practice of showing a language model what you want before you ask your real question. You place a few input and output pairs in the prompt, and the model copies the pattern they set. It is also called in-context learning, because the learning happens inside the prompt rather than inside the model. Showing examples is one of the simplest ways to get consistent output from AI, which is why this technique matters for anyone who relies on it for content.
Few shot learning works in three steps. You write an instruction, add a small set of labeled examples, and then add the new input you need answered. The model reads the examples, identifies the common pattern, and produces an output that matches it. Nothing is stored in the model afterward: the guidance lasts only for that single prompt. OpenAI describes the method as a way to steer a large language model toward a new task by including a handful of input and output examples in the prompt, rather than fine-tuning the model.

The idea comes from research on very large models. In the 2020 paper Language Models are Few-Shot Learners, the authors trained GPT-3, a model with 175 billion parameters, and showed that it could perform many language tasks from a few demonstrations in its prompt, with no gradient updates or fine-tuning. That finding is the reason few shot prompting is now a standard technique rather than a research curiosity.
These three terms describe how many examples you include. Zero-shot gives no example and relies on the instruction alone. One-shot gives a single example. Few-shot gives several, usually a handful. The more a task depends on a specific format or judgment, the more examples help. For a simple job such as translating a short sentence, the model often needs no example at all. For a niche job such as sorting support tickets into your own categories, a few examples remove most of the guesswork. The contrast is covered in more detail in our guide to zero-shot learning.
Use three to five examples in most cases. Anthropic's prompting documentation recommends including 3 to 5 examples for best results, and it advises making them relevant to your real use case, diverse enough to cover edge cases, and wrapped in clear tags so the model can tell them apart from instructions. Adding more examples has a cost: each one uses part of the context window and adds tokens to every request. Stop when the output is consistent, not when the prompt is long.
A simple few-shot prompt for classifying product reviews looks like the example below. The first three reviews set the label format, and the last review, which has no label yet, is the one the model must complete.
Review: I absolutely love these headphones, the sound is amazing.
Sentiment: Positive
Review: The battery dies after two hours.
Sentiment: Negative
Review: The delivery was fine, nothing special.
Sentiment: Neutral
Review: The ear pads feel cheap but the bass is strong.
Sentiment:
The model will usually answer with one label, because every example ends with exactly one label. If you want the answer in a different format, such as JSON, change the examples as well as the instruction, so that the demonstrations show the format you expect.
Few shot learning and fine-tuning both adapt a model to a task, but they differ in cost and permanence. Fine-tuning changes the model's weights with a training dataset, which takes time, data and engineering. Few shot learning changes nothing in the model and works through examples in the prompt, so you can test an idea in minutes by editing the prompt. Start with few shot when you need to test quickly. Consider fine-tuning only when a task runs at high volume and must behave the same way every time, something examples in the prompt cannot guarantee.
Few shot learning fits tasks where a format or tone matters: summaries in a fixed style, support replies with a consistent voice, meta descriptions that follow one structure, or structured extraction into a schema. For marketing teams, the same method produces FAQ answers, intent labels for search queries and tables that follow one layout. It needs no engineering, which is why it is usually the first technique teams try. For the wider set of methods, see prompt engineering, and for a practical walk through prompts with examples, read our guide to AI prompts.
Quality matters more than quantity. Pick examples that look like the inputs you will receive in production, and include edge cases such as unclear wording or an unusual category. Examples that all look alike teach the model to copy their surface rather than the task. Keep the format identical across examples, label every input and output, and order them logically. When results drift, replace the weakest example before you add more.
For SEO and GEO, few-shot learning is how you keep AI-assisted content consistent across many pages. A model shown two or three examples of your meta description format, your FAQ answer style and your product summary will repeat that structure, which makes the output easier to review and publish. Clear, repeatable structure also makes pages easier for AI assistants to read and reuse. Sorank's keyword research finds the questions people actually type, and those questions make strong examples because they reflect real demand.
Few shot learning teaches a language model a task by example. You place a handful of input and output pairs in the prompt, and the model applies their pattern to your question without any retraining. Start with three to five representative examples, keep the format identical, and check the output before you add more. For larger, repeated work, compare the method with zero-shot prompting and model fine-tuning to choose the right level of effort.
Sources
Few shot learning is teaching an AI model a task by giving it a few examples directly in the prompt, each showing an input and the output you want. The model finds the pattern and applies it to your real question. Nothing inside the model changes, which is why it is also called in-context learning.
Fine-tuning changes the model's weights with a training dataset, which takes time, data and engineering. Few shot learning changes nothing in the model and works through examples in the prompt, so you can test it in minutes. OpenAI presents it as a way to steer a model to a new task without fine-tuning.
Start with three to five examples that represent the variety of inputs you expect. Anthropic's documentation recommends 3 to 5 examples for best results. Stop adding examples once the output is consistent, because each example uses part of the context window.
