Few-shot
also called In-context examples
Show a handful of examples and let the model pattern-match.
Including several input/output examples in the prompt so the model infers the intended mapping — especially useful for output formats, edge cases and label conventions.
Examples are the most reliable way to pin down a format. Include the awkward cases deliberately: the empty input, the one with two categories, the one that should be refused.
Examples are the most reliable way to pin down a format, because the model copies structure it can see far more faithfully than structure it is told about. The strategic point is what you choose to show: the borderline cases teach the boundaries, and the common cases mostly waste tokens.
Examples as an edge-case specification
Extraction returns a value for fields that are genuinely absent.
Two examples fix it: one where a field is present, one where the correct answer is null and why. Showing the hard case is worth more than ten examples of the easy path, because the hard case is where the instruction was ambiguous.
- paperLanguage models are few-shot learners ↗
Introduces GPT-3 at 175B parameters and shows that scale alone produced in-context learning: performance from examples in the prompt, with no gradient updates.
- docsPrompting best practices ↗
The current house guidance on explicit instructions, output constraints, examples, XML structure and role prompting.
Zero-shot
Just ask, with no examples.
Prompt Engineering
The craft of writing instructions a model reliably follows.
Structured Output · JSON mode
Making the model return data your code can parse.
Fine-tuning
Extra training on your own examples to change how the model behaves.