Learning Visual Representation from Modality-Shared Contrastive Language-Image Pre-training

Haoxuan You, Luowei Zhou, Bin Xiao, Noel Codella, Yu Cheng, Ruochen Xu, Shih-Fu Chang, Lu Yuan

Abstract

Large-scale multi-modal contrastive pre-training has demonstrated great utility to learn transferable features for a range of downstream tasks by mapping multiple modalities into a shared embedding space. Typically, this has employed separate encoders for each modality. However, recent work suggests that transformers can support learning across multiple modalities and allow knowledge sharing. Inspired by this, we investigate a variety of Modality-Shared Contrastive Language-Image Pre-training (MS-CLIP) frameworks. More specifically, we question how many parameters of a transformer model can be shared across modalities during contrastive pre-training, and rigorously examine architectural design choices that position the proportion of parameters shared along a spectrum. In studied conditions, we observe that a mostly unified encoder for vision and language signals outperforms all other variations that separate more parameters. Additionally, we find that light-weight modality-specific parallel modules further improve performance. Experimental results show that the proposed MS-CLIP approach outperforms vanilla CLIP by up to 13% relative in zero-shot ImageNet classification (pre-trained on YFCC-100M), while simultaneously supporting a reduction of parameters. In addition, our approach outperforms vanilla CLIP by 1.6 points in linear probing on a collection of 24 downstream vision tasks. Furthermore, we discover that sharing parameters leads to semantic concepts from different modalities being encoded more closely in the embedding space, facilitating the transferring of common semantic structure (e.g., attention patterns) from language to vision.

Introduction

The dominant paradigm in multi-modal learning, popularized by models like CLIP, involves a "dual-encoder" architecture: one dedicated transformer for images and another for text. While effective, this approach is computationally expensive and ignores a fundamental intuition: language and vision often describe the same semantic concepts.

This research investigates whether a single, unified transformer can process both modalities effectively. We address three primary questions: which sub-modules within a transformer layer can be shared, how many layers should be shared versus modality-specific, and whether lightweight specialized modules can bridge the gap between raw pixels and text tokens.

The MS-CLIP Framework

MS-CLIP introduces a framework where the core computational "logic"—specifically the Multi-Head Attention and Feed-Forward Network (FFN) weights—is shared across vision and language modalities.

Comparison of Original CLIP and MS-CLIP architectures, highlighting the shared transformer blocks.

Key Architectural Innovations

  • Modality-Specific LayerNorm (LN): A crucial finding of this work is that while the attention and FFN weights can be shared, the normalization layers must remain separate. This allows the model to account for the distinct statistical distributions of image and text features while using the same underlying logic.
  • Early Specialization: To handle the initial differences between pixels and words, the first block of the network is specialized. Images are processed through lightweight convolutional layers (CNNs) to manage spatial resolution, while text uses a standard transformer layer.
  • Efficient Parallel Branch: To capture multi-scale visual information often missed by standard Vision Transformers (ViT), we incorporate a tiny parallel CNN branch. These features are integrated into the shared transformer via depth-wise convolutional adapters.
  • Weight Sharing Strategy: Rigorous ablation studies revealed that sharing all 12 transformer layers outperformed more complex selection methods or partial sharing strategies.

Why Sharing Works: Semantic Convergence

Sharing parameters does more than just save memory; it acts as a form of regularization. By using a shared backbone, the model forces visual and textual concepts into closer alignment. Using "Common Semantic Structure" (CSC) metrics, we observed that shared models develop nearly identical attention patterns for the same concept across modalities. For instance, the model's visual attention on a cat in a photo aligns closely with its textual attention on the word "cat" in a sentence. This synergy allows language supervision to help the vision branch ignore trivial noise and focus on high-level semantics.

Experimental Results

We evaluated MS-CLIP on a massive suite of 25 downstream datasets, including ImageNet, MSCOCO, and specialized tasks like EuroSAT and UCF101. Pre-training was conducted on YFCC-100M (filtered to ~22M pairs) and a subset of LAION-400M.

Detailed performance metrics across 24 downstream tasks, zero-shot ImageNet, and MSCOCO retrieval.

Performance Highlights

  • Zero-Shot Accuracy: MS-CLIP-S (the specialized version) achieved 36.7% on zero-shot ImageNet classification, a 4.5 point absolute gain (13% relative) over vanilla CLIP.
  • Linear Probing: Across 24 downstream tasks, MS-CLIP-S outperformed vanilla CLIP by an average of 1.6 points.
  • Parameter Efficiency: The shared architecture is significantly leaner. MS-CLIP-S utilizes 132M parameters, compared to 151M for a comparable vanilla CLIP setup.
  • Cross-Modal Retrieval: Significant gains in Image-to-Text (I2T) and Text-to-Image (T2I) recall on MSCOCO suggest a much tighter and more effective embedding space.

Conclusion

MS-CLIP demonstrates that vision and language encoders do not need to be separate entities. By sharing the vast majority of transformer parameters, we can achieve superior performance with fewer parameters. Future work will explore scaling these benefits to billions of parameters and extending the shared backbone to additional modalities like audio and video.

Summary updated

BibTeX
@inproceedings{you2022learning,
  author = {Haoxuan You and Luowei Zhou and Bin Xiao and Noel Codella and Yu Cheng and Ruochen Xu and Shih-Fu Chang and Lu Yuan},
  title = {{Learning Visual Representation from Modality-Shared Contrastive Language-Image Pre-training}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=9Pgg8YZHjzJ},
}
Figure