Zero-shot Learning

Performing a task with zero examples, on prior knowledge alone — and the split that matters: zero-shot prompting versus classical zero-shot learning.

Published Updated

On this page

Definition

Zero-shot learning means getting a model to perform a task it was shown no examples of at all — not one demonstration, none — relying entirely on knowledge it already has. It is the zero end of the same axis as one-shot and few-shot learning: one example, a handful, or in this case nothing but a description of what you want.

As with those two, one phrase covers two genuinely different things, and separating them is most of the value. Zero-shot prompting is the meaning most people now arrive for: you describe a task to a large language model in plain language — Classify the sentiment of this review: … — with no examples attached, and the model does it from what it absorbed in pre-training. Classical zero-shot learning is the older computer-vision problem: recognising a category the model was never trained on by supplying auxiliary semantic information about it — a list of attributes, or the word embedding of the class name — so the model can identify a zebra from "horse-shaped and striped" without ever having seen a labelled zebra image. Same idea, opposite machinery.

The reason the distinction earns its keep is that in zero-shot there is nothing to fall back on. A few-shot prompt that misfires can often be fixed by fixing an example; a zero-shot prompt has no examples, so the task description carries the entire specification, and one reworded instruction can swing the output. And a bare accuracy figure is close to meaningless: a zero-shot classifier choosing among N labels is right 1 in N times by chance alone, so "70% zero-shot" says nothing until you know whether N is 3 or 3,000.

How It Works

The two senses run on completely different machinery, which is the real reason to hold them apart.

Zero-shot prompting: describe the task, attach nothing

You give the model an instruction and the input, and no worked example of the mapping:

Classify the sentiment of this review as positive, negative or mixed.
Review: "Fast delivery, product is fine I guess."
Sentiment:

Nothing here demonstrates how a review maps to a label — only the instruction and the names of the permitted answers. The model completes the pattern from pre-training. That is the whole difference from one-shot prompting, which would paste one solved review above the real one to pin the format; zero-shot removes even that, leaning on the instruction alone.

The framing comes from the GPT-3 paper (Brown et al., 2020), which set zero-, one- and few-shot side by side as an axis of how many demonstrations you condition on, all at inference time. It defines zero-shot as the setting where "no demonstrations are allowed, and the model is only given a natural language instruction describing the task," and stresses that across the whole family the model's 175 billion weights receive "no gradient updates or fine-tuning" — the task happens in a single forward pass and nothing is learned. The paper calls zero-shot the most convenient and potentially most robust setting, and also the hardest: the instruction is everything the model gets.

That is also where a number becomes uninterpretable without its label count. Ask a model to sort inputs into one of N categories with no examples, and random guessing already scores 1/N: 50% on a yes/no task, 10% across ten classes, 0.1% across a thousand. So a zero-shot accuracy quoted on its own compares nothing — 70% on a 3-way task is barely above the coin-flippy floor of 33%, while 70% across a hundred classes, where chance is 1%, is a strong result. The label count is not a footnote; it sets the entire scale the number lives on.

Classical zero-shot learning: recognise a class from its description

The vision version faces a harder problem than prompting ever does. You want to classify an image into a category for which you hold no labelled images at all, so training a classifier the usual way is simply impossible — there is no positive example to learn from. The classical trick routes around the missing images through a shared semantic space.

Each class is described not by pictures but by a vector of attributes — for animals, a checklist like striped, four-legged, has-tail, lives-in-water. You train, on the classes you do have images for, a model that predicts those attributes from a picture. At test time you show it an image of an unseen class, read off the predicted attributes, and pick whichever unseen class's attribute description they best match: a striped, horse-shaped, four-legged animal is a zebra even though no zebra image was ever in training. This is Lampert et al.'s attribute-based classification (2009), the work that also introduced the field's standard benchmark, Animals with Attributes — 50 animal classes annotated with 85 attributes, split into 40 "seen" classes you train on and 10 "unseen" classes held out entirely for the zero-shot test. The split is over classes, not images: the ten unseen classes contribute no image to training, which is exactly what makes the evaluation zero-shot rather than ordinary supervised learning.

The attribute list is one choice of semantic bridge; the other common one is language. Instead of hand-labelled attributes you use the word embedding of each class name — the vectors that place "cat" near "dog" and far from "truck" — and learn a mapping from image space into that word-vector space (Socher et al., 2013). An unseen class is then just its name's embedding, and classification becomes nearest-neighbour in the shared space. The modern descendant is CLIP (Radford et al., 2021), which classifies an image against arbitrary new labels by embedding the text a photo of a <label> and matching it to the image — zero-shot image classification with the class list supplied at query time, not baked in during training.

Types

The two regimes share a name and almost nothing else; holding them side by side is the single most useful thing to know about the term.

Zero-shot prompting (in-context). The task description lives in the context window of an already-trained model. No weights change, no gradient is computed, and the effect lasts exactly one request. This is the language-model-era meaning and the one most people now search for. Its raw material is the instruction plus the model's pre-training; get the instruction wrong and there is no example to compensate.

Classical / embedding-based zero-shot learning. Weights are trained — heavily — but only on the seen classes, and the unseen class is reached through a semantic bridge (an attribute vector or a word embedding) rather than through any image of it. This is a computer-vision problem, close kin to meta-learning, and it predates the prompting meaning by roughly a decade. Attribute-based methods, embedding-based methods and CLIP-style contrastive image–text models all live here.

Along the same axis sit the sibling regimes, each with its own page: one-shot learning gives exactly one example, and few-shot learning gives a handful — typically three to five. Zero-shot is the endpoint: the only one of the three with no example at all.

Real-World Applications

  • Open-vocabulary image classification and retrieval. CLIP-style models let you name the label set at query time — feed the class names as text, embed each as a photo of a <label>, and pick the image's nearest match — so a catalogue can be sorted into categories the model was never trained on, and new categories can be added without collecting a single labelled image or retraining anything.
  • Text classification and intent routing in production pipelines. The everyday zero-shot-prompting use: hand a language model a fixed list of intent names — refund, exchange, escalate — and ask it to route an incoming ticket into one, with no examples. It is the cheapest possible prompt (no demonstration tokens to re-send on every call, unlike few-shot), and also the most exposed: because the label names are the whole specification, renaming a label or reordering the list can quietly change how tickets route.
  • Cold-start recognition of categories that have no data yet. The classical regime is the one to reach for when new categories appear faster than labels do and there is no language interface to prompt: a manufacturing-defect type described by its attributes before any photograph of it exists, or a species catalogued by traits. Where the attribute or word-embedding bridge is the only handle on a class you cannot yet collect images of, this is what earns its keep.

Key Concepts

  • Semantic bridge (auxiliary information) — the attribute vector or word embedding that stands in for the missing images. Without it there is no route to an unseen class; it is the piece that makes "zero-shot" possible at all in the classical regime.
  • Seen vs unseen classes — the split that makes an evaluation genuinely zero-shot. The unseen classes contribute no training signal, so a method that quietly saw them is not being tested zero-shot.
  • Chance floor (1/N) — the random baseline over N labels. A zero-shot score is uninterpretable without N, the same way an Artificial Analysis Intelligence Index score is meaningless without its index version (v4.1).
  • Generalized zero-shot learning — the harder, realistic setting where test time mixes seen and unseen classes and the model must not simply default to the classes it saw in training.

Challenges

The defining fragility of zero-shot prompting is that the task description is the entire specification, with nothing to anchor it. In a few-shot prompt the examples at least pin the label space and output format; strip them away and all of that weight lands on the wording. Renaming a category, reordering the list of allowed answers, or rephrasing the instruction can each swing the output, and there is no example to absorb the shock. This is the flip side of the GPT-3 paper's own description of zero-shot as the most convenient but hardest setting: convenience and brittleness are the same property seen from two directions.

Classical zero-shot learning breaks in its own characteristic ways, both of which push predictions away from the unseen classes it exists to find. The first is hubness: in the shared embedding space, nearest-neighbour classification is distorted because a few points become the nearest neighbour of disproportionately many queries, so predictions collapse onto a small set of labels almost regardless of the input. The second is domain shift: the attribute or embedding predictor was fit on the seen classes and is biased toward them, so in the generalized setting the model over-predicts classes it trained on and under-predicts the unseen ones. Both mean the same thing — the unseen classes are systematically under-served, which is precisely the failure zero-shot was supposed to solve.

Underneath both sits a name collision. "Zero-shot" in an LLM prompt and "zero-shot learning" in vision are wired completely differently, and reaching for the wrong one routes you to the wrong toolbox: prompting a model when the real problem is a cold-start vision task with no language handle, or building an attribute pipeline when a plain instruction to a foundation model would have done. Knowing which sense you are in is the first decision, not a detail.

Frequently Asked Questions

Getting a model to perform a task it was shown no examples of — not one demonstration, none — relying entirely on knowledge it already has. The phrase covers two different things: zero-shot prompting of a language model, and classical zero-shot learning in computer vision, which recognises unseen classes through attributes or word embeddings.
They are the same axis by example count: zero-shot gives none, one-shot gives exactly one, few-shot gives a handful. Zero-shot is the far end — nothing but a description of the task to go on.
No. The task description is ordinary input tokens, read and discarded when the request ends. The GPT-3 paper is explicit that across the zero-, one- and few-shot settings no gradient updates are performed; the task is done in a single forward pass.
It never trains on the unseen class directly. Instead each class is described by auxiliary semantic information — a vector of attributes, or the word embedding of the class name — and the model maps images into that shared space, so an unseen class can be reached through its description alone.
A classifier choosing among N labels is right 1 in N times by pure chance, so the random floor is 1/N. Seventy percent across three classes is barely above the 33% floor; seventy percent across a hundred classes, where chance is 1%, is a strong result. Without N the number has no scale.

Continue Learning

Explore our use-case guides and prompts to deepen your AI knowledge.