Learning from a few examples
Few shot prompting places several input and output examples in the prompt before the real input. The model infers the pattern from these demonstrations and applies it, without any weight updates. This is sometimes called in context learning.
Why examples help
- Format anchoring shows the exact shape the answer should take.
- Edge cases can be demonstrated so the model handles them consistently.
- Tone and style are picked up from how the examples are written.
Designing good examples
- Keep them representative of the real inputs you expect.
- Cover variety, including a tricky case, not just the easy ones.
- Stay consistent in formatting so the pattern is unmistakable.
Tradeoffs to watch
Each example consumes context tokens, so more is not always better. Three to five strong examples often beat a dozen weak ones. Examples can also bias the model toward their specifics, so balance the set rather than stacking similar cases.
Key idea
Few shot prompting demonstrates the task with a small set of examples so the model copies the pattern, improving format and consistency at the cost of extra tokens.