Representation Alignment in Neural Networks

Ehsan Imani, Wei Hu, Martha White

Abstract

It is now a standard for neural network representations to be trained on large, publicly available datasets, and used for new problems. The reasons for why neural network representations have been so successful for transfer, however, are still not fully understood. In this paper we show that, after training, neural network representations align their top singular vectors to the targets. We investigate this representation alignment phenomenon in a variety of neural network architectures and find that (a) alignment emerges across a variety of different architectures and optimizers, with more alignment arising from depth (b) alignment increases for layers closer to the output and (c) existing high-performance deep CNNs exhibit high levels of alignment. We then highlight why alignment between the top singular vectors and the targets can speed up learning and show in a classic synthetic transfer problem that representation alignment correlates with positive and negative transfer to similar and dissimilar tasks.

Introduction

Transfer learning has become the cornerstone of modern deep learning, yet the underlying mechanisms that make certain representations more effective for downstream tasks remain poorly understood. While a representation's expressivity—its capacity to fit a dataset—is often cited, this does not account for optimization efficiency. Two representations might both be capable of achieving zero error, but one may converge orders of magnitude faster. This paper introduces Representation Alignment as a key metric to explain this discrepancy, showing that neural networks (NNs) naturally align their strongest internal feature directions with task labels during training.

The Alignment Metric

To quantify this phenomenon, the authors utilize Singular Value Decomposition (SVD) on the representation matrix $H$ (the activations of a hidden layer). SVD decomposes $H$ into singular vectors (directions) and singular values (strengths).

Alignment measures the extent to which the "energy" of the target labels $y$ is concentrated along the singular vectors associated with the largest singular values. Unlike traditional metrics that focus on linear separability, alignment specifically identifies which directions are utilized. High alignment implies that gradient descent can minimize loss rapidly with minimal weight updates, as the most prominent features in the representation are already relevant to the task.

Emergence of Alignment

A critical finding is that alignment is not present at initialization but emerges as a result of the training process. In deep layers, initial alignment is typically poor. As training progresses, the network reshapes its internal representation to better match the target labels.

Evolution of representation alignment across different conditions and training stages.

As shown in the figure above, alignment is significantly higher for true labels compared to shuffled labels, and it increases substantially from the pre-training state to the post-training state. This "Fast Phase" of learning occurs because high alignment generates massive gradients, allowing the model to reduce error early in the training cycle.

Comparative Performance and Optimization

The study demonstrates that neural networks exhibit superior alignment compared to other feature-learning paradigms, such as Radial Basis Function (RBF) networks or sparse dictionary learning.

Comparison of loss convergence between Neural Networks, RBF Networks, and Dictionary Learning.

This increased alignment directly correlates with faster convergence. In experiments across MNIST, CIFAR-10, and ImageNet, layers closer to the output consistently showed higher alignment, quantifying the "specialization" of deeper layers. Furthermore, high-performance architectures like Vision Transformers and deep CNNs naturally exhibit high levels of alignment, especially when pre-trained on large-scale datasets like ImageNet.

Implications for Transfer Learning

Representation alignment provides a predictive framework for transfer learning. "Positive transfer" occurs when a source task aligns the representation in a way that benefits the target task. Conversely, "negative transfer" happens when the source task forces the representation into directions that are irrelevant or detrimental to the target task. In experiments using the Office-31 dataset, the authors found that learning on a dissimilar source task can actually decrease alignment for the target task compared to a randomly initialized model, providing a mathematical explanation for why poor pre-training can hinder performance.

Conclusion

Representation alignment offers a new lens through which to view neural network optimization and transferability. By showing that NNs actively align their top singular vectors with targets, this work bridges the gap between representation learning and optimization speed. While the current analysis focuses primarily on linear probes, future work is needed to explore the complex backbone dynamics during full fine-tuning and to develop more computationally efficient ways to monitor alignment in large-scale models.

Summary updated

BibTeX
@article{imani2022representation,
  author = {Ehsan Imani and Wei Hu and Martha White},
  title = {{Representation Alignment in Neural Networks}},
  journal = {Accepted by TMLR},
  year = {2022},
  url = {https://openreview.net/forum?id=fLIWMnZ9ij},
}
Figure