Analytic Insights into Structure and Rank of Neural Network Hessian Maps

Sidak Pal Singh, Gregor Bachmann, Thomas Hofmann

In the world of deep learning, the Hessian matrix—the square matrix of second-order partial derivatives of the loss function—is a bit like a legendary beast: we know it’s incredibly powerful, but it’s so massive that few have seen it in its entirety. For a model with millions of parameters, the Hessian has trillions of entries, making it computationally prohibitive to analyze directly.

While empirical studies have long suggested that the Hessian is "degenerate" (mostly full of zeros or tiny values), we’ve lacked a rigorous theoretical map of its structure. A new paper from researchers at ETH Zürich and the Max Planck Institute, titled "Analytic Insights into Structure and Rank of Neural Network Hessian Maps," finally provides that map, offering exact formulas for the Hessian's rank and revealing just how much redundancy is baked into our models.

TL;DR

This paper provides the first exact formulas and tight upper bounds for the rank of the Hessian matrix in deep neural networks. It proves that the "effective" number of parameters is significantly smaller than the total parameter count, scaling with the sum of layer widths rather than their product. This fundamental mathematical insight explains the massive structural redundancy observed in overparameterized models.

The Challenge: Mapping the Hessian

The Hessian captures how parameters interact and how gradients change during optimization. It is central to understanding why models generalize, how to prune them effectively, and how to design better second-order optimizers.

However, because the Hessian is $O(p^2)$ in size (where $p$ is the number of parameters), researchers usually rely on "blind" heuristics or low-rank approximations. We knew the Hessian was low-rank from experiments, but we didn't know why or how low. This paper fills that gap by moving beyond empirical observations to provide a structural theory of the Hessian's range.

Analytical Approach

The authors decompose the Hessian into two parts:

  1. The Outer-Product Hessian ($H_o$): Related to the Gauss-Newton matrix, capturing the first-order geometry.
  2. The Functional Hessian ($H_f$): Capturing the curvature of the model's output itself.

To analyze these, they develop a novel analytical tool based on "Z-like matrices"—special row-partitioned matrices involving Kronecker products. By studying the range of the Hessian map through matrix derivatives, they derive exact rank formulas for Deep Linear Networks (DLNs).

Crucially, they then extend these insights to non-linear networks (using ReLU and Tanh activations) by showing that while non-linearities introduce many tiny eigenvalues, the "bulk" of the significant spectrum—the numerical rank—is still accurately predicted by their linear formulas.

Key Insights and Ideas

  • Sum vs. Product: In a standard MLP, the number of parameters is roughly the product of adjacent layer widths ($\sum M_l M_{l-1}$). The paper shows the Hessian rank is proportional to the sum of layer widths ($\sum M_l$). In overparameterized regimes, the difference between these two is astronomical.
Rank and Rank-to-Parameter ratio versus minimal width, illustrating massive structural redundancy as networks widen.
  • Structural Redundancy: The authors provide an elegant interpretation: the rank deficiency is equal to the number of parameters in a "hypothetical network" where the minimum layer width has been subtracted from every layer.
  • Layer Independence: A surprising finding is that the column blocks of the functional Hessian corresponding to different layers are nearly independent. This means the total rank is essentially the sum of individual layer-wise ranks, implying that the layers don't "overlap" much in the space of second-order interactions.
  • Stability During Training: Using gradient flow dynamics, they prove that for linear networks, this rank deficiency isn't just an initialization fluke—it persists throughout the training process.

Empirical Results and Validation

The researchers validated their theoretical formulas against exact SVD (Singular Value Decomposition) calculations on several standard benchmarks, including MNIST, FashionMNIST, and CIFAR-10, using various loss functions and initialization schemes. To make the exact Hessian computation feasible for verification, they downsampled images to test on "realistic" but manageable network sizes.

  • The Formula: For a deep linear network, the empirical rank of the Hessian ($H_L$) is given by: $$rk(H_L) = 2qM - Lq^2 + q(r + K)$$ (Where $q$ is the bottleneck width, $M$ is the sum of hidden widths, $r$ is input rank, and $K$ is output dimension).

  • Predictive Power: The formulas derived for linear networks act as a "tight upper bound" for non-linear ones. In experiments with Tanh and ReLU, the predicted rank perfectly matched the number of significant eigenvalues in the Hessian spectrum.

Eigenvalue spectrum comparing ReLU and linear networks, with dashed lines indicating the predicted rank.
  • Effective Parameters: The results suggest that the "effective dimensionality" of the loss landscape is much lower than previously thought, providing a theoretical basis for why techniques like pruning and low-rank adaptation (LoRA) work so well.

Future Directions

  • Non-linear Rigor: While the linear formulas work remarkably well for non-linear networks in practice, a fully rigorous theoretical characterization of the non-linear Hessian (beyond "numerical rank") remains an open challenge.
  • Architectural Scope: The current work focuses on fully-connected architectures. Extending this analysis to Convolutional Neural Networks (CNNs) or Transformers is the next logical step, as their weight-sharing and attention mechanisms will likely induce even more complex structural constraints.
  • Optimization: The authors suggest that knowing the exact rank could help design more efficient second-order optimizers that only operate within the identified non-degenerate subspace.

Summary updated

BibTeX
@inproceedings{singh2021analytic,
  author = {Sidak Pal Singh and Gregor Bachmann and Thomas Hofmann},
  title = {{Analytic Insights into Structure and Rank of Neural Network Hessian Maps}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=0Py9aQz1lS},
}
Figure