Examples and few-shot

Beginner · 6 min · Teach a pattern with 2–3 examples instead of descriptive adjectives.

  • prompting
  • examples

“Friendly but professional, a bit playful but not silly” — anyone who has written that sentence knows the result: generic-friendly mush. Few-shot prompting replaces the adjective parade with something better: show two or three input → output pairs, then hand over your real input. The model extends the pattern. That is not a trick — it is the mechanism.

Why examples win

An adjective describes a region of style. An example is a point in it — sentences, rhythm, length, level of detail, all at once. When the model continues from your examples, style and structure come along automatically. It is next-token prediction doing what it does best: continuing an established pattern.

How to give examples well

A bad example

Ask: “Rewrite these release notes in our brand voice — friendly, smart, a bit playful but not silly.”

You get a polite generic register that matches no brand — and no way to name what went wrong.

A better example

Ask: “Rewrite each release note as a short announcement, following the pattern of these two examples exactly — same structure, same length, same level of formality. Then here is the new input: …”

The examples carry tone, structure and granularity; your instruction only has to carry the task.

Why it works

Every example narrows the plausible space like a constraint you never had to verbalise. It is also the most testable prompting technique: when output misses, the fix is usually an example edit, not a longer instruction. Keep your best pairs as reusable prompt assets — three good examples outlive several rounds of prompt wording.

One maintenance tip: when a pattern prompt produces a great result, save it with the examples intact. The examples carried the value — swapping them for a new task is usually a smaller edit than writing a fresh prompt, and the pattern keeps paying without being re-derived.

Practice

Which prompt shows instead of telling?

You want release notes rewritten as short customer announcements in your brand's rhythm — a style reviewers always describe differently.

Which prompt is more likely to reproduce the intended style?

Choose one option
Hint

Which prompt could a new teammate follow without asking a single follow-up question?

Transfer

Next

Next: Work with long input — a chunked process for documents that don’t fit in one pass. The few-shot prompting glossary entry is the one-line version.