Example Selection Strategies
What you'll learn: How to choose the right examples in few-shot prompts to maximize your model's task performance.
Why Example Selection Matters
When you're using few-shot prompting (showing a model several examples before asking it to perform a task), not all examples are created equal. Just like a teacher wouldn't show random math problems to explain algebra—they'd pick clear, representative ones—you need to strategically select which examples to include in your prompt.
Core Selection Principles
Representativeness
Choose examples that capture the full scope of your task. If you're building a sentiment classifier, don't show only positive reviews—include negative and neutral ones too. Your examples should mirror the variety of inputs the model will actually encounter.
Diversity
Avoid redundancy. If three of your five examples are nearly identical, you're wasting valuable context window space. Instead, select examples that cover different input patterns, edge cases, and output formats.
Quality Over Quantity
A single crystal-clear, well-structured example often outperforms three confusing ones. Ensure each example demonstrates:
- Correct input formatting
- Proper output structure
- The reasoning pattern you want the model to follow
Practical Guidelines
Balance: Include easy, moderate, and challenging examples to show the model the task's boundaries.
Relevance: Examples should be similar in style and domain to your actual use case. Don't use formal legal text examples if you're processing casual customer reviews.
Order: Some research suggests placing your strongest example first or last, as models may pay more attention to these positions.
Key Takeaway: The quality and strategic selection of few-shot examples often matters more than quantity—choose diverse, representative, high-quality examples that clearly demonstrate the task pattern you want the model to learn.