MIT and MPI's MM-TS Makes CLIP Smarter by Ditching Fixed Temperature
MM-TS dynamically schedules contrastive learning temperature per sample, beating CLIP and AVION on long-tail image and video retrieval benchmarks
ProTakeaways
- MM-TS dynamically adjusts the contrastive loss temperature per sample during training, based on how common or rare each sample's concept is in the dataset.
- A cosine schedule oscillates the base temperature across training, alternating between instance discrimination (low temp) and semantic cluster formation (high temp).
- Text annotations are clustered with K-Means + SentenceBERT before training; larger clusters get higher temperature shifts, rare samples get lower ones -- all with negligible compute overhead.
- The framework unifies InfoNCE and max-margin losses by showing temperature and margin play the same role, enabling the same scheduling trick in both.
- New state-of-the-art on EPIC-KITCHENS-100 (mAP V→T +3.1%) and YouCook2 (R@1 +2.6%) when plugged into AVION and VAST respectively.
- Code is open-source and integrates into existing CLIP-style training loops by modifying only the loss function.
Contrastive learning -- the technique that powers CLIP, video-language models, and most modern retrieval systems -- has a quiet but persistent flaw: it treats every training sample the same way. A single fixed temperature parameter governs how hard the model pushes embeddings apart, regardless of whether a sample belongs to a common concept like "people in an office" or a rare one like "hummus preparation." Researchers from MPI for Informatics, University of Bonn, and MIT-IBM Watson AI Lab now propose MM-TS (Multi-Modal Temperature and Margin Schedules), a lightweight framework that fixes this by dynamically adjusting the temperature -- and the margin -- for each sample during training, based on where it sits in the data distribution.
The temperature problem in contrastive learning
To understand why this matters, you need to know what temperature actually does in a contrastive loss. Contrastive learning brings positive pairs closer together -- like image-caption pairs in the multi-modal case -- while pushing apart all other samples (negatives). This process is controlled by the temperature parameter in InfoNCE-based losses, or by the margin in max-margin formulations, both of which govern the strength of attraction and repulsion forces in the embedding space.
The effect is asymmetric and non-obvious. At small temperatures, the objective penalizes hard negatives (the closest, most confusable samples) much more than easy ones, resulting in instance discrimination -- a highly uniform embedding space where every sample is pushed away from every other. At high temperatures, all negatives are penalized more uniformly, encouraging the formation of semantic clusters. In other words, low temperature = "tell cats apart from each other"; high temperature = "tell cats apart from parrots."

The catch is that real-world datasets are not uniform. Standard multi-modal datasets often follow imbalanced, long-tail distributions, where samples from dense clusters need a higher temperature to preserve their semantic structure, while rare samples need a lower temperature to enforce instance discrimination. A single fixed temperature can't serve both ends of that distribution well at the same time.
Two levers, one framework
MM-TS extends the concept of uni-modal temperature scheduling to multi-modal contrastive learning, dynamically adjusting the temperature in the contrastive loss during training. The method has two interlocking components:
- Cosine temperature schedule: The base temperature oscillates on a cosine curve across training iterations. This means the model alternates between phases of instance discrimination (low temperature) and semantic cluster formation (high temperature), continuously learning different levels of semantic structure rather than committing to one regime.
- Individual cluster shifts: Before training starts, all text annotations are embedded with SentenceBERT and clustered into K groups using K-Means (K=200 in experiments). Each sample is assigned a temperature shift proportional to the size of its cluster. Samples from large, common clusters get a higher temperature offset; samples from rare, small clusters get a lower one.
The final per-sample temperature is simply the sum of the base schedule value and the cluster-based shift. This introduces negligible overhead since clustering only happens once before training begins.

Concretely, the temperature for sample i at training step t is:
# base temperature follows a cosine schedule
tau_base(t) = (alpha * cos(2 * pi * t / T)) / 2
# cluster shift: larger cluster -> higher shift
sh(c) = ((K_c - min(K)) / (max(K) - min(K))) * (sh_plus - sh_minus) + sh_minus
# final per-sample temperature
tau_i = tau_base(t) + sh(cluster_of_sample_i)
Bridging two loss families
One of the more elegant contributions is extending this idea beyond InfoNCE to the max-margin loss -- a different contrastive objective popular in egocentric video research. The paper demonstrates that temperature scheduling can be effectively integrated within a max-margin framework, thereby unifying the two predominant approaches in multi-modal contrastive learning: InfoNCE loss and max-margin objective. The margin in the max-margin loss plays an analogous role to temperature: a small margin only pushes away the hardest negatives, while a large margin makes easier negatives irrelevant. MM-TS simply replaces the fixed margin with the same dynamic, per-sample schedule.
Benchmarks and results
The team evaluated MM-TS by plugging it into existing state-of-the-art models rather than training from scratch -- a practical design choice that shows how easily it integrates. They evaluated on four widely used image- and video-language datasets: Flickr30K, MSCOCO, EPIC-KITCHENS-100, and YouCook2.
| Dataset | Base Model | Metric | Baseline | MM-TS | Gain |
|---|---|---|---|---|---|
| Flickr30K | CLIP (RN50) | TR@1 | 50.9 | 54.3 | +3.4% |
| MSCOCO | CLIP (RN50) | TR@1 | 26.9 | 28.4 | +1.5% |
| EPIC-KITCHENS-100 | AVION (ViT-B) | mAP Avg. | 52.0 | 53.9 | +1.9% |
| YouCook2 | VAST | R@1 T2V | 50.4 | 53.0 | +2.6% |
On EPIC-KITCHENS-100, the video-to-text mAP alone improved by over 3 percentage points, setting a new state of the art. The ablations are equally telling: on the EK-100 MIR task, applying just the temperature schedule (TS) to a CLIP loss improved average mAP from 43.1 to 48.4 -- a jump of over 5 points -- before the individual cluster shifts added further gains on top.
What it's good at -- and where it's less clear
MM-TS is a strong fit for any multi-modal retrieval pipeline trained on naturally collected data, which almost always follows a long-tail distribution. The method is particularly impactful for:
- Egocentric and instructional video retrieval (EPIC-KITCHENS, YouCook2), where action and object distributions are heavily skewed
- Web-crawled image-text datasets like CC3M, where topic frequency varies by orders of magnitude
- Fine-tuning existing CLIP-style models without architectural changes -- MM-TS only touches the loss function
The method is less compelling when data is already well-balanced, or when you don't have text annotations to drive the clustering step. The authors do show that video embeddings can substitute for text embeddings with comparable results, but the gain is slightly smaller. There is also a small hyperparameter surface to tune: the cosine amplitude alpha, and the shift bounds sh_minus and sh_plus. The paper reports the method is robust to reasonable variations in these values, but they still need to be set per-dataset.
The real insight
The deeper contribution here is conceptual: the paper shows that the temperature in InfoNCE and the margin in max-margin loss are two faces of the same dial. Both control which negatives the model actually learns from. By treating that dial as a dynamic, per-sample schedule rather than a static hyperparameter, you get a training regime that naturally adapts to the uneven structure of real data -- without changing the model architecture, the data pipeline, or the optimizer. Code is publicly available on GitHub, and the method can be dropped into any existing CLIP or max-margin training loop with minimal changes.