🚀 New batches open: Advanced Excel • Power BI • SQL • AI for Analytics — Book a free demo

Day 6 — Examples and few-shot prompting

Showing beats telling. One worked example does more than three paragraphs of instruction.

Zero-shot, one-shot, few-shot

NameWhat it meansUse when
Zero-shotInstructions only, no examplesCommon tasks with an obvious answer
One-shotOne worked exampleYou need a specific format or tone
Few-shotThree to five examplesClassification, or rules hard to write down

When describing the format is hard

Some formats take longer to describe than to demonstrate. Product codes are a good example - try writing the rule in words, then just show it:

Three examples define the rule precisely: three-letter stem, uppercase, hyphenated, most distinctive attribute last. Writing that as prose would take a paragraph and still be ambiguous.

Few-shot for classification

This is where it earns its keep. Categorising support tickets, tagging expenses, bucketing customer feedback - all far more consistent with examples than with rules.

Include the edge cases in your examples If travel bookings sometimes come through a software platform, show one and label it Travel. The examples are where you resolve ambiguity - and the model will follow your ruling consistently, which is more than can be said for asking five colleagues.

Examples set tone too

"Professional tone" means nothing in particular. Two examples of your actual house style mean everything.

How many examples

Three to five is the sweet spot One example can be read as the only case. Two or three establish a pattern. Beyond about five you get diminishing returns and start eating the context window for no gain - unless the categories are genuinely numerous, in which case cover each one once.

The trap

Models follow your examples closely - including your mistakes. If one example has a typo, an inconsistent format or a wrong classification, expect the output to reproduce it faithfully.

Check your examples before you check the output When few-shot output comes back consistently odd, the fault is nearly always in the examples rather than the instructions. Read them as if you were the model: what rule do they actually demonstrate?

Try these yourself

  1. Write a one-shot prompt that converts dates into "05-Jan-2025" format.
  2. Build a few-shot prompt classifying five support tickets.
  3. Include one deliberate edge case in your examples and say why.
  4. Explain when few-shot beats writing out the rule.
  5. Give one reason few-shot output can come back consistently wrong.