What is zero-shot vs few-shot prompting?
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 instructions and asks for an answer with no examples. A few-shot prompt includes a small number of example input-output pairs that show the pattern to follow, then asks the model to apply it to a new input.
Zero-shot: instructions alone
In a zero-shot prompt the model relies on what it learned in training plus the prompt's instructions, with no demonstration of the task. "Classify this email as spam or not spam" with no examples is zero-shot. Instruction-tuned models handle a wide range of zero-shot tasks well because their training included many similar instructions. On unusual formats or domain-specific conventions they are 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. It helps when the format is easier to show than to describe: a particular JSON schema, a house style for summaries, a classification scheme with edge cases a written rule struggles to capture. The model infers the pattern from the examples and applies it to the new input, with no change to its weights.
What the choice actually trades off
Few-shot examples cost tokens, and every example is context budget taken from the task input and other instructions. That bites harder on models with a small context window. Examples can also backfire: if they are unrepresentative or too narrow, the model can copy their surface features instead of learning the task, an effect documented in prompting research going back to the original GPT-3 paper (Brown et al., 2020).
A sensible default: try zero-shot first, and add examples only if quality falls short.
Why this matters when you control the model
Prompting strategy depends on the model. A smaller self-hosted model may need few-shot examples to match the reliability a much larger hosted model reaches zero-shot, because examples partly make up for weaker zero-shot instruction-following. On a model you run yourself, billed by the hour instead of per token, a long few-shot prompt costs a little machine time rather than a per-token charge on every test run, so comparing both approaches across hundreds of runs gets cheaper. 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.