On neural and dimensional collapse in supervised and unsupervised contrastive learning with hard negative sampling

Ruijie Jiang, Thuan Nguyen, Shuchin Aeron, Prakash Ishwar · OpenReview

Abstract

For a widely-studied data model and general loss and sample-hardening functions we prove that the losses of Supervised Contrastive Learning (SCL), Hard-SCL (HSCL), and Unsupervised Contrastive Learning (UCL) are minimized by representations that exhibit Neural-Collapse (NC), i.e., the class means form an Equiangular Tight Frame (ETF) and data from the same class are mapped to the same representation. We also prove that for any representation mapping, the HSCL and Hard-UCL (HUCL) losses are lower bounded by the corresponding SCL and UCL losses. In contrast to existing literature, our theoretical results for SCL do not require class-conditional independence of augmented views and work for a general loss function class that includes the widely used InfoNCE loss function. Moreover, our proofs are simpler, compact, and transparent. Similar to existing literature, our theoretical claims also hold for the practical scenario where batching is used for optimization. We empirically demonstrate, for the first time, that Adam optimization (with batching) of HSCL and HUCL losses with random initialization and suitable hardness levels can indeed converge to the NC-geometry if we incorporate unit-ball or unit-sphere feature normalization. Without incorporating hard-negatives or feature normalization, however, the representations learned via Adam suffer from Dimensional-Collapse (DC) and fail to attain the NC-geometry. These results exemplify the role of hard-negative sampling in contrastive representation learning and we conclude with several open theoretical problems for future work.

Introduction

Contrastive Learning (CL) has emerged as a powerful paradigm for representation learning, aiming to map semantically similar data points close together and dissimilar ones far apart in an embedding space. Despite its success, practitioners often encounter two distinct types of "collapse" that hinder performance:

  1. Dimensional Collapse (DC): The learned representations occupy a very low-dimensional subspace, failing to utilize the model's full capacity.
  2. Neural Collapse (NC): A state of perfect geometric symmetry where all samples from a class map to a single point, and these points form an Equiangular Tight Frame (ETF)—the most symmetrical arrangement of points on a hypersphere.

While "hard-negative sampling"—the practice of selecting negative examples that are highly similar to the anchor—is empirically known to improve performance, the theoretical justification has remained incomplete. This paper bridges this gap by characterizing the global minima of contrastive losses and demonstrating how hard-negatives facilitate the optimization process, preventing the model from becoming trapped in collapsed states.

Theoretical Framework

The authors establish a rigorous foundation by defining a Generalized Contrastive Loss that encompasses popular functions such as InfoNCE and triplet loss. A key contribution is the use of the Harris comparison inequality to prove that "hardened" losses consistently dominate standard losses, effectively "stretching" the optimization landscape to favor more discriminative features.

The hierarchical data model used to prove the convergence to Neural Collapse.

The theoretical analysis utilizes a hierarchical data model (shown above) to prove that the global minimum for these losses is the NC-geometry. Notably, this result holds even without the common assumption of "class-conditional independence" of data augmentations. The paper further demonstrates that feature normalization (mapping vectors to a unit ball or sphere) is mathematically critical; without it, representations fail to reach the NC-geometry and instead suffer from severe Dimensional Collapse.

Empirical Validation

To validate the theoretical claims, the authors conducted experiments using ResNet-50 models optimized with Adam on both synthetic and real-world datasets, including CIFAR10, CIFAR100, and TinyImageNet. The "health" of the learned representations was tracked using three geometric metrics: the zero-sum metric (centering at the origin), the unit-norm metric (placement on the sphere), and the equal inner-product metric (perfectly spread out ETF configuration).

Key Results

  • Accuracy Improvements: On CIFAR100, moderate hardness levels ($\beta = 5, 10$) led to classification accuracies over 40 percentage points higher than standard contrastive learning.
  • Geometric Convergence: While standard SCL/UCL often resulted in low-rank covariance matrices (DC), the inclusion of hard-negatives allowed the model to reach full-rank, symmetric ETF configurations (NC) from random initialization.
  • Batch Size Robustness: NC was found to be consistently achievable across practical batch sizes (64 to 512), though very small batches (e.g., 32) can hinder convergence due to insufficient negative diversity.
  • Latent Class Collision: In unsupervised settings (UCL), the authors identified the "latent class collision" problem, where a "hard" negative might actually belong to the same latent class as the anchor, making unsupervised hard-negative sampling more sensitive to the chosen hardness level.

Conclusion and Future Work

This work provides a unified perspective on the role of hard-negative sampling in achieving Neural Collapse and avoiding Dimensional Collapse. However, several open problems remain. Deriving a perfectly tight lower bound for Unsupervised Hard-Negative sampling remains challenging due to latent class collisions. Additionally, while the global minima are identified, the specific trajectory by which Adam avoids local minima in the presence of hard-negatives requires further study. Finally, future research should explore convex optimization approaches for "overcrowded" latent spaces where the number of classes exceeds the embedding dimension.

Summary updated

BibTeX
@article{jiang2025neural,
  author = {Ruijie Jiang and Thuan Nguyen and Shuchin Aeron and Prakash Ishwar},
  title = {{On neural and dimensional collapse in supervised and unsupervised contrastive learning with hard negative sampling}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
  url = {https://openreview.net/forum?id=lgcnAKjpjX},
}
Figure