Implicit variance regularization in non-contrastive SSL

Manu Srinath Halvagal, Axel Laborieux, Friedemann Zenke

Non-contrastive self-supervised learning (SSL) methods, such as BYOL and SimSiam, rely on asymmetric network architectures to avoid "representational collapse"—a trivial state where the network outputs a constant vector for all inputs. While empirical results show this asymmetry works, the theoretical mechanics have remained somewhat murky, especially concerning the widely used cosine similarity loss.

This paper mathematically demonstrates that both Euclidean and cosine losses prevent collapse through implicit variance regularization. However, they suffer from uneven learning rates across different data dimensions. To address this, the authors introduce IsoLoss (Isotropic Loss), a modified loss function that equalizes learning speeds, accelerates early training, and removes the need for complex target networks.

The Mechanics of Non-Contrastive SSL

In SSL, a model learns by pulling together representations of differently augmented views of the same image. Contrastive methods avoid collapse by explicitly pushing different images apart. Non-contrastive methods avoid it using an asymmetric architecture: one branch features an extra "predictor" network, while the other branch uses a "stop-gradient" operation to prevent weights from updating based on that branch.

Non-contrastive architecture and distance dynamics

Previous theoretical work explained this phenomenon assuming a Euclidean distance loss. However, practical implementations almost universally use cosine similarity, which normalizes vectors and couples all dimensions together. The authors analyze whether the learning dynamics of cosine similarity actually match the Euclidean theory and how these insights can be used to design better loss functions.

Theoretical Insights: Variance Regularization

By analyzing the learning dynamics in the "eigenspace" of closed-form linear predictor networks using Neural Tangent Kernel (NTK) theory, the authors derived exact continuous-time differential equations for both Euclidean and Cosine losses.

They found that both losses naturally prevent collapse by implicitly regularizing the variance of the representations, albeit through different mechanisms:

  • Euclidean loss makes each dimension independently converge to a variance of 1.
  • Cosine loss forces the dimensions to cooperate, converging to an arbitrary but equal value.
Eigenvalue convergence over iterations

However, the math reveals a critical flaw in standard BYOL/SimSiam setups: the variance (eigenvalue) of a specific dimension acts as a multiplier for its own learning rate. If a feature has low variance, it learns slowly. This creates an "anisotropic" (highly uneven) learning process. Furthermore, the equations explicitly prove why removing architectural tricks causes failure: removing the stop-gradient causes Euclidean models to collapse to zero, and Cosine models to diverge.

The Solution: IsoLoss

To fix the mathematical bottleneck of standard losses, the authors engineered a new family of loss functions called IsoLoss (Isotropic Loss). By cleverly repositioning the stop-gradient operator and the predictor output, IsoLoss alters the gradient flow to remove the eigenvalue multiplier. This forces all dimensions to converge at homogeneous rates, solving the anisotropic learning problem.

Empirical Results

The authors validated their theoretical findings using standard computer vision benchmarks, including CIFAR-10, CIFAR-100, STL-10, and TinyImageNet.

  • Faster Initial Learning: In ResNet-18 experiments, IsoLoss visibly accelerates the early stages of training compared to standard DirectPred and BYOL baselines, aligning perfectly with the mathematical predictions.
  • Competitive Accuracy: IsoLoss achieves strong linear readout accuracies, matching or slightly beating the DirectPred baseline (e.g., 91.5% on CIFAR-10, 89.0% on STL-10).
  • Robustness to EMA Removal: Standard closed-form predictor models crash completely if the Exponential Moving Average (EMA) target network is removed (accuracy drops to ~12% on CIFAR-10). IsoLoss survives this ablation, maintaining a 91.5% accuracy on CIFAR-10 even without an EMA.

Limitations and Future Work

The rigorous mathematical proofs rely on simplifying assumptions, specifically linear networks and Gaussian i.i.d. inputs. While the empirical results show the theory holds up remarkably well in non-linear ResNets with real images, the math remains an approximation. Additionally, while IsoLoss can run stably without an EMA target network, removing it still causes a slight drop in performance on harder datasets (like CIFAR-100) and reduces the network's ability to recruit smaller eigenvalues. Future work could explore how to fully close this gap.

Summary updated

BibTeX
@inproceedings{halvagal2023implicit,
  author = {Manu Srinath Halvagal and Axel Laborieux and Friedemann Zenke},
  title = {{Implicit variance regularization in non-contrastive SSL}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=zMNUNd9zs1},
}
Figure