Abstract
A lot of recent advances in unsupervised feature learning are based on designing features which are invariant under semantic data augmentations. A common way to do this is contrastive learning, which uses positive and negative samples. Some recent works however have shown promising results for non-contrastive learning, which does not require negative samples. However, the non-contrastive losses have obvious “collapsed” minima, in which the encoders output a constant feature embedding, independent of the input. A folk conjecture is that so long as these collapsed solutions are avoided, the produced feature representations should be good. In our paper, we cast doubt on this story: we show through theoretical results and controlled experiments that even on simple data models, non-contrastive losses have a preponderance of non-collapsed bad minima. Moreover, we show that the training process does not avoid these minima. Code for this work can be found at https://github.com/ashwinipokle/contrastive_landscape.
Introduction
Self-supervised learning aims to extract useful features from unlabeled data by enforcing invariance across different views of the same input. Contrastive Learning (CL) achieves this by pulling "positive" pairs together and pushing "negative" pairs apart. While effective, CL is computationally demanding due to the need for large batches or memory banks to store negative samples.
Non-Contrastive Learning (non-CL) methods, such as BYOL and SimSiam, have emerged as a more efficient alternative by utilizing only positive pairs. The primary challenge in non-CL is "collapse," where the model outputs a constant value to minimize loss. A common "folk conjecture" suggests that preventing collapse—through architectural choices like stop-gradients or predictor heads—is sufficient for learning high-quality representations. This work investigates whether avoiding collapse is indeed enough, revealing that non-CL landscapes are inherently more fragile than previously thought.
Theoretical Framework and Data Model
To analyze the loss landscapes rigorously, we employ a sparse-coding data model where data $x$ is generated from a ground-truth dictionary $M$ via $x = Mz + \epsilon$. This setup allows for a precise success metric: the Minimum Max-Cosine, which measures how well the learned weights align with the original dictionary.
Our analysis focuses on:
- Landscape Analysis: Identifying the set of global optima for both CL and non-CL objectives.
- Training Dynamics: Evaluating whether gradient descent from random initialization can reach these optima.
- Architectural Impact: Comparing linear vs. non-linear (ReLU) encoders and the necessity of the linear predictor head.
The Landscape of Non-Contrastive Learning
We prove that non-CL losses possess infinitely many "bad" global optima that are not collapsed. In these states, the model achieves zero loss but fails to recover the underlying data structure. Conversely, the CL loss is minimized only at the ground-truth solution (up to permutation).
As shown in the results for one-hot encoded data, even when the loss is minimized, the non-contrastive model (NCL) may fail to align with the true features, whereas the contrastive model (CL) consistently achieves near-perfect recovery.
Empirical Results
Experiments on synthetic datasets confirm our theoretical findings. We observe that non-CL is highly sensitive to initialization and often requires a "warm start" or specific normalization to succeed without a predictor head.
Key empirical insights include:
- Predictor Head Necessity: Without a predictor head, gradient descent in non-CL often traps the model in bad minima. The predictor head alters the training dynamics, guiding the model toward the ground truth.
- Non-linearity: Linear dual networks in non-CL are fundamentally limited; they cannot improve representation quality beyond their initial state. Non-linearities like ReLU are essential for learning the dictionary.
- Robustness of CL: Contrastive learning consistently reaches the ground-truth solution across various sparsity levels and initializations, demonstrating a much more favorable optimization landscape.
Conclusion and Future Work
Our results demonstrate that non-CL methods are theoretically more fragile than CL. The success of non-CL in practice relies heavily on specific architectural components like the predictor head, which are mathematical necessities for navigating away from non-collapsed bad minima.
Future research should extend this landscape analysis to deeper architectures like ResNets and Transformers. Additionally, a theoretical characterization of how normalization schemes like Batch Norm interact with the loss landscape to avoid these bad minima remains an important open question.
Summary updated