Zero-shot Learning

Home Glossary Item Zero-shot Learning
« Back to Glossary Index

Zero-shot learning is a machine learning paradigm in which a model performs tasks or recognizes classes for which it has never observed labeled examples during the training phase. Unlike traditional supervised learning, which requires explicit labeled data for every possible category, zero-shot learning leverages semantic relationships or auxiliary information to generalize from known classes to unseen ones. This capability allows systems to adapt to new tasks without the need for additional labeled training data or retraining from scratch.

How it works

The core mechanism of zero-shot learning relies on establishing a bridge between the features of the data and the semantic meaning of the classes. In a standard supervised learning setup, a model learns a direct mapping from input data (such as an image or a text string) to a specific label (such as “cat” or “dog”) by seeing many examples of each label. In zero-shot learning, the model is trained on a set of known classes, but it is also provided with auxiliary information that describes the semantic properties of all possible classes, including those it has not seen. This auxiliary information often takes the form of attributes, word embeddings, or structured knowledge representations.

During the training phase, the model learns to map input data into a feature space that is aligned with this semantic information. For example, if the model is trained to recognize various dog breeds, it might learn to associate visual features with descriptive attributes such as “has long fur,” “is large,” or “has floppy ears.” These attributes are shared across different breeds. The model learns that certain visual patterns correspond to specific combinations of attributes. Crucially, the model also learns the relationship between the input data and the semantic descriptions of the classes. This creates a joint embedding space where visual features and semantic descriptions are brought into proximity.

When the model encounters a new, unseen class during inference, it uses the semantic description of that class to make a prediction. For instance, if the model has learned the attributes of known breeds and is presented with an image of a breed it has never seen, it extracts the visual features of the new image and compares them to the semantic description of the unseen breed. If the visual features match the attributes described for the unseen class, the model assigns that class label. This process effectively allows the model to generalize by recognizing that the new class shares essential characteristics with the classes it was trained on.

Several techniques facilitate this alignment. Attribute-based approaches explicitly define classes by a set of binary or continuous features. Embedding-based methods use vector representations of class names or descriptions, often derived from language models or knowledge graphs, to create a dense semantic space. Generative approaches may synthesize features for unseen classes based on their semantic descriptions, allowing the model to use standard supervised learning mechanisms on the generated data. Knowledge graph embeddings provide structured relationships between entities, enabling the model to infer properties of unseen entities based on their connections to known ones.

Where it is used

Zero-shot learning is particularly valuable in scenarios where obtaining labeled data for every possible class is impractical, expensive, or impossible. This is common in domains with a long-tail distribution of classes, where a few classes have abundant data while many others have very little or none. For example, in image recognition, there are thousands of specific animal or object categories, but labeling data for every single one is resource-intensive. Zero-shot learning allows a model trained on a broad set of common categories to recognize rare or newly discovered categories without additional labeling.

In natural language processing, zero-shot learning is used for tasks such as text classification, sentiment analysis, and named entity recognition. A model trained on a specific set of topics or entities can be prompted or configured to handle new topics or entities by leveraging the semantic meaning of the new terms. This is especially useful in dynamic environments where new topics emerge rapidly, and labeling data for them would take too long. By relying on the inherent structure of language, models can generalize to new textual categories with minimal or no additional training data.

Another key application area is in multimodal learning, where data comes from multiple sources, such as images and text. Models like CLIP (Contrastive Language–Image Pretraining) learn to align visual and textual representations in a shared space. This alignment enables zero-shot classification, where an image can be classified into any category described by text, even if the model has never seen an image of that category during training. This is widely used in search engines, recommendation systems, and content moderation, where the set of possible categories can be vast and constantly evolving.

Limitations and trade-offs

One of the primary limitations of zero-shot learning is the “semantic gap” between the training data and the unseen classes. If the semantic information provided for the unseen classes is inaccurate or insufficient, the model’s performance will degrade. For example, if the attributes used to describe a new class do not fully capture its visual or textual characteristics, the model may fail to recognize it correctly. The quality of the zero-shot performance is heavily dependent on the quality and relevance of the auxiliary information.

Another trade-off is the potential for bias propagation. If the semantic descriptions of the classes are biased, the model will inherit and potentially amplify these biases. For instance, if the attributes used to describe certain classes are associated with specific stereotypes, the model may make biased predictions for unseen classes that share those attributes. Additionally, zero-shot learning often requires a larger amount of auxiliary data or more complex models to achieve performance comparable to supervised learning on seen classes. This can increase computational costs and complexity.

Furthermore, zero-shot learning assumes that the unseen classes are semantically related to the seen classes. If the unseen class is entirely unrelated to the training data, the model may struggle to generalize. For example, a model trained on dog breeds may not perform well on a completely different category, such as vehicles, unless the semantic space is broad enough to encompass both domains. The success of zero-shot learning is thus contingent on the richness of the semantic relationships and the diversity of the training data.

Related terms

  • Supervised Learning – Zero-shot learning contrasts with supervised learning, which requires labeled examples for all classes during training.
  • Transfer Learning – Both involve leveraging knowledge from one task or domain to another, but zero-shot learning specifically targets unseen classes without additional labeled data.
  • Few-shot learning – A related paradigm where the model sees a small number of labeled examples for the new class, whereas zero-shot learning sees none.
  • Embedding – Zero-shot learning often relies on embeddings to map data and class descriptions into a shared semantic space.
  • Knowledge Graph – Knowledge graphs provide structured semantic information that can be used to describe classes for zero-shot learning.
  • Multimodal – Zero-shot learning is frequently applied in multimodal settings, such as aligning images and text, to enable cross-modal classification.
« Back to Glossary Index
Eugene Serbin

Systems Analyst and AI Engineer, Semalt

Eugene Serbin is a systems analyst and AI engineer at Semalt. He graduated with honours from Kharkiv National University of Radio Electronics in 2005, specialising in intelligent decision-making systems, and holds a second degree from the same university in economic cybernetics. He writes and edits the AI research summaries, applied machine learning explainers and the glossary on ai-magazine.com.