Stockertim Dictionary · Artificial intelligence
Few-shot prompting
Also called few-shot, few-shot learning, in-context examples
In short
Few-shot prompting means including a small number of worked examples in a prompt so the model can follow the pattern, labels and format they show.
- Beginner
- Process
- Checked
In detail
A few-shot prompt shows rather than tells. Alongside the instruction it gives a handful of examples, each an input with the correct output, and then the new case. The model picks up the pattern from the examples: which label goes with which kind of input, how long the answer should be and how it is laid out. With a single example it is often called one-shot prompting.
Examples are powerful but literal. A model may copy surface features, such as length, wording or the order of labels, rather than the underlying rule. If every example of a complaint mentions a refund, the model may label any refund request a complaint. Good examples are varied, representative of real inputs and cover the tricky boundaries, not just the easy cases.
The model does not learn permanently from the examples; they work only inside that prompt. Results are checked on new items that were not used as examples, because accuracy on the examples themselves proves nothing.
Worked example
Northwind Bikes adds three labelled tickets to its zero-shot labelling prompt, including one about a replacement part labelled repair, and tests on 20 new tickets.
- Weak prompt: "Label each ticket as repair, refund, delivery or other."
- Improved prompt: the same instruction followed by three example tickets with their correct labels, one of them a replacement-part request labelled repair.
- Correct labels with examples: 18 / 20 = 90%, against 15 / 20 = 75% before.
- Reason: the examples show where the repair boundary lies, which the instruction alone did not.
Accuracy rises from 75% to 90% on tickets the model had not seen, and the two remaining errors are reviewed.
In practice
Teams use few-shot prompts for classification, extraction and house-style writing, keep the examples in the template, and refresh them when new kinds of input appear.
Watch out
- Examples can bias the output; vary them so the model learns the rule, not the wording.
- Never test on the same items used as examples.
Learn it properly
Official sources
- Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile · National Institute of Standards and Technology
Facts last checked on 3 November 2026.
Education, not advice: the Stockertim Dictionary explains what terms mean. It never recommends buying or selling anything.