Zero-Shot Classification — Text Classification Without Training Data
- Introduced by
- Yin, Hay & Roth
- Year
- 2019
- Type
- NLP text-classification task
What does it do?
Zero-shot classification is a natural-language-processing task that assigns text to categories described in plain language without requiring any labelled training data.
Formalised as an entailment problem by Yin, Hay and Roth (2019), it lets a large pretrained language model recognise new categories on the fly simply by naming them, enabling rapid adaptation to fresh label sets.
The intuition behind the method
Normally a classifier must see many labelled examples of each category before it can recognise them. Zero-shot classification skips that step: you supply the category names as ordinary words — for example politics, sports, science — and a large pretrained language model that already understands language judges how well each candidate label fits the text. Because the model brings its own broad knowledge of language, you can add or change categories instantly without collecting and labelling new training data.
History
Zero-shot text classification was systematically benchmarked and framed as a textual-entailment problem by Yin, Hay and Roth (2019), who showed that a model trained on natural-language inference can classify text into unseen categories by treating each label as a hypothesis. The broader capability of large language models to perform tasks they were never explicitly trained on was popularised by Brown et al. (2020) in the few-shot learning work on GPT-3.
When to use it
Zero-shot classification fits when you have text to categorise but no labelled training data, and when the categories may change or grow over time. It requires a large pretrained language model (such as BART or RoBERTa-based entailment models) and candidate labels that are defined clearly and disjointly. It is well suited to rapid prototyping and to settings where collecting labelled examples for every class is impractical.
Limitations and considerations
- Depends on a large pretrained language model (BART, RoBERTa), which carries computational cost.
- Accuracy hinges on how clearly and disjointly the candidate labels are worded.
- Without task-specific training it can be outperformed by a supervised classifier when ample labelled data exists.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Requires no labelled training data — categories are described in plain language.
- Adapts rapidly to new categories: adding a class only means adding its name to the candidate-label list.
- Leverages the broad linguistic knowledge already captured in a large pretrained model.
Applications
- Categorising documents into label sets that change frequently without retraining.
- Rapid prototyping of classification tasks before any labelled data is collected.
- Routing or tagging incoming text (topics, intents) using only category names.
- Exploring emerging categories in research and operational text corpora.
How it works
How it works
You describe the target categories as natural-language candidate labels — short phrases the model can read directly. These labels must be clearly worded and disjoint, because the model compares the text against each label as written; vague or overlapping labels blur the decision.
The text and the candidate labels are fed into a large pretrained language model such as BART or RoBERTa. No fitting on your own data takes place — the model uses the linguistic knowledge it acquired during pretraining to represent both the document and each candidate label.
The model scores how strongly each candidate label is supported by the text, framing the task as natural-language inference: does the text entail the hypothesis that it belongs to this label? Each label receives a compatibility score from the pretrained model.
The label with the highest score is assigned to the text (or a ranked set of labels for multi-label settings). Because the scoring rests entirely on the pretrained model, adding a new category is as simple as adding its name to the candidate list.
Common pitfalls
- Vague or overlapping candidate labels blur the model's decisions; define each label clearly and keep them disjoint.
- Expecting zero-shot accuracy to match a fully supervised classifier when plenty of labelled data is available — in that case train a supervised model instead.
- Using a small or generic model rather than a large entailment-capable one degrades results.
- Phrasing labels in a language the pretrained model does not handle well lowers reliability.
Frequently asked questions
Does zero-shot classification need any training data?
No. That is its defining feature: you describe the categories as natural-language candidate labels and a large pretrained model judges the fit, so no labelled examples are required.
Which model does it rely on?
It relies on a large pretrained language model, typically an entailment-trained model such as BART or RoBERTa. The quality of the result depends heavily on using a capable pretrained model rather than a small generic one.
How should I write the candidate labels?
Define them clearly and keep them disjoint. The model compares the text against each label as written, so vague or overlapping labels blur the decision and lower accuracy.
Is it as accurate as a supervised classifier?
Not necessarily. When you have ample labelled data, a supervised classifier trained on that data can outperform zero-shot. Zero-shot shines when labelled data is scarce or the category set keeps changing.
Related methods
Sources
Yin, W., Hay, J. & Roth, D. (2019). Benchmarking Zero-shot Text Classification: Datasets, Evaluation and Entailment Approach. EMNLP, 3914-3923.
Open DOI referenceCopied.Brown, T. et al. (2020). Language Models are Few-Shot Learners. NeurIPS.
Open publication referenceCopied.