Mitigate the Gap: Improving Cross-Modal Alignment in CLIP

Sedigheh Eslami, Gerard de Melo

AlignCLIP is a novel framework designed to resolve the "modality gap" in Contrastive Language-Image Pre-training (CLIP) models—a phenomenon where image and text embeddings cluster into completely separate, disconnected regions of the embedding space. By sharing parameters between encoders and introducing a semantically-regularized "separation" loss, AlignCLIP achieves much tighter cross-modal alignment and significantly boosts performance in zero-shot classification and retrieval tasks.

The Modality Gap: What Problem Does This Paper Address?

OpenAI’s CLIP has revolutionized vision-language tasks, but it suffers from a distinct geometric quirk known as the modality gap. Even though the model is explicitly trained to bring matching images and text together, the resulting embeddings for the two modalities end up densely distributed in distinct, isolated "neighborhoods" on the hypersphere.

Visualization of the modality gap in standard CLIP

This gap renders the embedding space overly sparse and disconnected. Previous attempts to close this gap often relied on "naive shifting"—essentially calculating the average vector between the two clusters and moving one toward the other. However, the authors argue that this brute-force translation distorts the meaningful internal structure of the data, potentially hurting the model's ability to distinguish between similar items within a single modality.

Methods: The AlignCLIP Architecture

To bridge this gap without destroying internal semantic structures, the authors propose two primary refinements to the standard CLIP architecture, collectively called AlignCLIP:

  1. SharedCLIP (Parameter Sharing): In standard CLIP, the image and text encoders are separate "towers" with their own independent parameters. AlignCLIP shares the Transformer layers and, crucially, the final projection layer between both modalities. This creates a strong inductive bias, forcing both modalities to be mapped through the same functional space.
  2. IMSep (Intra-Modality Separation): To prevent embeddings from bunching up too tightly (which exacerbates the gap), the authors introduce a loss function that encourages embeddings within a modality to spread out.
  3. The Semantic Twist: You cannot simply push all images apart, as some images are genuinely similar. AlignCLIP uses a pre-trained sentence encoder (SBERT) to evaluate the captions of image pairs. If the captions are semantically different, the model is penalized if the image embeddings are too close. If the captions are similar, the separation "push" is relaxed.

Datasets and Evaluation

  • Pre-training: The models were trained from scratch on the Conceptual Captions 12M (CC12M) dataset.
  • Evaluation:
  • Alignment & Classification: CC3M, MSCOCO, ImageNet-1K, CIFAR-10, CIFAR-100, Flowers-102, and Stanford Cars.
  • Robustness: ImageNetV2, ImageNet-R, ImageNet-A, and ImageNet-Sketch.
  • Retrieval: MSCOCO and Flickr30K.

Key Insights

  • The Projection Layer Matters: While some prior work explored sharing Transformer layers, this paper emphasizes that sharing the projection layer is vital for effectively reducing the modality gap.
  • Text as a Semantic Guide: Using a frozen, high-quality sentence encoder (SBERT) to provide a "semantic distance" metric allows the model to regularize the image space without needing manual labels. It essentially uses the richness of language to organize the visual space.
  • Closing the Gap Improves "Reasoning": By reducing the gap, the model doesn't just get better at matching exact pairs; it gets better at understanding the neighborhoods of the space. Qualitative results show that when AlignCLIP "fails" to find the exact ground truth in a retrieval task, the images it does find are often more semantically relevant than those found by standard CLIP.

Key Results

AlignCLIP demonstrates significant quantitative improvements across multiple benchmarks:

  • Alignment Score: AlignCLIP increased the alignment score (average cosine similarity of positive pairs) substantially across multiple datasets. As shown in sample distributions, the average cosine similarity improved from 0.47 in standard CLIP to 0.67 in AlignCLIP, corresponding to a massive reduction in the average angle between paired embeddings.
Cosine similarities of positive samples comparing CLIP, SharedCLIP, and AlignCLIP
  • Zero-Shot Classification: AlignCLIP showed massive gains over standard CLIP, particularly on smaller-object datasets like CIFAR-100 (+8% Top-1 accuracy) and CIFAR-10 (+8% Top-1 accuracy).
  • Robustness: On out-of-distribution datasets like ImageNet-R and ImageNet-Sketch, AlignCLIP consistently outperformed CLIP by approximately 2%, suggesting that a better-aligned space leads to better generalization.
  • Linear Probing: Even when freezing the backbone and training a simple classifier, AlignCLIP outperformed CLIP by up to 5%, proving the learned representations are inherently more discriminative.

Limitations and Future Work

  • Language Scope: The study was limited to English-language datasets. Future work should investigate how these alignment techniques perform in multilingual or cross-lingual settings.
  • Dependency on SBERT: The "IMSep" loss relies on a pre-trained sentence encoder. The performance of AlignCLIP is likely sensitive to the quality of this teacher model, and the authors have not yet benchmarked how different sentence encoders affect the final outcome.
  • Benchmark Diversity: While tested on many standard vision benchmarks, complex reasoning tasks (like the Hateful Memes dataset) have not yet been explored.

Summary updated

BibTeX
@inproceedings{eslami2025mitigate,
  author = {Sedigheh Eslami and Gerard de Melo},
  title = {{Mitigate the Gap: Improving Cross-Modal Alignment in CLIP}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=aPTGvFqile},
}
Figure