Abstract
Contrastive Language-Image Pretraining (CLIP) has established a new paradigm for zero-shot visual recognition. However, these models often exhibit poor calibration, sensitivity to image corruptions, and inadequate out-of-distribution (OOD) detection. This paper introduces LP-CLIP, an unsupervised fine-tuning strategy that enhances CLIP's reliability using only unlabeled data. By employing a teacher-student framework with pseudo-labeling and strong data augmentation, LP-CLIP achieves significant gains in robustness and calibration. Experimental results across multiple benchmarks show that LP-CLIP drastically reduces calibration error and outperforms standard zero-shot CLIP in OOD detection, often matching the performance of supervised linear probing.
Introduction
Foundation models like CLIP have enabled remarkable zero-shot classification capabilities. Despite this, their deployment in safety-critical applications is limited by a "reliability" problem. Specifically, CLIP models tend to be overconfident in their errors, perform poorly under natural image corruptions (e.g., blur, noise), and struggle to distinguish between known and unknown classes. While supervised fine-tuning can mitigate these issues, it relies on expensive human-labeled datasets. LP-CLIP addresses this by asking: Can we improve CLIP's robustness using only unlabeled data?
Methods: LP-CLIP Architecture
The core of LP-CLIP is an unsupervised teacher-student distillation approach. The method freezes the original CLIP image encoder and appends a single trainable linear probing layer.
During training, the original CLIP model acts as a Teacher. It processes a "weakly augmented" image to generate a pseudo-label and a corresponding confidence score. Simultaneously, the Student—comprising the frozen encoder and the new linear layer—processes a "strongly augmented" version of the same image. The student is trained to minimize a weighted cross-entropy loss against the teacher's pseudo-label. The weighting mechanism ensures that the student learns primarily from samples where the teacher is highly confident, effectively filtering out noise from ambiguous images. This process forces the model to learn stable, "denoised" representations that are invariant to heavy distortions.
Experimental Results
LP-CLIP was evaluated on a diverse set of benchmarks, including CIFAR-10/100, Tiny ImageNet, and their corrupted "C" variants. OOD detection was tested using datasets like SVHN and ImageNet-O. LP-CLIP demonstrates substantial improvements over standard zero-shot CLIP across all metrics:
- Superior Calibration: On CIFAR-10, LP-CLIP achieved an Expected Calibration Error (ECE) of 0.0203, a significant reduction from the 0.0587 observed in the best-prompted zero-shot CLIP.
- Enhanced Robustness: Under image corruption (CIFAR-10-C), LP-CLIP maintained 89.8% accuracy, compared to approximately 84.5% for zero-shot CLIP.
- OOD Detection: LP-CLIP achieved a False Positive Rate at 95% Recall (FPR95) of 14.52% for OOD detection, nearly halving the 28.54% rate of standard CLIP.
Visualizations of the latent space via t-SNE further indicate that LP-CLIP produces tighter, more distinct class clusters, suggesting a cleaner internal feature representation compared to the original CLIP model.
Discussion and Conclusion
LP-CLIP proves that CLIP’s zero-shot features can be significantly improved through unsupervised local adaptation. By simply training a linear probe with a confidence-weighted consistency loss, the model becomes more calibrated and robust.
However, limitations remain. The method's performance is inherently tied to the initial zero-shot accuracy of the backbone; a poor "teacher" on a specific domain will provide unreliable pseudo-labels. Future work will explore integrating LP-CLIP with active learning to further bridge the gap between unsupervised and supervised performance. In conclusion, LP-CLIP offers a computationally efficient and effective path toward more reliable foundation models without the need for additional human labeling.
Summary updated