Zero-shot prompting is a method of using a language model to perform a task without providing worked demonstrations of that task in its input context. Instead, the prompt supplies an instruction, the material to be processed, and, where necessary, definitions or output requirements. Widely used with large language models, it relies on capabilities acquired during training rather than examples supplied at the time of use. “Zero-shot” describes the absence of task demonstrations in the prompt; it does not mean that the model has received no training or has never encountered similar tasks.
Definition and scope
A zero-shot prompt typically specifies what operation to perform and provides the input on which to perform it. For example:
Classify the sentiment of the following review as positive, negative, or neutral.
Return only the label.
Review: The replacement arrived quickly, but it stopped working after two days.
This prompt includes a task description, permitted labels, and an input, but no completed review–label pairs. By contrast, a prompt that first supplies several reviews with their correct sentiment labels uses few-shot prompting. A prompt with one demonstration is commonly called one-shot prompting.
The relevant distinction is between instructions and demonstrations. Defining “negative” as expressing dissatisfaction does not by itself introduce a demonstration. Providing a sample review followed by “negative” does. Borderline cases arise when instructions contain worked mini-examples, sample outputs, or extensive task-specific hints; evaluations need to state how these are counted.
Zero-shot prompting can include substantial supporting information. A document to summarize, a passage containing the answer to a question, or a table to analyze is task input rather than necessarily a worked example. Consequently, “zero-shot” does not mean “without context.”
In conversational systems, demonstrations may appear in earlier messages or system-level instructions rather than the latest user message. The designation therefore concerns the relevant input context as a whole, not merely the visible final instruction.
How it works
Zero-shot prompting is an inference-time technique within prompt engineering. For a conventional autoregressive language model, the instruction and input condition the generation of subsequent text. If denotes the instruction, the task input, and the output, its conditional probability can be represented as
where represents the model’s learned parameters. Ordinary zero-shot use does not update these parameters during inference.
The model’s response depends on patterns and capabilities acquired from its training data. Pretraining can expose it to language, facts, code, and text resembling many downstream tasks. Instruction tuning further trains a model on instructions paired with desired responses, making natural-language task descriptions more effective interfaces. Preference-based training, including reinforcement learning from human feedback, can further shape how the model responds.
The absence of demonstrations in the prompt therefore does not establish that the task is novel to the model. A model may already have encountered the task type, related examples, or even particular evaluation items during training.
Relationship to other methods
Zero-shot learning
Zero-shot learning is a broader machine-learning concept involving transfer to tasks or classes for which certain forms of task-specific training examples are unavailable. In image recognition, for example, a model may identify classes through textual descriptions rather than labeled training images of those classes.
Zero-shot prompting is a particular way of specifying a task through a model’s input. Calling a prompt zero-shot does not, by itself, establish that the model satisfies a strict zero-shot learning protocol: that requires information about its training and the evaluation setup.
Few-shot prompting and in-context learning
Few-shot prompting supplies demonstrations that illustrate the intended input–output relationship. These examples can communicate label meanings, formatting conventions, specialized terminology, or unusual decision rules.
Zero-shot prompting is often discussed alongside in-context learning. Terminology varies: some uses of in-context learning encompass learning a task from instructions alone, whereas others emphasize adaptation through demonstrations. The operational distinction is whether worked examples appear in the context.
Neither approach inherently changes the model’s parameters. Both differ from fine-tuning, which trains a model further by updating parameters, and from prompt tuning, which learns continuous prompt representations.
Retrieval-augmented generation
Retrieval-augmented generation supplies information retrieved from external sources. A system can remain zero-shot if the retrieved material provides evidence or task input rather than demonstrations.
For example, answering a question from retrieved product documentation may be zero-shot with respect to the question-answering task. Retrieving completed question–answer pairs as demonstrations creates a different setup. Reporting retrieval and demonstration use separately makes such distinctions clearer.
Chain-of-thought prompting
Chain-of-thought prompting encourages a model to generate intermediate reasoning before an answer. It can use demonstrations, but it need not do so.
A zero-shot reasoning prompt may add an instruction such as “Let’s think step by step” without supplying a worked solution. This remains zero-shot with respect to demonstrations. Generating intermediate reasoning can improve some task results, but it does not guarantee correctness or establish that the generated explanation faithfully describes the model’s internal computation.
Historical development
Zero-shot prompting developed from research on using pretrained language models as general-purpose task solvers rather than building a separate supervised model for each task.
Work on GPT-2 in 2019 evaluated language-model performance on multiple tasks without task-specific supervised adaptation, often by presenting tasks in text forms compatible with language modeling. The 2020 GPT-3 study more explicitly compared zero-shot, one-shot, and few-shot settings, helping establish this terminology for large language models.
Research on instruction tuning subsequently showed that training across collections of instruction-described tasks could improve performance on held-out tasks. FLAN, introduced in 2021, was an influential example. Research on zero-shot chain-of-thought prompting in 2022 showed that a short reasoning instruction could improve performance on several reasoning benchmarks without worked demonstrations.
These developments distinguish two separate properties: how a model was trained and how a task is presented at inference time. An extensively instruction-tuned model can still receive a zero-shot prompt.
Applications and prompt structure
Common applications include text classification, information extraction, summarization, translation, rewriting, question answering, and code generation. Zero-shot prompting is particularly convenient when the intended task can be expressed clearly but representative demonstrations are unavailable.
A zero-shot prompt may contain:
- A task statement: the operation to perform.
- Input boundaries: delimiters identifying the material to process.
- Decision rules: definitions, permitted categories, or handling of ambiguous cases.
- Output requirements: a language, schema, length limit, or machine-readable format such as JSON.
- Evidence constraints: restrictions on which supplied material may support an answer.
These elements specify the task without necessarily demonstrating it. However, adding more instructions does not automatically improve performance: instructions may be redundant, conflicting, or difficult for a model to follow.
Relative to demonstration-based prompts, zero-shot prompts often occupy less of the context window. This can leave more space for documents and reduce input-processing costs. It does not guarantee lower total cost, because output length, retries, retrieval, and model choice also matter.
Evaluation
Zero-shot performance is meaningful only in relation to a specified model, prompt, and evaluation protocol. Relevant details include the exact instructions, available context, model version, generation settings, permitted tools, and whether any demonstrations appear elsewhere in the conversation.
Prompt development must also be distinguished from final testing. Trying many prompts against a labeled test set and reporting the best result can overstate performance, even if each individual prompt contains no examples. Separating prompt development from final evaluation helps avoid this form of data leakage.
Benchmark data contamination presents another limitation. An apparently zero-shot result may reflect exposure to evaluation material during training. Establishing that no demonstrations were supplied at inference time is generally easier than establishing that the model never encountered related data.
For structured tasks, evaluation can measure both substantive correctness and adherence to the requested format. For open-ended tasks, assessment may also need to consider factual accuracy, relevance, completeness, and variation across repeated runs.
Limitations
Zero-shot prompting depends heavily on the model’s ability to infer the intended task from language. Ambiguous labels, unstated domain conventions, specialized terminology, and unusual output requirements can produce inconsistent interpretations. Demonstrations may communicate such details more effectively than verbal definitions alone.
Performance can also be sensitive to wording, label order, formatting, and the language of the instructions. Success on familiar task descriptions does not establish robust generalization to new domains or distribution shifts.
Zero-shot prompts do not eliminate hallucinations, factual errors, unsupported reasoning, or inherited biases. An instruction to acknowledge uncertainty does not itself make confidence reliable. Likewise, requesting a strict output schema does not guarantee that unconstrained generation will satisfy it.
When prompts include external documents or retrieved text, prompt injection can cause a model to treat untrusted content as instructions. Being zero-shot offers no inherent protection against this problem; the absence of demonstrations is a property of task presentation, not a security mechanism.