The Mechanism of Prediction Head in Non-contrastive Self-supervised Learning

Zixin Wen, Yuanzhi Li

TL;DR

This paper explains why non-contrastive self-supervised learning (like BYOL and SimSiam) avoids "dimensional collapse" where all neurons learn the same feature. The authors show that a trainable prediction head creates "substitution" and "acceleration" effects, allowing slower neurons to ignore dominant features and focus on learning diverse, weaker ones.

What Problem Does This Paper Address?

In self-supervised learning (SSL), we want a neural network to learn useful representations of data without human labels. Contrastive learning does this by pushing representations of "positive pairs" (two views of the same image) together and pulling "negative pairs" (different images) apart.

However, newer "non-contrastive" methods like BYOL and SimSiam dropped the negative pairs entirely. Mathematically, this should be a disaster: the easiest way for a network to minimize the loss is to output the same constant vector for everything—a phenomenon called complete collapse. Even with Batch Normalization (BN) to prevent a constant output, networks often suffer from dimensional collapse, where every neuron in the network ends up tracking the exact same feature (see Figure 1).

Dimensional Collapse: Without a prediction head, neurons become extremely correlated.

The "magic" ingredient that prevents this is a small sub-network called a prediction head. But why does adding a layer—which could theoretically just learn to be an identity mapping and change nothing—magically force the network to learn diverse features?

Methods

The authors investigate this using both empirical experiments and a rigorous theoretical framework.

Empirical Approach: They simplified the prediction head to its bare essentials. Instead of a complex multi-layer perceptron (MLP), they used a linear matrix initialized as an identity matrix, where only the off-diagonal entries were trainable. This allowed them to isolate exactly how the "cross-talk" between neurons evolves during training.

Theoretical Approach: They analyzed a non-linear two-layer network with Batch Normalization. They modeled the data as containing two types of features: "strong" features (frequent/large magnitude) and "weak" features (rare/small magnitude). They then tracked the training dynamics through four distinct phases to see how the weights and the prediction head interact.

Datasets

The authors validated their findings on standard computer vision benchmarks:

  • CIFAR-10 and CIFAR-100
  • STL-10
  • Synthetic Data: Specifically designed to contain imbalanced "strong" and "weak" features to test their theoretical predictions.

Key Insights and Ideas

The "aha!" moment of the paper lies in the discovery of two synergistic effects created by the prediction head:

  • The Substitution Effect: Early in training, "fast" neurons quickly learn the strong features. The prediction head then learns to "borrow" these strong features from the fast neurons and provide them to the "slow" neurons. This "substitutes" for the slow neurons needing to learn the strong features themselves.
  • The Acceleration Effect: Because the loss for the strong features is now satisfied via the prediction head, the slow neurons are free to ignore the dominant signals. Combined with Batch Normalization and the stop-gradient operation, this actually accelerates the learning of weaker, more diverse features in those slow neurons.

Another fascinating insight is the "Rise and Fall" trajectory of the prediction head. The off-diagonal entries of the prediction head matrix grow during the middle of training (when substitution is happening) and then often shrink back toward zero once the network has successfully learned all features (see Figure 3).

The Rise and Fall: Off-diagonal entries of the prediction head increase during feature learning and then decrease.

Key Results

  • Simplicity Wins: The identity-initialized linear prediction head performs comparably to standard, more complex MLPs (see Figure 2). This disproves the common belief that non-symmetric initialization is required for these methods to work.
  • Collapse Avoided: Theoretically and empirically, the authors show that while a network without a prediction head collapses to a single feature (correlation $\approx 1$), the network with the head maintains diverse features (correlation $\approx 0$).
  • End-to-End Guarantee: This work provides the first end-to-end optimization guarantee for non-contrastive SSL using non-linear networks, showing that the network will converge to a solution that captures both strong and weak features.
Accuracy Comparison: The simplified identity-init head matches the performance of standard 2-layer MLP heads.

Limitations and Future Work

While the paper provides a breakthrough in understanding, the authors note several areas for future exploration:

  • Normalization Types: The theory focuses on Batch Normalization. Experiments suggest a performance gap remains when using $L_2$ normalization, which isn't fully explained by the current theory.
  • Linear vs. Non-linear Features: The theoretical model assumes features are linear. Real-world data features are often hierarchical and non-linear.
  • Deep Architectures: The proof is based on a two-layer network; extending this to the deep ResNets used in practice is a significant mathematical challenge.

By showing that the prediction head acts as a temporary "scaffold" that helps neurons specialize before disappearing, this paper turns a deep learning mystery into a clear mechanical process.

Summary updated

BibTeX
@inproceedings{wen2022mechanism,
  author = {Zixin Wen and Yuanzhi Li},
  title = {{The Mechanism of Prediction Head in Non-contrastive Self-supervised Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=d-kvI4YdNu},
}

Loading related content...

Figure