Contextcore
Few-shot examples
Show, don’t tell: a few input→output examples in the prompt.
What it is and why it exists
Examples teach format, tone and edge-case handling faster than rules. Models imitate them closely — including their mistakes and their length.
Quick prototype
Two or three hand-written examples.
In production, at scale
Pick diverse examples that cover edge cases, keep them in the cached prefix, or retrieve the most similar examples per request (dynamic few-shot). Evaluate with and without them; sometimes a clearer instruction does the same job for fewer tokens.
Vendors and tools
| LangChain example selectors / DSPy | Dynamic example selection and optimisation |
|---|
How it fails
- All examples share one pattern, so the model over-generalises it
- Examples silently disagree with the instructions
What the interviewer asks next
When would you retrieve examples dynamically?
When the input space is wide (many categories, many document types): embed past solved cases and include the nearest few, so every request gets relevant demonstrations.