Few-shot examples
Examples communicate what description cannot: tone, edge handling, and the exact shape of a good answer. They also teach whatever incidental pattern they share, which is why example selection is the whole skill.
Method
- Show the hard cases, not the easy ones. Examples of the obvious waste tokens; examples of ambiguity and edge cases teach the judgement you actually need.
- Vary everything that should not be learned. If every example has a short input, the model infers short inputs. Diversity prevents accidental pattern-matching.
- Include a negative or boundary case. One example of correctly refusing or handling missing data teaches the limit far better than a sentence describing it.
- Keep format identical across examples. The output shape is what examples teach most strongly, and inconsistency here undoes the benefit.
- Order from simple to complex. The last example carries extra weight, so it should represent the typical case rather than an outlier.
- Use three to five for most tasks. More rarely helps and consumes context that the actual input needs (see context-placement).
- Test with and without. Modern models often need fewer examples than expected, and unnecessary examples cost tokens and constrain creativity.
Boundaries
Examples teach pattern and format; they cannot convey knowledge the model lacks. Poorly chosen examples actively mislead, and one wrong example outweighs several correct ones. Examples containing real data carry the privacy obligations of that data (see data-minimization).