One-shot prompts: show the desired pattern with one example
A one-shot prompt gives a model one example of an input and its desired output along with the task instructions. Zero-shot uses no task example; few-shot uses several. One example can make a label or output style easier to understand than a description alone, but it cannot define every case, so check its effect on real inputs.
A one-shot prompt gives a model one example of an input and its desired output along with the task instructions. Zero-shot uses no task example; few-shot uses several. One example can make a label or output style easier to understand than a description alone, but it cannot define every case, so check its effect on real inputs.
What does “one” count?
It counts one in-prompt demonstration pair. For example, showing one customer message together with the classification you want is one-shot. The new message the model must process is the task input, not another demonstration. This count is also separate from whether the model encountered similar tasks during training.
The GPT-3 study compared zero-shot, one-shot, and few-shot settings without updating model parameters during evaluation: the settings differed in how many demonstrations appeared in the prompt. A one-shot prompt sent to an API is generally not a model-training procedure either. Outcomes vary by model and task; one example does not guarantee an improvement.
How should you choose the example?
A useful example makes an important rule visible rather than merely repeating an ordinary input. Check that it is:
| Check | Question | Customer-message example |
|---|---|---|
| Representative | Does it resemble actual inputs? | A short, natural customer message |
| Informative | Does it show an important decision boundary? | A clear complaint mapped to the negative label |
| Consistent | Does its answer follow the written rules? | The label agrees with its definition |
| Format-matched | Does it use the exact requested output shape? | The required JSON key and value |
| In scope | Does it avoid mixing in unrelated tasks? | No refund promise or diagnosis in a sentiment example |
If the instruction says “Classify the customer message as positive, neutral, or negative and return JSON only,” a demonstration could be:
Example input: “Thanks for explaining. I know what to do now.”
Example output: {"label":"positive"}
New message: “<insert the actual message>”This illustrates positive gratitude and the JSON shape. It does not define mixed sentiment, missing information, or neutral cases. If those distinctions matter, state the rules and uncertainty handling or add examples only after evaluation reveals a need. Packing several rules into one example can obscure the pattern.
When should you use one-shot instead of zero-shot or few-shot?
Start with zero-shot when rules are easy to explain and you want a baseline. Try one-shot when a single representative example can clarify an output pattern or decision boundary. Few-shot may help when several input types require different decisions or one example cannot communicate the pattern.
Examples carry both information and potential bias. A poorly labeled or unrepresentative example can teach the wrong rule; an example that conflicts with the instruction can confuse the model. OpenAI’s prompt guide recommends varied demonstrations that closely match the instructions. Needs also differ by model type, so check with the model you plan to use.
| Method | Task examples in the prompt | Useful starting situation | Caution |
|---|---|---|---|
| Zero-shot | 0 | Rules can be stated directly; establish baseline behavior | The model may infer unstated criteria |
| One-shot | 1 | One example shows a key pattern or boundary | It may not represent the full input range |
| Few-shot | Several | Multiple cases are needed to show different decisions | Examples may conflict or consume context |
This is a practical selection guide, not a performance prediction. Consider actual outputs and input-token limits; example count alone does not determine quality or cost.
How can you evaluate a one-shot prompt?
Compare it with a version that has no demonstration. For a customer-message classifier, one reproducible approach is:
Prepare review inputs with common cases, mixed sentiment, short wording, and uncertainty. Keep these separate from the demonstration shown in the prompt.
Run the zero-shot version using the same model version, settings, and review inputs.
Inspect errors, then add one representative demonstration that addresses a specific recurring boundary.
Compare label correctness, JSON validity, uncertainty handling, and error patterns across input types.
Check whether any improvement holds across the full evaluation set; version the prompt and example.
This is an illustrative evaluation plan, not a test performed here or a measured result. A real evaluation needs reference labels and review criteria. Keep demonstration examples out of the evaluation set when possible, so copying a shown example is not mistaken for generalization.
What if one example is not enough?
Before adding more examples, check whether the first one matches real user inputs, agrees with the instructions, and uses the required output shape. If rules and example agree but a recurring boundary case still fails, clarify the criteria in words or compare a few-shot version with distinct examples.
Prompt examples do not replace application safeguards. Implement JSON parsing and schema checks, server-side permission checks, and review paths for consequential results separately.
Takeaway
One-shot prompting uses a single in-prompt demonstration to show a desired pattern. Choose an example that is representative and consistent with the rules, and state any conditions it does not cover. Compare it with zero-shot on the same evaluation inputs before keeping it.
References
[OpenAI API: Prompt engineering](https://developers.openai.com/api/docs/guides/prompt-engineering) — explains demonstrations in prompts and why varied input/output examples matter.
[OpenAI API: Reasoning best practices](https://developers.openai.com/api/docs/guides/reasoning-best-practices) — recommends trying reasoning models without examples first, then adding them if complex requirements remain.
[Brown et al., Language Models are Few-Shot Learners (2020)](https://arxiv.org/abs/2005.14165) — distinguishes zero-, one-, and few-shot settings and reports task- and model-specific variation.