Counterintuitive Lessons From Few-Shot Examples
The short version
Four counterintuitive few-shot lessons: cover boundaries rather than stacking duplicates, audit unintended stylistic patterns, replace vague warnings with concrete counterexamples, and show formatting directly.
Bottom Line
When you need consistent output, two or three sharp examples beat a wall of emphatic instructions. Yet few-shot prompting has several counterintuitive failure modes that quietly skew results.
1. More Examples Are Not Better
Ten nearly identical examples waste context and anchor the model to one narrow pattern. Pick examples to span boundaries instead:
- One canonical positive case: typical input paired with ideal output.
- One tricky edge case: a scenario where defaults usually guess wrong.
- One abstention or null case: demonstrating how to stop cleanly when input lacks required facts.
2. Models Copy Unintended Patterns Too
A model does not separate the traits you meant to teach from accidental regularities across your samples:
- If every sample answer happens to be two sentences long, the model learns to stay terse even on complex questions.
- If all examples come from one domain, generalization drops sharply outside it.
- If you accidentally repeat a filler phrase in the samples, the model echoes it everywhere.
When outputs drift, inspect your examples for accidental shared traits before piling on extra negative rules.
3. One Concrete Counterexample Beats Ten Warnings
Phrases like “handle edge cases carefully” carry almost no signal because the model cannot guess what counts as an edge case in your domain. Show an explicit boundary sample: when a required date is missing, emit null and explain the omission in reason.
4. Show Structure Instead of Describing It
Skip prose instructions like “bold heading followed by two blank lines and three bullets.” Paste one formatted example directly. For JSON payloads, pair a strict schema with one realistic sample to lock down both types and granularity.
Quick Audit
Cover the system prompt and read only your input-output pairs. Could a new teammate infer the exact rule and refusal boundary from those examples alone? If a human hesitates, the model will drift.
A saved version is open. Try again to read the latest content.
The next post, in your reader
Get new posts via RSS in Feedly, Reeder, or your preferred feed reader.