Zero-Shot Learning: Classifying the Unseen
Zero-Shot Learning lets a model classify things it never trained on. It works by linking visual features to semantic descriptions, like identifying a 'zebra' from the description 'striped horse'. The footgun is assuming it creates knowledge from nothing.
Why it exists
The real world has a 'long tail' of categories. It's impractical or impossible to collect training data for every possible object, animal, or scene. Zero-Shot Learning (ZSL) addresses this data scarcity problem by allowing models to generalize to entirely new classes without seeing a single example.
The mental model
Imagine you need to teach a computer to recognize a 'zebra'. Instead of showing it thousands of zebra pictures, you train it on pictures of horses, tigers, and pandas, along with rich text descriptions of their attributes. The model learns to associate visual patterns with concepts. Then, you give it the description for 'zebra': 'looks like a horse, has black and white stripes'. When it sees a new image of a zebra, it can combine its learned visual knowledge of 'horse' and 'stripes' to correctly identify the unseen animal.
How it works
ZSL works by creating a shared embedding space where both images and semantic information (like text descriptions or attribute lists) can be represented as vectors. During training, the model learns to map images of seen classes to their corresponding semantic vectors. For example, an image of a cat is mapped close to the vector for attributes like {has fur, is small, has whiskers}. At test time, when an image of an unseen class (e.g., a wolf) is presented, the model projects it into the embedding space. The model then finds the nearest semantic vector, which might be for {has fur, is wild, pack animal}, and predicts 'wolf'—even though it never trained on a wolf image.
When to use it
Use ZSL for large-scale classification problems with an open-ended or constantly growing number of classes. It's valuable in scenarios like species identification, fine-grained object recognition (e.g., 'Model X car' vs 'Model Y car'), and dynamic content tagging where new labels emerge frequently.
When not to use it
Avoid ZSL when you require extremely high precision and can afford to collect comprehensive training data for all target classes. It is also ineffective if there's no meaningful, descriptive semantic space connecting your seen and unseen classes. If the attributes describing seen classes have no relation to the unseen ones, the model has no basis for generalization and is just guessing.
One canonical example
A classic ZSL task is identifying bird species. A model is trained on images of common birds (robins, pigeons) paired with attribute vectors describing their color, beak shape, and size. At test time, it can identify a rare bird like a 'Resplendent Quetzal' by matching the visual features of a new image to the quetzal's known attribute vector (e.g., {green plumage, long tail feathers, red breast}), even if it never saw one during training.
Interview question
How does Zero-Shot Learning classify categories it has never directly encountered during training?
- a.By directly comparing the raw pixel data of an unseen image to a database of textual descriptions to find the closest match.
- b.By mapping visual features of seen classes to semantic descriptions, then matching new images to unseen semantic descriptions in a shared space.Correct
- c.It requires a massive dataset containing visual examples of all possible categories, including the 'unseen' ones, for pre-training.
- d.It synthesizes visual examples for unseen classes based on their textual descriptions before classification.
Why? this is the answer
Option B accurately describes how ZSL works: it learns a mapping between visual features of known classes and their semantic descriptions in a shared embedding space, allowing it to then match new, unseen images to previously defined semantic descriptions for novel categories. Option D is incorrect because ZSL's core mechanism is not about generating synthetic images, but rather about leveraging semantic relationships.
Just read this? Test yourself on what you have been reading.
Read the original → en.wikipedia.org
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on machine learning — each one lists the topics its interview covers.
See open roles