Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M9158

Few-shot Prompting

Few-shot Prompting
TechnicalmediumArtificial Intelligence
Included
account_tree

Updated 2026-08-15

Loading revision record…

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.

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/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

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.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Prompt_engineeringZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS