Few-shot Prompting
Updated 2026-08-15
Summary
Few-shot prompting gives a language model a handful of examples so it can infer the task without any retraining.
Definition
Few-shot prompting places a small number of input-output examples, typically three to five, inside the prompt so the model infers the task format and pattern from them, a behaviour known as in-context learning. The model's parameters are not updated. The qualification is that example quality and consistency matter more than quantity, since contradictory or noisy examples degrade performance rather than improving it.
Introduction
How to use
- Use Example Selection: pick a few examples that cover the boundary cases of the task. - Use Format Consistency: keep every example in the same structure so the pattern is unambiguous.
Mechanism
The model conditions its output on the whole prompt, so examples act as a specification expressed in the target format rather than in instructions. Because the pattern is demonstrated rather than described, formats and edge-case handling that would be tedious to state in words are conveyed directly.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- Providing several English to French pairs lets a model translate a new sentence correctly.
- A few labelled samples are enough for a sentiment classification task without any fine-tuning.
Common pitfalls
- Including contradictory or low-quality examples that mislead the model, assuming more examples always help when noisy ones actively hurt, and overlooking the effect of example order.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/Prompt_engineeringverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS