Automation and AI

Few-Shot Prompting

Also called Few-shot learning, in-context examples

Including a handful of worked examples in the request so the model copies the pattern instead of guessing what you meant.

Quick facts: Few-Shot Prompting

Category
Automation and AI
Also called
Few-shot learning, in-context examples
Level
Intermediate
Affects
Output format, tone consistency, classification accuracy
Where to see it
Any chat assistant, saved prompt templates, model APIs
In this article4
  1. How few-shot prompting works
  2. Why few-shot prompting matters
  3. Common mistakes with few-shot prompting
  4. How to act on it

How few-shot prompting works

Instead of describing the output you want, you show it. The request contains a small set of worked pairs — this input, that output; this input, that output — and then the real input with the output left blank. The model continues the pattern it can see, which is the thing it is best at doing.

Asking with no examples at all is often called zero-shot, and for straightforward jobs it is perfectly adequate. Examples earn their place when the requirement is a shape rather than a subject: a particular way of writing product descriptions, a fixed set of categories to sort enquiries into, a house style for meta descriptions, or the specific way your team phrases an apology.

Why few-shot prompting matters

It solves the problem that adjectives cannot. Telling a model to write in a tone that is professional but warm produces whatever that phrase averages out to across everything ever written. Showing it three pieces of your own writing communicates the tone precisely, including the habits you would never think to describe, such as sentence length or how you open.

It also makes output consistent enough to use in a process. If several people run the same task, or the same task runs every day, examples pin the format so the results can be compared, pasted into a spreadsheet, or fed into the next step without someone reformatting them each time. That consistency is usually worth more than any single output being brilliant.

Common mistakes with few-shot prompting

Choosing examples that are all alike is the first. If every one is a short product with a simple name, the model learns that shape and applies it to the complicated cases too. Include an awkward one — the long name, the item with a caveat, the enquiry that could fall into two categories — and show how you want it handled.

Using flawed examples is the second, and it is worse than having none. The model copies what it sees, including a typo, a missing detail or a claim you cannot support, and it will reproduce that fault across everything it touches.

The third is forgetting that examples are not free. They are sent with every request, so they consume budget and part of the context window each time. Long examples on a high-volume task get expensive quietly.

How to act on it

Pull the examples from work you have already approved rather than writing them for the occasion. Pick a handful that differ from one another, include at least one difficult case, and check each is genuinely correct before it becomes the pattern for everything that follows.

Keep them in a template with a blank for the real input, so the same set gets reused rather than reassembled. Trim to the fewest examples that hold the format, since each one costs tokens on every run. If you find yourself needing many examples for the same task repeatedly, that is the point at which fine-tuning becomes worth investigating — but only then, because a good template is far cheaper to maintain.

Do and do not

Do

  • Use examples from work you have already approved
  • Include one awkward case, not only easy ones
  • Keep the set in a reusable template with a blank input

Do not

  • Use an example containing an error you would not publish
  • Make every example the same shape
  • Forget that examples are paid for on every request

Questions people ask about this

How many examples should I include?

Enough to make the pattern unambiguous and no more, because each one is paid for on every request. Start with a small set that covers your normal case plus one awkward one, test on real inputs, and add another only when you see a specific failure it would fix. If the output is already consistent, extra examples are cost without benefit.

Is few-shot prompting better than just explaining what I want?

For format, tone and classification, showing usually beats describing, because those are things people struggle to put into words precisely. For tasks involving reasoning or judgement, a clear explanation of the goal and the constraints often works better. Many good prompts do both: a short instruction for the purpose, then examples for the shape.

Does this train the model to remember my style?

No. The examples only apply to the request they are sent with; nothing is retained afterwards unless you are using a feature that deliberately stores context. That is why the examples must be included every time, and why keeping them in a saved template matters. Permanently changing a model's default behaviour requires fine-tuning, which is a separate and heavier undertaking.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.