Glossary

Zero-shot prompting

Asking a language model to perform a task using only instructions, with no worked examples of the task included in the prompt.

Zero-shot prompting means asking a language model to carry out a task by describing it, without including any examples of the task being done. A prompt such as "Classify this support ticket as billing, technical or account, and reply with the label only" is zero-shot: the model gets the instruction and the input, and nothing showing what a correct answer looks like. It works because modern models have been trained on a huge range of text and then tuned to follow instructions, so many tasks can be specified in plain language. Zero-shot is the default way most people use language models, and for a large share of everyday tasks (summarising, rewriting, simple classification, extraction of common fields) it is enough. When a task has an unusual format, subtle labels or domain conventions the model cannot infer, adding a few examples, known as few-shot prompting, usually closes the gap.

How zero-shot prompting works

A large language model learns broad knowledge of language and the world during pre-training, by predicting the next token across vast amounts of text. A pre-trained model on its own is good at continuing text but not at following instructions. Two later training stages changed that. Instruction tuning trains the model on many tasks phrased as instructions with their answers, and preference training such as RLHF shapes its responses towards what people judge helpful. The result is a model that generalises from the instruction to tasks it was never explicitly trained on.

Zero-shot prompting relies entirely on that generalisation. The model must work out from the wording what the task is, what a good answer looks like and what format to use. There is no demonstration to copy, so the quality of the instruction carries all the weight. This is the main difference from approaches that lean on in-context learning from examples, where the model can infer patterns that are hard to describe.

Zero-shot, one-shot and few-shot

The terms describe how many worked examples the prompt contains.

Approach

Examples in the prompt

Strengths

Weaknesses

Zero-shot

None

Short prompts, fast to write, no example bias

Ambiguous formats and labels

One-shot

One

Shows the expected format cheaply

The model may copy surface details of the single example

Few-shot

Typically two to ten

Teaches subtle labels, style and edge cases

Longer prompts, more tokens per call, examples need curating

Few-shot prompting tends to help most on tasks with idiosyncratic outputs: a house style, a custom taxonomy, a tricky boundary between two labels. Zero-shot tends to hold its own on tasks the model already understands well, and newer models narrow the gap further. Zero-shot also avoids a quiet failure of few-shot prompts, where the model over-weights the examples and mirrors their length, tone or label balance.

Cost is part of the choice. Examples are paid for on every call, so a few-shot prompt with five long examples can multiply input size. A zero-shot prompt keeps the context window free for the material that matters, such as the document being processed.

Zero-shot chain of thought

A well-known variation adds a short reasoning cue to a zero-shot prompt. Research published in 2022 showed that appending a phrase such as “Let’s think step by step” improved performance on arithmetic and logic problems without any examples. This zero-shot form of chain of thought prompts the model to write out intermediate reasoning before its answer.

The effect is smaller with reasoning models, which are trained to reason before answering and spend extra test-time compute by default. For those models, a clear zero-shot instruction is often better than a hand-written reasoning recipe, which can constrain how the model approaches the problem.

Zero-shot beyond text prompts

The term predates large language models and appears in other parts of machine learning. Zero-shot classification means assigning labels a model was never trained on, often by comparing an input’s embedding with embeddings of the label names and choosing the closest by semantic similarity. CLIP made this approach popular for images: because it maps images and text into a shared space using multimodal embeddings, it can label a photo with categories it never saw during training. Zero-shot image tagging and named entity recognition for new entity types follow the same idea.

Writing effective zero-shot prompts

State the task and the output precisely. Name the labels or fields, the format and what to do when the answer is unknown. “Return JSON with keys vendor, total and due_date; use null for anything not present” leaves less to guess than “extract the key details”. Pairing the instruction with structured output or JSON mode enforces the format.

Define ambiguous terms. If “urgent” means a production outage and not an angry tone, say so. Definitions do much of the work examples would otherwise do.

Give context, not just instructions. Who the output is for, what it will be used for and what matters most all change the answer. A system prompt is the natural place for this, and a prompt template keeps it consistent across calls.

Split complex tasks. If one zero-shot prompt is asked to do several things, accuracy drops. Prompt chaining gives each step a simple zero-shot instruction.

Ground factual tasks. Zero-shot prompts that ask about facts the model may not know invite hallucination. Supplying the relevant source material through retrieval-augmented generation gives the model something to quote rather than recall, which is the idea behind grounding. The instruction can stay zero-shot while the context does the factual work.

Measure before adding examples. Run the zero-shot version against a golden dataset and score it with LLM evaluation methods. If it fails on specific cases, add examples that target those cases, or consider fine-tuning if the task is high-volume and stable. Keep the temperature low for classification and extraction so results are repeatable.

Signs a zero-shot prompt needs help

A few patterns show up repeatedly in testing, and each has a different fix. Outputs that drift in format between calls usually mean the format is described loosely, and a schema fixes it. Two labels that keep getting confused usually mean their boundary is not defined; a sentence of definition, or one example of each near the boundary, often settles it. Answers that are confidently wrong about facts point to missing context rather than a weak instruction. Quality that falls as inputs get longer points to inputs that are too noisy or too large, the pattern described as context rot. Diagnosing which of these is happening saves rewriting a prompt that was never the problem.

Zero-shot prompting in agents

Most agent instructions are zero-shot. An AI agent‘s system prompt describes its role, its tools and its rules, and the model decides from that description how to act on inputs it has never seen. Tool definitions used in function calling are zero-shot instructions too: a name, a description and a parameter schema, from which the model infers when and how to call the tool. Vague tool descriptions lead to tools being called at the wrong time or with the wrong arguments, for the same reason vague task descriptions produce vague answers.

Agents also show where zero-shot runs out. A support agent that must follow a company’s refund policy cannot infer the policy from an instruction to be helpful; it needs the policy text in context, retrieved when relevant. The instruction stays zero-shot while the specifics arrive as context. That split, short stable instructions plus precise retrieved context, is the core of context engineering and scales better than adding ever more examples to the prompt.

A worked example

A finance team wants to pull the vendor, invoice number, due date and total from supplier invoices. Their first zero-shot prompt, “Extract the invoice details”, returns inconsistent field names and sometimes the subtotal instead of the total. They rewrite it with explicit field names, a JSON schema, a rule that the total includes tax, and an instruction to return null rather than guess. Accuracy on their test set of 200 invoices rises to an acceptable level without any examples.

The remaining errors cluster on scanned invoices where the text is garbled, which no prompt can fix. That points to the input rather than the prompt: once the scans go through proper document extraction with OCR, the same zero-shot prompt handles them too. The lesson generalises. When a zero-shot prompt underperforms, check what the model is being given before reaching for examples. The invoice processing use case covers this workflow in more detail.

Where Exabase fits

Exabase does not write or run your prompts. It helps zero-shot prompts succeed by improving what they receive as input, which is where many zero-shot failures start.

Extract turns PDFs, scans, images, audio, video and web pages into clean text chunks with page numbers or timestamps, with OCR built in for scanned documents. It also recognises invoices, resumes and contracts automatically and returns structured fields for them, such as vendor, line items and total for an invoice, so common extraction tasks need no prompt of your own; the invoice to JSON tool shows the output, and retrieving results covers the response format. The file extraction solution describes the wider pattern.

For factual questions, Deep Search supplies grounding context: it returns the specific passage that answers a query, with its page number, so a short zero-shot instruction can answer from evidence. Memory supplies what the application knows about the user, such as their plan or preferences, which removes the need to describe each user in the prompt. The RAG accuracy solution explains why precise context matters more than prompt wording, and cheap models with good context beat frontier models makes the case from the cost side.

Frequently asked questions

What is an example of zero-shot prompting?

“Summarise this email in two sentences for a busy manager” is zero-shot: it describes the task and gives no example summaries.

Is zero-shot or few-shot prompting better?

It depends on the task. Zero-shot is shorter and avoids example bias; few-shot helps with unusual formats, subtle labels and house style. Start zero-shot and add examples only where testing shows a need.

What is zero-shot chain of thought?

A zero-shot prompt with a cue such as “think step by step” that asks the model to reason before answering. It helped older models on multi-step problems; reasoning models do this by default.

Why does zero-shot prompting work?

Instruction tuning and preference training teach models to follow plain-language instructions across many tasks, so they can generalise to new ones without examples.

What is zero-shot classification?

Labelling inputs with categories the model was not trained on, either by instructing a language model or by comparing embeddings of the input and the label names.

When does zero-shot prompting fail?

When the expected output is hard to describe, labels have subtle boundaries, the model lacks the facts needed, or the input itself is poor quality.

Can Exabase improve zero-shot results?

Indirectly. Extract gives the model clean input, and Deep Search and Memory supply relevant context, so a short zero-shot instruction has what it needs.

Related pages: few-shot prompting, in-context learning, prompt engineering, chain of thought, instruction tuning, prompt template, grounding, file extraction, invoice processing

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.