liveBook · Manning

One-shot prompting

As explained in Understanding AI

One-shot prompting is a prompting technique in which a model receives one example before the task.

Ever know exactly what you want, but struggle to describe it? One-shot prompting helps by giving a language model one example before the task. The example demonstrates the expected structure or style, making the request clearer than instructions alone. section 3.2.2

A format example

Example: Electric Vehicle: Low maintenance, lower fuel costs, quieter operation. Now describe a hybrid vehicle using the same format. The model can use the example as a pattern for the requested response. section 3.2.2

Use one-shot prompting as a simple escalation path:

  • Start with zero-shot prompting when a task description is enough. section 3.2.2
  • Add one example when the response is inconsistent or the desired format is difficult to explain. section 3.2.2
  • Provide several examples when the task remains ambiguous or requires a more reliable pattern; this becomes few-shot prompting. section 3.2.2
Figure 3.4 Three common prompting approaches. In zero-shot prompting, the model receives only a task. In one-shot prompting, a single example is provided. In few-shot prompting, multiple examples are provided to establish a clearer pattern.

Compare zero-shot, one-shot, and few-shot prompting by the number of examples supplied before the task. section 3.2.2

One example can clarify what words leave underspecified, but it does not remove the need to evaluate the output. Prompt quality, verification, and human oversight still matter. section 3.5

How Understanding AI covers it

How deep it goes
Defines the technique and demonstrates its escalation from zero-shot to few-shot, without detailing model internals.
Examples
Demonstrates an electric-vehicle description guiding a hybrid-vehicle description in the same format.
What it assumes
Assumes only the ability to give a task to a language model and introduces example-based prompting from zero-shot comparison.
What you can do after
Apply one-shot prompting by adding a representative example when a task’s format or style is hard to describe.
How it connects
Connects one-shot prompting with zero-shot prompting, few-shot prompting, prompt engineering, and language-model limitations.

Also explained in

Compare how 4 books explain one-shot prompting →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Understanding AI. The section links point to the parts of the book it draws on.