few-shot prompt
in English: few-shot prompting
An instruction where you show the artificial intelligence a few worked-out example cases so it can solve your task in the same style and format based on them.
In plain terms
Imagine you are training a new colleague. You can tell them to "write a polite reply letter to complaints", but it is much safer to give them three previous, successful letters. You do not need to explain the tone, length, and structure at length, because they will read it from the examples. Few-shot prompting is the same with a language model: you add two or three (rarely ten or twenty) examples to the request.
It is most useful when it is hard to put into words what you want but easy to show: a specific tone, a fixed table format, or an internal company categorization. The model infers the rule from the examples and applies it to your new case.
From this, the model learns nothing permanently. Examples only affect the current conversation, like a cheat sheet during an exam. If you start a new conversation, you usually have to show them again.
How it works
- You formulate the task in one or two sentences, for example: 'Categorize the following customer reviews into positive, neutral, or negative.'
- You add several input–output pairs: an opinion and the correct label, then another, and another. It is advisable to choose varied examples to cover rarer cases.
- At the end, you write the new case to be solved in the same format, leaving only the answer blank.
- The model formulates its response based on the entire preceding text, including examples, so it follows the pattern of the examples: it answers in the same format, length, and style as seen in the samples.
- If the result goes off track, you fix the examples: you replace the misleading one, add a missing case, or change the order.
An everyday example
You want ChatGPT to write your webshop product descriptions in your usual, casual tone. You paste three of your previous descriptions, then provide the new product data, and the model writes the fourth in the same style and similar length.
Who is affected
A common misconception
Limits and risks
- The model may cling too strongly to patterns: it can adopt the theme, phrasing, or length of examples even if something else would fit the new case better.
- Bad or one-sided examples yield bad results: if all your samples are positive opinions, the model will tend to label everything as positive.
- Examples occupy space in the model's finite working memory (context window), and in paid usage, they increase costs with every request.
- Do not copy personal data or trade secrets into the examples, as they reach the AI provider just like the rest of your request.
Similar, but not the same
- zero-shot prompt (a prompt without examples) – There, you simply describe the task without providing examples, and the model relies solely on its general knowledge.
- Fine-tuning – Fine-tuning usually involves many examples and further training to permanently alter a model's internal settings. A few-shot prompt only provides a sample for the specific request at hand.
- Chain-of-thought – Chain-of-thought prompts the model to derive the solution step by step, while few-shot prompting provides ready-made examples. The two can be combined: the examples themselves can include the derivation.
Related concepts
One-shot prompt
zero-shot prompt (a prompt without examples), Chain-of-thought, Fine-tuning, Kontextusablak, Rendszerprompt
A brief history
In machine learning, the term "few-shot learning" has long meant that a system learns from a few examples. The method of putting examples in the prompt became widely known in 2020, when OpenAI researchers, in their paper introducing the GPT-3 model, "Language Models are Few-Shot Learners", showed that a large language model can solve many kinds of tasks from a few examples, without retraining.
Where things stand
By the end of 2026, it is one of the basic techniques of prompt writing, and the official guides of major AI developers also recommend it. Today, models solve many tasks well even without examples, so examples are mainly used to ensure precise format, tone, and consistency. With reasoning models, developers often suggest trying first without examples, as too many examples can even worsen the result.
In the news
- Fully automated excavators deployed on construction sites; Skild AI unveils S1 robot foundation modelAug 31, 2026 · Ipar
Also known as
few-shot prompt · few-shot prompting · few-shot learning · few-shot learning · few-shot prompting · few-shot prompt · multishot prompting · in-context learning
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.