How do you choose few-shot examples, and when do examples hurt?
Answer
Model answer, written in a candidate's voice
In short
- Start from the output contract and failure modes, then pick examples that are representative, diverse, edge-case-aware, and labelled consistently
- Show the desired format and reasoning, not just the final label
- Use dynamic few-shot retrieval from a curated bank per query, with diversity and label-balance constraints
- Watch for harm: surface-feature copying, label imbalance, recency bias, token cost, and zero-shot can beat examples for strong reasoning models
- Ablate presence, order, and selection on a held-out eval set before shipping
In full
I treat few-shot examples as a small, controlled prompt, not a pile of random inputs: I define the task, output format, and reasoning style first, then choose examples that are representative of the real distribution, cover edge cases, keep labels consistent, and show the exact format and reasoning I want. For dynamic few-shot, I keep a curated bank and retrieve examples similar to each query, while enforcing diversity and label balance so the prompt does not become a biased mini-dataset. Examples hurt when they make the model copy surface features like phrasing, length, or a dominant class, when the bank is imbalanced or recency-skewed, when they add tokens without improving accuracy, or when a strong reasoning model does better zero-shot with clear instructions and constraints. So I do not ship examples by intuition; I ablate their presence, order, and selection on a held-out eval set, including label balance and token cost, and keep the best configuration or fall back to zero-shot when examples do not help.
What a strong answer covers
- Representative, diverse, consistent labels, edge cases, the desired format and reasoning
- Dynamic few-shot: retrieve similar examples from a bank per query
- Harm: copying surface features, label imbalance, recency bias, token cost; strong reasoning models sometimes do better zero-shot with clear instructions
- Ablate presence and order on an eval set
Common mistakes
- Near-duplicate examples
- examples that contradict the instructions