One-Shot.

A prompting technique where exactly one example is provided to demonstrate the desired task format before presenting the actual query.

One-shot prompting is a technique where a single example is provided in the prompt to demonstrate the desired task format, output structure, or reasoning approach before presenting the actual query. This method sits between zero-shot prompting (no examples) and few-shot prompting (multiple examples), offering a middle ground that provides clear guidance without overwhelming the model with too many examples. One-shot prompting is particularly valuable when you need to establish a specific format or style but want to keep the prompt concise and focused.

The technique works by leveraging the model's ability to recognize patterns and generalize from a single demonstration. The example serves as a template that shows the model exactly what kind of response is expected, including structure, tone, level of detail, and any specific formatting requirements. Unlike few-shot prompting where multiple examples might introduce variability or confusion, one-shot prompting provides a clear, unambiguous reference point. The model uses this single example to understand the task requirements and applies the same pattern to the new input.

One-shot prompting is especially effective for tasks requiring consistent formatting, such as data extraction, classification with specific output structures, or creative writing with particular stylistic constraints. It's more reliable than zero-shot when format matters but more efficient than few-shot when token limits are a concern or when you want to avoid potential contradictions between multiple examples. However, the quality of the single example is critical—a poorly chosen or ambiguous example can lead the model astray more easily than in few-shot scenarios where multiple examples can provide corrective context.