Intra-Modal Proxy Learning for Zero-Shot Visual Categorization with CLIP

Qi Qian, Yuanhong Xu, Juhua Hu

TL;DR

CLIP's zero-shot classification relies on comparing image embeddings to text embeddings, but a persistent "modality gap" between the text and vision spaces limits its performance. This paper introduces Intra-Modal Proxy Learning (InMaP), a highly efficient method that learns optimal class proxies directly in the vision space using refined pseudo-labels. By bypassing the need to backpropagate through massive encoders, InMaP boosts ImageNet zero-shot accuracy by over 3% in under a minute on a single GPU.

The Problem: The Modality Gap

Vision-language models like CLIP perform zero-shot classification by embedding an image and comparing it to the text embeddings of class names (e.g., "a photo of a dog"). These text embeddings act as "proxies" for the visual classes.

However, recent research has shown that the text and vision embedding spaces in CLIP do not perfectly overlap; there is a distinct and measurable "modality gap."

Conceptual illustration of the modality gap between text and vision spaces, and how a vision proxy is recovered.

The authors mathematically prove that CLIP's contrastive loss inherently preserves this gap. Because the spaces are misaligned, using a text embedding as the centroid (proxy) for a cluster of images is fundamentally sub-optimal. The optimal proxy for an image classification task should actually reside purely in the vision space. The core challenge then becomes: how do you find the optimal vision proxy when you don't have any labeled target data?

The Solution: Intra-Modal Proxy Learning (InMaP)

Instead of trying to tune text prompts—which is computationally expensive and still suffers from the modality gap—the authors propose Intra-Modal Proxy Learning (InMaP). The process works entirely on extracted features, meaning the heavy CLIP encoders remain frozen.

  1. Feature Extraction & Initial Pseudo-labeling: The system extracts visual features for the unlabeled target dataset and text features for the class names. It then generates initial pseudo-labels for the images using standard CLIP zero-shot matching.
  2. Pseudo-label Refinement: Because the initial text-based predictions are noisy, the authors refine them using Optimal Transport (specifically, the Sinkhorn distance). This forces the pseudo-labels to align with a prior distribution (e.g., assuming a roughly balanced number of classes). They also apply confidence thresholding, converting highly confident soft labels into one-hot labels to reduce noise.
  3. Vision Proxy Learning: Finally, they learn a new set of class proxies directly in the vision space. They do this by minimizing the KL divergence between the refined pseudo-label distribution and the predictions made by the new, learnable vision proxies. Because this is a convex optimization problem on fixed feature vectors, it can be solved incredibly fast using standard gradient descent.

Key Insights and Theoretical Grounding

  • The Modality Gap is Baked In: The authors theoretically demonstrate that the small temperature parameter used in CLIP's contrastive loss prevents the text and vision spaces from fully merging. The gap is a feature of the training objective, not just an artifact.
  • Vision Proxies > Text Proxies: Because of this inherent gap, the mathematically optimal proxy for classifying images exists in the vision space. Text proxies are merely a cross-modal substitute.
  • Temperature Calibration is Crucial: To successfully learn a vision proxy from text-generated pseudo-labels, the temperature parameter used during the intra-modal learning phase must be larger than the one used during CLIP's pre-training. This calibrates the magnitude of the distributions to account for the overlap between the two modalities.
  • Bounded Error: The authors prove that the distance between their learned vision proxy and the true optimal vision proxy is strictly bounded by the quality of the pseudo-labels. This highlights exactly why the Sinkhorn distance refinement step is so critical to the algorithm's success.

Key Results and Efficiency

The authors evaluated InMaP on standard zero-shot transfer benchmarks, including ImageNet and 13 diverse downstream tasks covering fine-grained classification, textures, and scenes (e.g., Stanford Cars, CIFAR-100, DTD, SUN397).

  • ImageNet Accuracy: InMaP improves zero-shot accuracy on ImageNet from 77.02% (vanilla CLIP) to 80.21% using the ViT-L/14@336 backbone.
  • Extreme Efficiency: Because InMaP only optimizes extracted feature vectors and doesn't require backpropagation through the CLIP encoders, it takes less than 1 minute (around 30 seconds, or 6 seconds with FP16) on a single V100 GPU.
  • Downstream Dominance: On the 13 downstream tasks, InMaP improves average accuracy by over 5% compared to the baseline (using a ViT-B/16 backbone).
  • Beating Heavier Methods: InMaP outperforms state-of-the-art prompt tuning methods (like TPT) and even beats several recent methods (like SuS-X and VisDesc) that rely on querying massive external LLMs like GPT-3 to generate rich text descriptions.

Limitations and Future Work

The theoretical analysis regarding the modality gap is specific to dual-encoder contrastive models (like CLIP). It does not directly apply to other vision-language pre-training paradigms, such as masked data modeling (e.g., BEiT-3) or encoder-decoder captioning (e.g., CoCa).

For future work, the authors suggest that combining their intra-modal proxy learning with large language models (LLMs) could be a fruitful direction. An LLM could generate superior initial text proxies, which InMaP could then translate into even more accurate vision proxies.

Summary updated

BibTeX
@inproceedings{qian2023intra,
  author = {Qi Qian and Yuanhong Xu and Juhua Hu},
  title = {{Intra-Modal Proxy Learning for Zero-Shot Visual Categorization with CLIP}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=NXLjaYdgaL},
}
Figure