Abstract
Contrastive vision-language models like CLIP have shown great progress in transfer learning. In the inference stage, the proper text description, also known as prompt, needs to be carefully designed to correctly classify the given images. In order to avoid laborious prompt engineering, recent works such as CoOp, CLIP-Adapter and Tip-Adapter propose to adapt vision-language models for downstream image recognition tasks on a small set of labeled data. Though promising improvements are achieved, requiring labeled data from the target datasets may restrict the scalability. In this paper, we explore a different scenario, in which the labels of the target datasets are unprovided, and we present an unsupervised prompt learning (UPL) approach to avoid prompt engineering while simultaneously improving transfer performance of CLIP-like vision-language models. As far as we know, UPL is the first work to introduce unsupervised learning into prompt learning. Experimentally, our UPL outperforms original CLIP with prompt engineering on ImageNet as well as other 10 datasets. An enhanced version of UPL is even competitive with the 8-shot CoOp and the 8-shot TIP-Adapter on most datasets.
Introduction
Vision-Language Models (VLMs) like CLIP have revolutionized computer vision by aligning images and text in a shared embedding space. However, their effectiveness on specific downstream tasks—such as identifying fine-grained categories or specialized imagery—heavily depends on the "prompt" used (e.g., "a photo of a [CLASS]"). Finding the optimal prompt typically requires tedious manual engineering or a small set of labeled examples for supervised adaptation (e.g., CoOp).
Unsupervised Prompt Learning (UPL) addresses these limitations by automating prompt optimization using only unlabeled images from the target dataset. By eliminating the need for human-labeled data, UPL significantly enhances the scalability and practical utility of VLMs in zero-label scenarios.
Methodology
The UPL framework operates in two distinct stages to bridge the gap between zero-shot inference and supervised adaptation.
1. Pseudo-Label Generation
UPL first uses a pre-trained CLIP model with a generic prompt to generate initial predictions for the unlabeled target images. A critical observation made by the authors is that VLMs exhibit "biased preferences," where confidence scores do not always align with actual accuracy. To mitigate this, UPL employs a Top-K selection strategy instead of a standard confidence threshold. By selecting the $K$ (e.g., 16) most confident images for every class, the framework ensures a balanced and more reliable training set for the next stage.
2. Prompt Representation Optimization
Rather than optimizing a discrete text string, UPL learns a "continuous prompt"—a set of learnable vectors in the text encoder's input space. These vectors are optimized using a standard cross-entropy loss against the pseudo-labels generated in the first stage. This self-training approach allows the model to adapt its internal representations to the specific distribution of the target dataset.
An enhanced version, UPL*, further improves performance by using an ensemble of different CLIP architectures (e.g., ResNet-50 and ViT-B/16) to generate higher-quality pseudo-labels through a voting mechanism.
Key Insights and Results
The authors evaluated UPL across 11 diverse datasets, including ImageNet, fine-grained categories (OxfordPets, StanfordCars), and specialized tasks (EuroSAT, DTD).
The Confidence-Accuracy Discrepancy
A core motivation for the Top-K strategy is illustrated in the relationship between model confidence and accuracy. As shown in Figure 3, some classes may have low average confidence but high prediction accuracy, while others show the opposite. Standard thresholding would exclude many correctly predicted samples in low-confidence classes, leading to class imbalance.
Performance Benchmarks
- Superiority over Manual Prompting: UPL outperformed the original CLIP (with manual prompt engineering) on all 11 datasets, with an average accuracy improvement of 4.2% (9.19% for UPL*).
- Unsupervised vs. Supervised: Remarkably, UPL surpassed the performance of 2-shot CoOp, a supervised method.
- Competitive with 8-shot Methods: UPL achieved results competitive with 8-shot CoOp and 8-shot Tip-Adapter on most datasets. For instance, on the EuroSAT satellite imagery dataset, UPL reached 71.04% accuracy, more than doubling the zero-shot CLIP baseline of 38.23%.
Conclusion
UPL represents the first successful attempt to introduce unsupervised learning into the prompt learning paradigm for VLMs. By leveraging a robust pseudo-labeling strategy and continuous prompt optimization, it removes the bottleneck of manual prompt engineering and the requirement for labeled data. While performance remains tied to the quality of the initial VLM, UPL demonstrates that self-training is a powerful tool for adapting foundation models to new domains without human intervention.
Summary updated