Transferring Pre-trained Multimodal Representations with Cross-modal Similarity Matching

Byoungjip Kim, Sungik Choi, Dasol Hwang, Moontae Lee, Honglak Lee

TL;DR

BeamCLIP is a novel framework that transfers the rich visual-language representations of massive models like CLIP into smaller, more efficient architectures like ResNet-18. By matching similarity distributions across text "anchors" and using context-aware prompts, BeamCLIP enables small models to significantly outperform traditional self-supervised methods, nearing the performance of fully supervised models on ImageNet.

What Problem Does This Paper Address?

Large-scale Vision-Language Pre-training (VLP) models like CLIP have revolutionized zero-shot learning, but they come with a catch: they are enormous and computationally expensive to train and deploy. While we often want to use smaller, "practical" models (like ResNet-18) for edge devices or low-resource environments, these smaller models typically lack the representational "richness" of their larger counterparts.

Standard knowledge distillation—where a small "student" model learns from a large "teacher"—usually requires access to the original, massive training datasets (like CLIP’s 400 million image-text pairs), which are often private or too large to handle. The authors of this paper sought a way to effectively "distill" CLIP's knowledge into small models using only unlabeled target data.

Methods

The authors introduce BeamCLIP, which employs three main strategies to bridge the gap between a large teacher (CLIP-ViT) and a small student (ResNet):

  1. Cross-modal Similarity Matching (CSM): Instead of just trying to match the teacher's output for a single image, the student learns the relative similarity between an image and a set of "anchor" text prompts (e.g., "a photo of a dog," "a photo of a cat"). The student is trained to mimic the teacher’s probability distribution across these anchors, which helps preserve the complex "topology" of the teacher's embedding space.
  2. Context-based Prompt Augmentation (CPA): Simple text prompts can be ambiguous (e.g., is a "snapdragon" a flower or a mythical creature?). CPA uses external data, like Wikipedia descriptions or hierarchical labels, to enrich the prompts. This reduces lexical ambiguity and ensures the "anchors" in the embedding space are semantically precise.
  3. Instance Similarity Matching (ISM): This is a more standard regression task where the student directly attempts to match the teacher's normalized feature vector for a specific augmented image.
The BeamCLIP architecture: Unlabeled images and text prompts are processed by student and teacher encoders. The student learns by matching both instance-level and cross-modal similarity distributions.

The process is further boosted by initializing the student with weights from a vision-only self-supervised learning (SSL) method like SwAV, providing a better starting point for the transfer.

Datasets

The researchers evaluated BeamCLIP on several standard benchmarks:

  • ImageNet-1K: The primary benchmark for general visual representation.
  • CIFAR-10 & CIFAR-100: Standard small-scale image classification.
  • STL10: A dataset designed for unsupervised learning.
  • Flowers102 & Pets37: Fine-grained datasets used to test the effectiveness of context-based prompts (CPA).
  • CC-3M & ImageNet-21K: Used to evaluate the zero-shot capabilities of the transferred models.

Key Insights and Ideas

  • Preserving the "Shape" of Knowledge: The core "aha" moment is that matching how an image relates to many different concepts (anchors) is much more effective than just trying to copy a single feature vector. This "similarity matching" preserves the relationships between classes that CLIP learned from its massive training set.
  • Language as a Bridge: By using text prompts as anchors, the authors leverage CLIP's unique multimodal alignment. This allows them to perform unsupervised transfer because text prompts are "free" and don't require the original image-text pairs.
  • Context Matters: Lexical ambiguity is a real hurdle. Adding a snippet of Wikipedia text to a prompt significantly clarifies the embedding space for the model, especially for fine-grained categories.

Key Results

BeamCLIP achieves impressive results, particularly in "linear probe" accuracy (where the backbone is frozen and only a final classification layer is trained):

  • ResNet-18 on ImageNet-1K: Reaches 66.2% top-1 accuracy, outperforming popular SSL methods like SimCLR (51.8%) and SwAV (63.7%), and closing in on the supervised baseline of 69.8%.
  • ResNet-50 on ImageNet-1K: Achieves 75.0%, nearly matching the supervised performance of 76.2%.
  • Zero-Shot Transfer: A ResNet-50 trained via BeamCLIP on a fraction of the data (ImageNet-21K) achieved 57.5% zero-shot accuracy on ImageNet-1K, which is remarkably close to the original CLIP-RN50's 59.6%.
Comparison of ImageNet-1K top-1 linear probe accuracy. BeamCLIP (red line) consistently outperforms other self-supervised methods across different training durations.

Limitations and Future Work

While BeamCLIP is highly effective, the authors note a few limitations:

  • Training Duration: While BeamCLIP is more efficient than training from scratch, standard SSL methods can eventually narrow the performance gap if trained for a very long time (e.g., 800+ epochs).
  • Prompt Engineering: CPA currently requires some manual effort or external data sources (like Wikipedia) to generate the augmented prompts.
  • Scope: The method is designed to create an effective student of CLIP, not to replace the need for large-scale pre-training entirely.

Future work could involve automating the prompt augmentation process or exploring how to transfer knowledge from even larger multimodal models like ALIGN or Flamingo.

Summary updated

BibTeX
@inproceedings{kim2022transferring,
  author = {Byoungjip Kim and Sungik Choi and Dasol Hwang and Moontae Lee and Honglak Lee},
  title = {{Transferring Pre-trained Multimodal Representations with Cross-modal Similarity Matching}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=sOHcu6a8mu0},
}
Figure