Few-shot prompting
Showing the model two or three worked examples of the task inside the prompt, instead of only describing it.
Few-shot prompting works because pattern completion is what these models do best. Describing an output format in words leaves room for interpretation; showing two examples of it does not.
It is most valuable when the format is unusual, the labels are yours rather than standard ones, or the edge cases matter. Keep examples short, make them cover a hard case rather than three easy ones, and keep them consistent - a single inconsistency in your examples will be reproduced faithfully.
The cost is context. If examples grow past a few hundred tokens and the task is stable, that is the point where fine-tuning starts to pay.
Tagged
Where this comes up
Prompts, configs and tutorials in the library that touch this term.
- GuideUniversal
What a prompt actually is
The three parts every working prompt has, why their order changes the answer, and how to tell a vague prompt from a specific one.
- GuideUniversal
Working with long documents and code
Why long sessions drift, what a large context window actually buys you, and how to keep a model on task across a big input.
- GuideUniversal
Giving a model a role and constraints
How naming the audience, the format and the exclusions turns unpredictable answers into repeatable ones.
No-padding everyday default
The one to set if you set only one. Answer first, nothing before it, nothing after it, and no offer to help further.
Tested on Claude Sonnet · May 2026
- CheatsheetUniversal
Forcing an output format that holds
The phrasings that actually constrain output, and the ones people use that do not. Tested by asking for the same thing twenty times and counting the…
Tested on Claude Sonnet · May 2026
- PromptUniversal
Extract structured data as JSON
A strict extraction prompt that returns valid JSON only, with nulls for missing fields instead of invented values.