Cognition · Software component
Exemplar Selector
Software componentCognitionCognition & MemoryVariation point (abstract)arc:ExemplarSelector
An abstract component that chooses which demonstration examples from a demonstration pool are placed into a prompt, and in what order, for in-context learning.
Responsibility. Composes the demonstration block used for few-shot prompting.
Also known as: Demonstration selector, Few-shot example selector
Variants
| Variant | When to choose |
|---|---|
| Cluster-Diverse Exemplar Selector | Choose when demonstrations must cover diverse problem types and reasoning chains are to be generated automatically rather than written manually. |
| Coreset Exemplar Pre-selector | Choose when the demonstration pool is large or noisy and a compact core subset satisfying sufficiency and necessity is needed. |
| Similarity Exemplar Selector | Choose when accuracy gains justify per-query retrieval cost; computational cost becomes high on large demonstration pools. |
Relationships
is invoked by dependency
reads dependency
Design guidance
- SHOULD start with 2-3 examples and add more only when evaluation shows clear improvement.
- SHOULD place the most representative example last and order examples progressively from simple to complex.
- SHOULD NOT rely on random sampling from available data.
- SHOULD NOT add examples for tasks the model already handles zero-shot.
Quantitative guidance
As stated by the sources; verify before use.
- Typical few-shot uses 2-5 demonstrations; performance plateaus or declines after 5-8 (Ch3.5).
Classification
- Patterns
- Few-shot in-context learningRecency-aware orderingSimple-to-complex ordering
- Quality attributes
- Functional suitability: correctness and validity (ISO/IEC 25010 | NIST AI RMF: valid)Cost efficiencyPerformance efficiency (ISO/IEC 25010)
- Risks mitigated
- High variance from random demonstration selectionToken waste from excessive examplesRecency bias
Sources
- Ch3.5: T. Nguyen, "Prompt Optimization, Few-Shot Learning, Fine-Tuning," in Mastering Agentic AI Systems: Guide for the NVIDIA NCP-AAI Exam, 1st ed. 2026, ch. 3.5. ISBN: 9798244538229.