Skip to content
// ai glossary

Few-shot prompting explained with examples

Giving the AI a few examples of the output you want inside your prompt.

Quick example: Two sample taglines, then: 'Write 3 more in this style.'

Last reviewed

In plain English

Few-shot prompting means including a few examples of the result you want inside your prompt. The AI reads the pattern in your examples and follows it. The name comes from "shots", meaning examples.

  • Zero-shot: no examples, just an instruction.
  • One-shot: one example.
  • Few-shot: a handful of examples, usually two to five.

A simple example

Say you want short, punchy taglines in a particular style. Instead of describing the style at length, show it:

prompt
Write 3 taglines for a reusable water bottle. Match the style of these examples.

Example 1: Hydration, without the waste.
Example 2: Fill up. Go far.

Keep each under 6 words. No exclamation marks.

The model picks up the length, rhythm and tone from the examples. That is often quicker and more accurate than explaining the style in words.

When it helps

  • A specific format, such as a table, a label or a fixed sentence pattern
  • A particular tone or voice
  • Classifying or labelling text, where you show a few labelled cases first
  • Anything you struggle to describe but can show

Tips

  1. Make the examples different from each other, so the model copies the style and not one specific wording.
  2. Keep the format identical across examples.
  3. Use real, good examples. The model will copy their mistakes too.
  4. Two to five is usually enough. More examples use more of the context window.

Common mix-ups

  • Few-shot is not training. The model is not changed. It only sees your examples for that conversation.
  • Examples can over-steer. If every example starts the same way, the answers may too.
  • PromptThe instructions or question you give an AI.
  • System promptHidden instructions a developer gives a model to set its role, rules and style before the user starts chatting.
  • TemperatureA setting that controls how random or creative a model's output is. Low = more predictable, high = more varied.

Keep reading