Rethinking Contrastive Loss in CLIP Post-training: A Complementary Framework with Frozen Text Encoder

Zidan Wang, Yaqian Li, Xiaokai Zhang, Kun He, Kaiwen Long, Hanpeng LiuNeurIPS 2026

TL;DR

Conventional wisdom says you shouldn't use CLIP’s original contrastive loss to fine-tune it on small datasets because small batch sizes cause "catastrophic forgetting." This paper discovers that batch size isn't the villain—the temperature parameter is. By simply turning down the contrastive temperature and combining it with two lightweight stabilizing losses, the authors create ComCLIP, a single-epoch upgrade for CLIP's vision encoder that boosts visual feature quality while remaining a zero-cost, drop-in replacement for downstream vision-language models.

What Problem Does This Paper Address?

OpenAI’s CLIP is the visual backbone for countless modern Vision-Language Models (VLMs) like LLaVA. However, CLIP has well-known blind spots on fine-grained visual details. Retraining CLIP from scratch is wildly expensive and breaks compatibility with existing models built around CLIP’s specific embedding space.

The pragmatic alternative is post-training: refining a pretrained CLIP on a small dataset. Recently, researchers abandoned CLIP’s native contrastive loss (InfoNCE, which pulls matched image-text pairs together and pushes mismatched "negatives" apart) during post-training. They argued that affordable small batch sizes don't provide enough negative examples, causing the model to forget what it already knew. Instead, the field pivoted to complex distillation recipes. The authors ask: Is contrastive post-training really broken because of batch size, and how can we upgrade CLIP's vision encoder without breaking downstream VLM compatibility?

Methods

The authors propose ComCLIP, a single-epoch post-training recipe. Crucially, they freeze CLIP’s text encoder and only update the vision encoder. Because the text space never moves, the refined vision encoder remains a strict drop-in replacement for existing VLMs with zero added inference cost.

Figure 2: Overview of ComCLIP. Three parallel branches operate jointly: (i) frozen CLIP text encoder for image-text alignment (Lclip), (ii) trainable CLIP image encoder anchored to its frozen pretrained counterpart (Lmse), and (iii) frozen DINOv2 encoder providing relational supervision via batch-wise similarity matrices (Lrkd). All three losses operate on the post-projection embedding.

ComCLIP shapes the vision encoder's output embeddings using one core principle—refine relative structure while anchoring absolute geometry—via three losses:

  1. Properly-Tempered Contrastive Loss (The twist on a standard tool): Standard InfoNCE loss, but with the temperature parameter $\tau$ lowered from CLIP's pretraining default ($\approx 0.07$) down to $0.01$.
  2. MSE Anchoring Loss: Mean squared error between the trainable vision encoder and a frozen copy of the original CLIP vision encoder, preventing the feature space from drifting.
  3. Relational Distillation from DINOv2: DINOv2 is a self-supervised vision model with rich visual structure. Instead of forcing CLIP embeddings to match DINOv2 coordinates directly (which ruins text alignment), ComCLIP uses KL divergence to match their batch-wise similarity matrices—teaching CLIP which images look similar to each other according to DINOv2.

Datasets

No new benchmarks are introduced.

  • Post-training: Conceptual Captions 3M (CC3M, default), CC12M, and human-annotated COCO Caption (591K pairs), plus ImageNet-1K for baselines.
  • Evaluation: Zero-shot classification across 12 datasets, image-text retrieval on MS COCO and Flickr30K, linear probing (training a simple linear classifier on frozen features) across 5 datasets, fine-grained perception on MMVP (135 image pairs), and 8 VLM benchmarks (including AI2D, POPE, MME, TextVQA, and OCRBench) using LLaVA-1.5-7B.

Key Insights and Ideas

  • Temperature, not batch size, caused "forgetting": In a pretrained CLIP, most image-text pairs are already well-separated. In the InfoNCE gradient math, the update weight on a negative pair decays exponentially based on its margin divided by temperature $\tau$. At $\tau = 0.07$, already-correct pairs still receive noticeable gradients, pushing CLIP to overfit the small dataset. Lowering $\tau$ to $0.01$ makes gradients on easy pairs vanish, leaving existing knowledge intact and focusing updates strictly on hard mistakes.
  • Different losses govern separable skills: Ablations show a remarkably clean division of labor. Tempered contrastive loss boosts zero-shot classification and retrieval; MSE anchoring preserves transferable visual features; and DINOv2 relational distillation gives linear-probe transferability an extra push.

Key Results

Tested on ViT-B/16 and ViT-L/14 backbones, ComCLIP improves all four core evaluation dimensions over the original OpenAI CLIP.

Figure 1: Multi-dimensional comparison on ViT- L/14 (values from Table 1). Relative to the original OpenAI CLIP, ComCLIP improves all four evalua- tion dimensions (zero-shot classification, retrieval, linear probing, MMVP), whereas prior post-training methods exhibit characteristic trade-offs. Each axis is min–max normalized per metric; ComCLIP’s MMVP is the 3-seed mean (Sec. 4.3).
  • Temperature rescue: On ViT-B/16 (CC3M), naive contrastive post-training at $\tau = 0.07$ drops zero-shot accuracy from $61.82\%$ to $57.90\%$. Changing only $\tau$ to $0.01$ flips that loss into a gain ($62.90\%$).
  • Trade-offs vs. self-distillation (CLIP-Refine): Over 3 seeds on ViT-B/16, ComCLIP matches CLIP-Refine on zero-shot accuracy ($63.00\%$ vs. $62.87\%$) and trails on retrieval, but dramatically outperforms it on visual feature transferability via linear probing ($48.99\%$ vs. $42.28\%$; CLIP-Refine actually degrades below original CLIP's $44.70\%$). On ViT-L/14, ComCLIP also beats CLIP-Refine on MMVP ($24.20\%$ vs. $19.01\%$).
  • Drop-in VLM compatibility: Swapping ComCLIP into LLaVA-1.5-7B without retraining the projector or LLM yields $+0.02\%$ mean relative change across 8 benchmarks—confirming it doesn't break the frozen VLM, whereas baselines slightly degrade performance ($\approx -1\%$).

Limitations and Future Work

  • Compatibility $\neq$ instant VLM gains: Swapping ComCLIP into a frozen LLaVA preserves performance rather than improving it; whether re-aligning the projector unlocks ComCLIP's better visual features for VLM tasks remains untested.
  • Scope of math and metrics: The temperature gradient analysis applies specifically to InfoNCE, not KL self-distillation or SigLIP’s sigmoid loss. Also, ComCLIP isn't designed to maximize fine-grained perception like heavy generative-model methods do, and MMVP's tiny size (135 pairs) causes high seed variance.
  • Data scaling: More data isn't automatically better—12M pairs (CC12M) did not consistently beat 3M pairs (CC3M) in single-epoch training, leaving the exact interplay of data quality and training dynamics an open question.

Summary updated

Abstract

CLIP serves as a foundational vision-language model and the de facto vision en- coder for downstream VLMs such as LLaVA. Post-training offers a lightweight route to refine CLIP, but recent work argues that the standard contrastive loss is unsuitable for post-training due to catastrophic forgetting under small batches, mo- tivating designs that abandon the contrastive objective in favor of distillation. We revisit this premise and find that, for the InfoNCE objective, the reported forgetting is driven primarily not by insufficient negatives but by an inappropriate magni- tude of the contrastive temperature τ: with τ set sufficiently small, contrastive post-training improves rather than degrades the pretrained CLIP, which we explain through the temperature dependence of the InfoNCE gradient. Building on this finding, we propose ComCLIP, a lightweight single-epoch post-training recipe that freezes CLIP’s text encoder—so the refined vision encoder is a drop-in replacement with unchanged architecture and inference cost—and trains the vision encoder with a properly-tempered contrastive loss, an MSE anchoring loss against the original CLIP, and a relational distillation loss from DINOv2. Over multiple seeds, Com- CLIP matches the self-distillation baseline CLIP-Refine on zero-shot classification while significantly improving the transferability of visual features, measured by linear probing (48.99 vs. 42.28 on ViT-B/16), and on ViT-L/14 it also improves MMVP over CLIP-Refine (24.20 vs. 19.01); CLIP-Refine remains stronger on image-text retrieval. Used as a drop-in vision encoder for LLaVA-1.5-7B without re- aligning the projector or LLM, ComCLIP yields no net change across 8 VLM bench- marks, i.e., the refinement does not break downstream compatibility. Code and models are available at https://github.com/showstarpro/ComCLIP.git.
BibTeX
@inproceedings{wang2026rethinking,
  author = {Zidan Wang and Yaqian Li and Xiaokai Zhang and Kun He and Kaiwen Long and Hanpeng Liu},
  title = {{Rethinking Contrastive Loss in CLIP Post-training: A Complementary Framework with Frozen Text Encoder}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=tjKgJbAYn9},
}
Figure