esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

Zero-Shot vs Few-Shot Prompting?

Zero-shot gives a model only instructions, few-shot adds worked examples. How each works, when examples pay off, and their risks, for your AI interview.

In short

Zero-shot prompting gives the model a task with no examples. Few-shot prompting adds a few worked examples to the prompt, so the model copies the pattern. Examples steer format and judgement, but they cost space on every call and can skew the answers.

12 min readBeginnerVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Zero-shot means I ask the model to do a task with only my instructions. Few-shot means I also paste a few finished examples first, so it copies the pattern. I start with zero-shot because it's cheap. If the model keeps getting the format or the labels wrong, I add three to five examples that cover the real edge cases, then measure again. Examples cost space on every call and can skew the answer, so they have to earn their place.

What are zero-shot and few-shot prompting, in plain words?

A prompt is the text you send a model: the task, any context, and the question. Zero-shot prompting sends the task with no examples. Few-shot prompting adds a few finished examples first, so the model can see the pattern you want.

Neither one changes the model's weights, the numbers inside it. The examples only live in the prompt for that one call. Researchers call this learning from the prompt alone, or in-context learning.

Think of a new claims clerk. On day one she reads the handbook, which is zero-shot: the rules, but no cases. On day two she sits beside a senior colleague and watches three finished decisions before she touches a claim, which is few-shot. An insurer's triage model works the same way. The handbook is the instruction, and the three decisions are the examples.

Key words

Zero-shot
A task sent with instructions only, and no examples.
Few-shot
The same task, with a few worked examples in the prompt.
Demonstration
One worked example inside a prompt. The paper that named these settings uses this word.
In-context learning
Picking up a pattern from the prompt alone, with no retraining.

How does few-shot prompting steer the model?

Few-shot prompting works like that day-two watching, done in text. The model reads the examples as part of its input, notices the shape of each answer, and copies that shape for the new case. OpenAI and Anthropic both describe examples as a way to steer the output.

  • “Few-shot learning lets you steer a large language model toward a new task by including a handful of input/output examples in the prompt, rather than fine-tuning the model.”

    OpenAI

  • “A few well-crafted examples (known as few-shot or multishot prompting) improve accuracy and consistency.”

    Anthropic

Same task, with or without examples

Zero-shot

Instructions only

task and labels, no examples

Few-shot

Instructions plus examples

same task, labelled cases first

Model

reads the whole prompt as text

One label

from your list of labels

  1. 1The task and the label list go in, with nothing else.
  2. 2The same task goes in, with three labelled claims first.
  3. 3The model returns one label from the list.
Zero-shot sends only the task. Few-shot sends the same task with labelled examples first. Both go to the same model, which returns one label, so only the prompt changes.

The GPT-3 paper defines these settings. Its zero-shot setting allows no demonstrations, only an instruction in natural language. Its few-shot setting fills the prompt with as many demonstrations as fit in the context window, and one-shot sits in between with a single example.

Zero-shot is the right first try when the model already knows the task and the output can be loose, such as a friendly summary of a meeting. Anthropic's guide says Claude responds well to clear, explicit instructions, so a clear zero-shot prompt is a fair place to start.

When do examples help, and what do they cost?

  • Zero-shot

    Short and quick

    One short prompt per call. Good when the model already knows the task and the output can be loose.

  • Few-shot

    Steers format and judgement

    Shows the exact labels, tone and shape. The examples travel with every request, so they cost on each call.

  • The catch

    Examples can skew answers

    Order, label mix and format all move the result. Four examples with one label can pull answers toward it.

Say an insurer's claims bot sorts each new claim into Fast-track, Needs adjuster or Possible fraud. Zero-shot handles the simple claims, but on messy notes it starts to invent labels of its own. Anthropic's guide calls examples one of the most reliable ways to steer format and tone, so the usual fix is three or four real examples, picked to cover the hard cases.

Here is a prompt builder in standard Python. The insurer and its claims are made up, and the code calls no model. It prints the prompt with no examples, then the same prompt with three.

Python
# A made-up insurance claims bot. We build the prompts here and call no model.
LABELS = ["Fast-track", "Needs adjuster", "Possible fraud"]

EXAMPLES = [
    ("Hail damage to roof, two neighbours reported the same storm.", "Fast-track"),
    ("Water damage to kitchen, plumber's invoice dated before cover began.", "Needs adjuster"),
    ("Third claim on the same car in six weeks, each from a different garage.", "Possible fraud"),
]

def build_prompt(claim, examples):
    parts = ["Sort each claim into one of: " + ", ".join(LABELS) + "."]
    for text, label in examples:
        parts.append("Claim: " + text + "\nLabel: " + label)
    parts.append("Claim: " + claim + "\nLabel:")
    return "\n\n".join(parts)

NEW_CLAIM = "Car scraped in a car park, no witnesses, claim filed the day after cover began."
print(build_prompt(NEW_CLAIM, []))
print("----")
print(build_prompt(NEW_CLAIM, EXAMPLES))

Output

Sort each claim into one of: Fast-track, Needs adjuster, Possible fraud.

Claim: Car scraped in a car park, no witnesses, claim filed the day after cover began.
Label:
----
Sort each claim into one of: Fast-track, Needs adjuster, Possible fraud.

Claim: Hail damage to roof, two neighbours reported the same storm.
Label: Fast-track

Claim: Water damage to kitchen, plumber's invoice dated before cover began.
Label: Needs adjuster

Claim: Third claim on the same car in six weeks, each from a different garage.
Label: Possible fraud

Claim: Car scraped in a car park, no witnesses, claim filed the day after cover began.
Label:

Every example costs context space on every call, since the whole prompt is sent again each time. A zero-shot prompt stays short. The examples add to each request, and that adds up across thousands of claims a day. Some providers cache repeated prompt text, which cuts the cost, but the space still counts toward the context window.

Why can examples make answers worse?

Examples can also make things worse. A 2021 study named Calibrate Before Use tested few-shot prompts on GPT-3 and found the results could be unstable:

  • “We show that this type of few-shot learning can be unstable: the choice of prompt format, training examples, and even the order of the training examples can cause accuracy to vary from near chance to near state-of-the-art.”

    Calibrate Before Use, 2021

  • “Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.”

    Anthropic

The study traced the wobble to the model's bias toward certain answers, such as those placed near the end of the prompt or common in its pre-training data. So vary the labels, avoid a long run of one label, and test the order you actually ship. Anthropic's guide asks for examples that are relevant to your real use case and diverse.

How the mix of examples steers the answers

Mixed, real cases

every label, plus the hard edge cases

Four of one label

the same answer shown again and again

Model

copies the pattern it sees

Right label

matches what real adjusters decided

Skewed label

the common label, even when wrong

  1. 1Mixed examples show where each label starts and stops.
  2. 2Four matching examples can push the model toward that one label.
  3. 3Claims like the examples often get the right label.
  4. 4Other claims can get the common label, even when it is wrong.
Both prompts hold the same task. Four matching examples can pull answers toward one label. Mix the labels and include the hard cases, so the examples teach the judgement, not a habit.

Tip

Asked how you'd improve a weak answer, check the prompt first, then add examples. Don't say few-shot always wins. Say it depends on the task, the cost and a test set.

How would you choose between them for a new feature?

Start with the cheapest version, and let a test set decide. Here is the order I would follow.

  1. 1

    Write the zero-shot prompt

    Say the task, the allowed labels and the output format in plain words.

  2. 2

    Run it on real past cases

    Take about a hundred past claims with the decisions adjusters made, and score the outputs.

  3. 3

    Add examples only where it misses

    Pick three to five cases that cover the misses, with mixed labels. Anthropic's guide suggests three to five for best results.

  4. 4

    Measure both again

    Keep the longer prompt only if it wins on the test set by enough to pay for its extra space.

  5. 5

    Shuffle the examples

    Change their order and run the test again. If the score moves a lot, the prompt is fragile.

What does the interviewer want to hear?

A strong answer covers

  • Zero-shot means instructions only. Few-shot adds a few worked examples.
  • Neither changes the model's weights. The examples live in the prompt.
  • Use few-shot for unusual labels, formats or judgement calls.
  • Name the cost: examples take context space on every call.
  • Name the risk: order, label mix and format can skew the answers.
  • Test both on real cases before keeping the longer prompt.

Common traps

  • Trap"Few-shot always gives better answers."

    BetterIt can, but only a test on real cases shows it. Measure zero-shot and few-shot side by side first.

  • Trap"More examples are always better."

    BetterPast a few, examples eat context and can skew the answer. Anthropic's guide suggests three to five.

  • Trap"Examples teach the model new facts."

    BetterThey show a pattern and a format. For facts the model lacks, you have to supply the source text.

Can you spot the skew?

Spot the skew

Which set of examples is most likely to push a new claim toward one label?

Quick check

A bank's FAQ bot answers general questions well with zero-shot. Its team now needs replies in one exact internal refund-code format. What is the first thing to try?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q076What is prompt engineering?11 min
  2. Q078What is chain-of-thought, and when does it help?10 min
  3. Q081What makes a good prompt?13 min
  4. Q087Why template and version your prompts?11 min
  5. Q098How do you pick and order few-shot examples?12 min

Learn it in depth

Last updated on 26 November 2026

Building an AI feature that must get the labels right?

I design and build AI products and agents, including the prompts, examples and tests behind them. Book a short call and tell me what your model has to get right.