Zero-Shot, One-Shot, Few-Shot
Zero-shot: No examples. Just instructions. "Classify this email as spam or not spam." Works for simple, well-defined tasks where the model already understands the concept.
One-shot: One example. "Email: 'You won $1M!' → spam. Now classify: 'Meeting at 3pm tomorrow' →" Better than zero-shot for ambiguous tasks.
Few-shot: 3-8 examples covering edge cases. This is the sweet spot for most production applications. More examples usually improve consistency up to about 8 — after that, returns diminish and you waste context tokens.
Why Few-Shot Works
LLMs are pattern-matching engines. When you provide examples, the model extracts the implicit pattern and applies it to new inputs. This is called "in-context learning" — the model learns the task from the prompt without updating its weights.
Few-shot is especially powerful for: formatting (show the output structure you want), classification (show examples of each category), and style matching (show the writing voice you need).
Best Practices
Choose diverse examples that cover edge cases, not just the easy ones. If you are building a sentiment classifier, include a sarcastic example, a neutral example, and a mixed-sentiment example — not three obviously positive reviews.
Order matters. Place the most relevant or complex example last — models pay more attention to recent context. And always test with examples that are different from your few-shot demonstrations to verify the model generalized the pattern, not just memorized your examples.