Communicating with LLMs
12 minLesson 6 of 14
Few-Shot Learning
Teach models new tasks through examples, as you would in real product flows
Learning goals
- •Understand few-shot learning and when to use it
- •Learn to craft effective example sets
- •Know the trade-offs between zero-shot, one-shot, and few-shot
What Is Few-Shot Learning?
Few-shot learning teaches the model by providing examples of the desired input-output pairs. Instead of explaining what to do, you show it.
Zero-Shot
No examples, just instructions. Works for common tasks.
One-Shot
Single example provided. Good for simple patterns.
Few-Shot
Multiple examples (typically 3-5). Best for complex or unusual tasks.
Crafting Effective Examples
Diversity
- Different input formats
- Edge cases
- Various output lengths
Consistency
- Same delimiters
- Same structure
- Same level of detail
Quality
- No errors
- Clear pattern
- Representative of expected inputs
Few-Shot Template
Convert the following product descriptions to marketing headlines:
Input: A comfortable office chair with lumbar support
Output: Work in Comfort: Premium Ergonomic Seating
Input: Wireless earbuds with 24-hour battery life
Output: All-Day Sound: Never Stop Listening
Input: [Your actual input here]
Output:Common mistakes
×Too few examples for complex tasks—3-5 examples usually work better than 1
×Inconsistent example formatting—variation confuses the model about the expected pattern
×Poor quality examples—errors in examples propagate to outputs
×Ignoring token costs—more examples means higher costs; find the minimum effective number
Key takeaways
+Few-shot learning teaches through examples rather than instructions
+Use diverse, consistent, high-quality examples
+Balance example count against token costs
+Few-shot is especially valuable for unusual or domain-specific tasks