NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

On the Similarities of Embeddings in Contrastive Learning

Chungpa Lee, Sehee Lim, Kibok Lee, Jy-yong Sohn

Abstract

Contrastive learning (CL) relies on the dual objectives of pulling positive pairs together and pushing negative pairs apart. However, achieving an optimal embedding space remains challenging due to the sensitivity of CL to batch sizes and temperature hyperparameters. This paper identifies a fundamental mathematical trade-off: excessive separation of negative pairs prevents the perfect alignment of positive pairs. We introduce a Variance Reduction of Negative-pair Similarities ($L_{VRNS}$) loss that stabilizes the embedding structure by penalizing extreme deviations in negative-pair similarities. Our method significantly improves performance and robustness, particularly in resource-constrained settings with small mini-batches.

Introduction

Contrastive Learning (CL) has become the cornerstone of modern self-supervised representation learning. By training models to recognize different views of the same image as "positives" and distinct images as "negatives," CL produces robust feature representations without human labeling. Despite its success, CL is notoriously difficult to optimize. It typically requires massive batch sizes and meticulous tuning of the temperature hyperparameter to prevent representation collapse or suboptimal convergence.

Recent theoretical work suggests that the ideal state for these embeddings is a Simplex Equiangular Tight Frame (ETF). In this state, all positive pairs are perfectly aligned (similarity of 1), and all negative pairs are perfectly spread out with a uniform similarity. This paper investigates why standard mini-batch training fails to reach this geometric ideal and proposes a solution to bridge the gap.

The Geometry of Contrastive Learning

The Alignment-Separation Trade-off

A central contribution of this research is the mathematical proof of a fundamental constraint in embedding spaces. The authors demonstrate that if the average similarity of negative pairs drops below a specific threshold—defined as $-1/(n-1)$, where $n$ is the dataset size—it becomes geometrically impossible for positive pairs to achieve perfect alignment.

This reveals a "sweet spot" for separation. While pushing negatives apart is necessary for learning features, being too aggressive (a common side effect of certain loss functions or small batch training) actually harms the model's ability to recognize that two views of the same object are identical.

The Problem with Mini-batches

The paper identifies that mini-batch training inherently introduces high variance into the similarity distribution. In small batches, certain negative pairs are pushed much further apart than they would be in a full-batch setting. This high variance destabilizes the learning process, as the model over-optimizes for specific negative samples at the expense of the global embedding structure. This explains why CL performance often degrades sharply as batch sizes decrease.

Proposed Method: Variance Reduction (VRNS)

To address the instability caused by mini-batch variance, the authors introduce the Variance Reduction of Negative-pair Similarities (VRNS) loss. This auxiliary term acts as a regularizer, explicitly penalizing negative pairs that stray too far from the ideal similarity threshold.

The loss is formulated as: $$L_{VRNS} \approx \text{mean}((u_i^\top v_j + \frac{1}{n-1})^2)$$

By adding this term to standard contrastive objectives like SimCLR or InfoNCE, the model is encouraged to maintain a more uniform distribution of negative similarities. This reduces the variance and brings the embedding distribution closer to the theoretical Simplex ETF.

Experimental Results

The effectiveness of $L_{VRNS}$ was validated across several standard benchmarks, including CIFAR-10/100 and ImageNet.

Performance Gains

  • ImageNet-100: Adding the VRNS loss to SimCLR improved Top-1 accuracy from 72.30% to 74.04% (at a temperature of 0.3).
  • Full ImageNet: The method provided a consistent boost, raising Top-1 accuracy from 51.79% to 52.48%.
  • Variance Reduction: In CIFAR-100 experiments with a batch size of 32, the proposed loss successfully reduced the variance of negative-pair similarities from 0.1649 to 0.1008.

Robustness and Efficiency

One of the most significant practical benefits of VRNS is its impact on hyperparameter sensitivity. Standard CL models are highly sensitive to the "temperature" setting; the wrong choice often leads to total training failure. VRNS makes the model significantly more robust, maintaining high performance across a wider range of temperatures. Furthermore, the performance gains were most pronounced at smaller batch sizes (e.g., 32 and 64), making high-quality contrastive learning more accessible to researchers with limited GPU resources.

Discussion and Limitations

While VRNS provides a clear path to more stable contrastive learning, it introduces a new hyperparameter ($\lambda$) to scale the auxiliary loss. Additionally, the authors note a potential theoretical limitation: the suppression of "good" variance. In a natural dataset, some images are semantically more similar than others (e.g., two different breeds of dogs). Forcing all negative pairs toward a uniform similarity threshold might inadvertently suppress these meaningful semantic relationships.

Future work should focus on disentangling harmful variance caused by mini-batch sampling from the useful variance that reflects the underlying semantic structure of the data. By refining how we penalize similarity deviations, we can move closer to an optimal, self-supervised representation of the visual world.

Summary updated

BibTeX
@inproceedings{lee2025similarities,
  author = {Chungpa Lee and Sehee Lim and Kibok Lee and Jy-yong Sohn},
  title = {{On the Similarities of Embeddings in Contrastive Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=ChmJZ9V2o1},
}
Figure