Back to Glossary

Few-shot prompting

Synonyms: in-context learning, example-based prompting, multi-shot prompting, demonstration prompting, k-shot prompting

Do not index

Definition

Few-shot prompting is a prompting technique where you give an AI a small number of examples before asking it to complete the real task.
Instead of describing the output you want, you show the pattern directly through sample inputs and outputs.

Use cases

Without examples, AI outputs often become generic, inconsistent, or off-brand.
  • Microcopy generation: A model writing error states may produce long, robotic messages unless you provide examples of short, product-style copy.
  • Research synthesis: AI summarization improves when examples show the difference between raw observations and useful insights.
  • Content formatting: Structured examples help models follow exact layouts for tables, tags, or labels.

How it's used in practice

  • Pick 3–5 diverse examples that cover edge cases, not just happy paths
  • Match the exact input/output format you expect returned
  • Order examples thoughtfully — the last one often weighs heaviest
  • Always test zero-shot first; only add examples if quality drops
  • Version-control your example sets like you would code
🪄
Pro-tip: Bad examples are worse than no examples. The model will faithfully copy your mistakes: typos, formatting quirks, off-brand tone, all of it. Audit examples carefully.

Challenges & limitations

  • Context window bloat: Too many examples eat up your token limit, making prompts expensive or cutting off the actual response.
  • Example bias: If your three examples are all "success messages," the AI might struggle if you suddenly ask it to write a "warning" in the same prompt.

Free resources

 
notion image

Share this post

Get free UX resources

Get portfolio templates, list of job boards, UX step-by-step guides, and more.

Download for FREE
 
 
 

The best email 📮 for growing 🌱 designers

 
Honest notes about the work behind the work. Read in 2 minutes, weekly. Free forever.
 
 
     
    notion image
     
    Join 13,045 designers and get tactics, hacks, and tips.