Investigating the Benefits of Projection Head for Representation Learning

Yihao Xue, Eric Gan, Jiayi Ni, Siddharth Joshi, Baharan Mirzasoleiman

In the world of modern representation learning—especially in self-supervised methods like SimCLR—there is a peculiar "best practice" that sounds almost counterintuitive: you add a shallow neural network (a "projection head") on top of your encoder during training, but when it is time to actually use the model for a downstream task, you chop that head off and throw it away.

Surprisingly, the representations before that final layer are almost always better than the ones after it. But why? If the model is optimized to minimize a loss at the very end, shouldn't the final output be the most refined? A new paper from researchers at UCLA provides a rigorous theoretical answer to this mystery.

The Core Problem

In representation learning, the goal is for a model to learn features (like shapes, textures, or object parts) that are broadly useful across many different downstream tasks. Contrastive learning achieves this by making different "views" of the same image look similar in vector space.

The "projection head"—usually a simple Multi-Layer Perceptron (MLP)—has become a standard component of this pipeline. While we know empirically that discarding it helps, the underlying mechanism has remained poorly understood. This gap in knowledge makes it difficult to design better architectures or to know exactly when a projection head will be most beneficial. The authors tackle a fundamental question: What exactly happens to features as they pass through these final layers?

Methodology and Experimental Setup

The authors use a combination of theoretical proofs and controlled experiments to dissect the network's behavior:

  1. Linear Analysis: They prove that in linear models, gradient-based training leads to layer-wise progressive feature weighting. Essentially, if a feature is slightly more "important" for the training loss, its weight grows exponentially faster as you move to deeper layers.
  2. Non-Linear Analysis: They show that non-linearities (like ReLU) allow lower layers to preserve features that the final layer might completely "kill off" (assign zero weight) because they aren't strictly necessary for the specific pre-training objective.
  3. The "Fixed Reweighting Head": To prove their theory, they introduce a novel alternative: a head with fixed, non-trainable weights that simply scales different dimensions unequally. If their theory holds, this fixed head should provide similar benefits to a trainable one.

To validate these findings, the study utilizes a diverse range of benchmarks, including standard datasets (CIFAR-10/100), distribution shift tests (UrbanCars, ImageNet-A/R), and a highly controlled synthetic dataset called "MNIST-on-CIFAR-10."

Illustration of the MNIST-on-CIFAR-10 synthetic dataset and the performance differences between pre- and post-projection representations under various conditions.

Key Insights: The Specialization Trap and Neural Collapse

The primary takeaway is that the projection head acts as a "specialization buffer." Deeper layers are inherently "greedy." They focus intensely on the features that most easily satisfy the training loss (e.g., the most prominent textures or colors). Lower layers, however, are more "democratic," maintaining a more even weighting across a diverse set of features.

  • Augmentation as a Double-Edged Sword: Data augmentation is meant to teach invariance, but it can "destroy" useful features. The projection head prevents the model from completely discarding these damaged but still useful features in the earlier layers.
  • Alleviating "Neural Collapse": In supervised learning, models often suffer from neural collapse, where all images of a broad class map to the exact same point, losing the ability to distinguish fine-grained sub-classes. The authors demonstrate that pre-projection representations retain these fine-grained details that the final layer discards.
t-SNE visualization showing how pre-projection representations maintain distinct clusters, whereas post-projection features suffer from collapse.

Furthermore, the fact that a fixed reweighting head (which just scales dimensions by a constant factor) performs as well as a complex trainable MLP suggests that the primary benefit of the projection head is simply its architectural position and its ability to absorb unequal weightings, not necessarily its learned parameters.

Key Results and Future Directions

The empirical results strongly support the theoretical claims:

  • Fine-Grained Transfer: On CIFAR-100, using pre-projection representations improved "fine-grained" classification accuracy by over 10% compared to post-projection features in some settings (e.g., 36.0% vs 25.7% for Supervised Contrastive Learning).
  • Robustness: In the UrbanCars dataset, which features heavy distribution shifts, the projection head technique improved few-shot adaptation accuracy from 82.2% (vanilla) to 86.1%.
  • Validation of Theory: The "fixed reweighting head" achieved nearly identical performance to the standard trainable projection head across multiple scenarios, confirming that "unequal weighting" is the core mechanism at play.

While the paper provides a strong theoretical foundation for spectral contrastive loss, the dynamics might be more complex for other loss functions like InfoNCE. Additionally, while the optimal layer for a task shifts depending on the "mismatch" between pre-training and downstream goals, finding that perfect layer in a deep ResNet or Transformer currently requires manual validation. Future work could involve making the reweighting factor a learnable parameter, potentially leading to more interpretable and efficient "head-less" architectures.

Summary updated

BibTeX
@inproceedings{xue2024investigating,
  author = {Yihao Xue and Eric Gan and Jiayi Ni and Siddharth Joshi and Baharan Mirzasoleiman},
  title = {{Investigating the Benefits of Projection Head for Representation Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=GgEAdqYPNA},
}
Figure