Few-shot learning means putting a handful of examples in the prompt so the model infers what you want. Nothing is trained and no weights change.
It is the fastest way to pin down a format. Describing an output structure in words is slow and ambiguous; showing three examples of it is neither.
Think of it like this. Think of showing someone three completed forms rather than writing instructions for filling one in. They will match the pattern immediately, including details you would have forgotten to mention.
How it works
- Examples go in the prompt, as input and output pairs.
- The model infers the pattern and continues it for your real input.
- Nothing is learned. The next request knows nothing about this one unless you send the examples again.
- Two to five examples is the usual sweet spot. More rarely helps and always costs tokens.
When to use it
- Fixing an output format, which is where it is strongest.
- Teaching a tone or style that is hard to describe.
- Edge cases, by including one that shows the handling you want.
- Not when you have thousands of examples. At that point fine-tuning is cheaper per request.
Common mistakes
- "The model learns from my examples." It does not. Nothing persists between requests, and every call pays for the examples again.
- "More examples is better." Gains flatten quickly. Twenty examples usually costs tokens without beating five.
- "Any examples will do." The model copies what it sees, including inconsistencies. Sloppy examples produce sloppy output.
- "Order does not matter." It can. Models show recency bias, so the last example carries more weight than the first.