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

  • Match the real shape. Examples must look like the actual input; a format you would never receive teaches the wrong pattern.
  • Two or three pairs. One is a point; three are a trend.
  • Vary them deliberately. Identical phrasing in every example → outputs that clone your words instead of the style.
  • Include one hard case if you have it. The edge case teaches the boundary faster than a rule.
  • Then give the real input clearly — labels like “Input:” and “Output:” keep the roles obvious.

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.

A brand-voice prompt made of adjectives keeps producing generic mush. What does this lesson say to do instead?

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

  • Brand voice: two approved paragraphs beat any tone adjectives.
  • Data extraction: show two “messy line → clean fields” pairs.
  • Support replies: three example answers per category; the model inherits the policy.

Key takeaways

  • Two or three input to output pairs teach a pattern that adjectives cannot.
  • Match the real shape, vary the pairs deliberately, include one hard case.
  • When output misses, edit the example — not the instruction wording.

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.

Finished this lesson?