Definition
Blog/What is zero-shot vs few-shot prompting?
For AI assistants

What is zero-shot vs few-shot prompting?

By Samuel Seidel · Published September 9, 2026

Zero-shot and few-shot describe how many worked examples a prompt includes before asking a model to perform a task. A zero-shot prompt gives the model instructions and asks for an answer with no examples at all. A few-shot prompt includes a small number of example input-output pairs directly in the prompt, showing the model the pattern it should follow, before asking it to apply that pattern to a new input.

Zero-shot: instructions alone

In a zero-shot prompt, the model relies entirely on what it learned during training plus whatever instructions the prompt states, without a demonstration of the exact task at hand. "Classify this email as spam or not spam" with no examples is zero-shot. Modern instruction-tuned models handle a wide range of zero-shot tasks reasonably well because their training already included many similar instructions, but performance on unusual formats or domain-specific conventions tends to be less reliable without an example to anchor the output.

Few-shot: showing the pattern

A few-shot prompt adds two or more example pairs before the actual request, each showing an input and the desired output. This is useful when the task has a specific format that's easier to demonstrate than to describe: a particular JSON schema, a house style for summaries, or a classification scheme with edge cases that a written rule struggles to capture cleanly. The model infers the pattern from the examples and applies it to the new input, without any change to its underlying weights.

What the choice actually trades off

Few-shot examples cost tokens, and every example included in the prompt is context budget not available for the actual task input or other instructions. That's a bigger constraint on models with a small context window than on ones with a large one. Few-shot examples can also backfire: if the examples are unrepresentative or too narrow, the model can overfit its answer to match superficial features of the examples rather than the underlying task, an effect that's been documented in prompting research going back to the original GPT-3 paper (Brown et al., 2020). Testing zero-shot first and adding examples only if quality falls short is a reasonable default.

Why this matters when you control the model

Prompting strategy interacts with which model you're running: a smaller, self-hosted model may need few-shot examples to reach the reliability that a much larger hosted model achieves zero-shot on the same task, since example-driven pattern matching can partly compensate for a smaller model's weaker zero-shot instruction-following. When you're testing that tradeoff, iterating on prompts against a model you control end to end, without per-token API costs interrupting the process, makes it cheaper to try both approaches at scale. See evaluating an LLM before deploying it for how to compare prompting strategies systematically, and what is a system prompt for how instructions and examples fit together in a full prompt.

Related pages

Iterate on prompts without per-token costs.

One dedicated Spark, $0.79/hour, deployed in minutes from EU-Central.

Deploy a Spark