SESSION 2 · ~40M
Few-shot: steering with examples
Two or three concrete examples almost always out-specify three paragraphs of description — show, don't tell.
Few-shot prompting means including a small number of input-to-output examples inside the prompt itself. The model infers the pattern and applies it to your real input — no training, no fine-tuning, just demonstration.
Examples beat instructions
It is notoriously hard to describe a format or tone precisely in prose (concise but warm, one-line summary then three bullets). One or two examples communicate the exact same thing unambiguously. The examples become the spec.
- Pick examples representative of the real inputs — edge cases in your examples become edge cases in the output.
- Match the format exactly: spacing, punctuation, and casing all 'contagiate' from your examples to the model's output.
- Use a consistent delimiter (e.g., 'Input:' / 'Output:') so the model can't confuse examples with the live question.
Format contagion is real and powerful: if every example ends with a period and a citation, the model will too. Use it deliberately to enforce structure — and watch for it as a bug source when your examples are inconsistent.
How many examples? Usually two or three. More can help for subtle tasks but eats your context window and can over-fit the model to the examples' quirks. Start with the fewest that reliably work, add only when quality drops.
TRY IT
Ask a model to classify three short reviews as positive, neutral, or negative. Do it once with only instructions, then again with two labeled examples. Compare consistency — the few-shot version almost always wins, especially on borderline cases.
CHECK YOUR UNDERSTANDING
Why do a few examples often out-specify a longer prose description of the desired format?
What is 'format contagion' in few-shot prompting?
How many few-shot examples does the module recommend starting with?
NOTEBOOKLM
Connect your notebook
Paste a NotebookLM share link to embed your notebook for this module.