Abstract
Contrastive Language-Image Pre-training (CLIP) is celebrated for its "open-vocabulary" capabilities, yet its robustness in real-world scenarios with a continuously expanding set of classes is rarely scrutinized. This paper investigates the true "openness" of CLIP by introducing two novel metrics: extensibility and stability. Our evaluation reveals that CLIP's performance degrades significantly as the vocabulary grows, a phenomenon we trace to a lack of uniformity in the text feature space. We propose Retrieval-enhanced Prompt Engineering (REPE) as a zero-shot method to improve model stability and extensibility.
Introduction
Contrastive Language-Image Pre-training (CLIP) revolutionized computer vision by framing image classification as an image-to-text matching task. By matching images to natural language descriptions instead of fixed category IDs, CLIP theoretically supports "open-vocabulary" recognition. However, standard evaluations typically test CLIP on static, closed datasets, which does not reflect real-world deployments where new categories constantly emerge. This research asks: How "open" is CLIP, really? Does its zero-shot accuracy hold up when the number of possible classes dynamically expands?
Quantifying Openness: Extensibility and Stability
To evaluate true openness, we introduce an incremental evaluation protocol with two key metrics:
- Extensibility (Acc-E): Measures how well the model handles new visual concepts by tracking average accuracy as the target vocabulary incrementally expands.
- Stability (Acc-S): Measures the robustness of predictions on existing classes when new, "non-target" distractor classes are introduced into the vocabulary.
The "Small Margin" Problem
Our analysis reveals that CLIP's vulnerability stems from a lack of intra-modal uniformity in the text feature space. While CLIP effectively aligns images with their correct text descriptions, the text features for different classes are often clustered too closely together. This results in a "small margin" between the correct class and incorrect alternatives. When the vocabulary expands, these tiny margins make the model highly susceptible to confusion, as new class embeddings are likely to fall within the narrow decision boundaries of existing classes.
Key Results and Vulnerabilities
Empirical tests on datasets like CIFAR100 and ImageNet demonstrate a sharp decline in performance under vocabulary expansion. For instance, on CIFAR100, CLIP (RN101) accuracy dropped by 12.9% as the vocabulary grew from 5 to 100 classes.
Furthermore, CLIP exhibits extreme sensitivity to "adversarial" non-target classes. Adding just three highly abstract distractor words (e.g., "bitmap") to the vocabulary caused a massive 52.7% accuracy drop on CIFAR10. This suggests that CLIP's open-vocabulary nature is fragile when faced with noisy or abstract linguistic distractors.
Mitigation via Retrieval-enhanced Prompt Engineering (REPE)
To address these issues, we propose Retrieval-enhanced Prompt Engineering (REPE). Instead of relying on generic prompts like "a photo of a [CLASS]", REPE retrieves diverse, real-world captions containing the class name from a large corpus (e.g., CC12M). By averaging these retrieved embeddings, we create a richer and more distinct text representation for each class. This method consistently improves extensibility and stability by widening the margin between competing classes without requiring any model fine-tuning.
Conclusion
While CLIP offers impressive zero-shot capabilities, its "openness" is limited by the density and lack of uniformity in its text feature space. As the world moves toward dynamic, open-ended AI deployments, evaluating models through the lens of extensibility and stability becomes crucial. Our findings highlight the need for better text-space regularizations and more sophisticated prompting strategies to realize the full potential of open-vocabulary vision models.
Summary updated