liveBook · Manning

Shot learning

As explained in Grokking AI Applications

A prompting approach that provides zero or more examples to guide the output behavior of a language model.

Shot learning guides a language model by showing examples of the output pattern you want, rather than fine-tuning its behavior. Zero-shot prompting gives instructions without examples; one-shot gives one example; few-shot gives several. section 3.1

Choose the approach according to how much guidance the task needs:

  • Zero-shot: describe the task and the expected features without an example. section 3.1
  • One-shot: include one desired response, such as a sample concise summary or title. section 3.1
  • Few-shot: provide multiple responses to demonstrate variation and formatting nuances. section 3.1

Prompting a title or classification pattern

A prompt might say, “A good title would be something like ‘X’,” or show that input “X” should produce output “Y” rather than “Z.” These examples make the intended answer type easier to emulate. section 3.1

Figure 3.3 The more examples you give the LLM, the easier the climb.

The figure reinforces how adding examples can make the desired output easier for an LLM to follow. section 3.1

How Grokking AI Applications covers it

How deep it goes
Distinguishes zero-, one-, and few-shot prompting but stays at prompt design rather than model internals.
Examples
Uses sample titles, output formats, alternatives, and good-versus-bad response pairs.
What it assumes
Assumes the ability to describe a task and its expected features, while teaching example-based prompting from basic distinctions.
What you can do after
Apply via prompt design by selecting zero, one, or several examples and observing their effect on output.
How it connects
Connects prompting with language models, fine-tuning, and GenAI applications.

Related concepts

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