Second-order optimization methods—those that use the "curvature" of the loss landscape—have long been the holy grail of neural network training. In theory, they offer faster convergence and better stability than standard first-order methods like SGD or Adam. In practice, however, they are often computationally ruinous, requiring the calculation of the Hessian matrix, which scales quadratically with the number of parameters.
In their paper "HesScale: Scalable Computation of Hessian Diagonals," Mohamed Elsayed and A. Rupam Mahmood introduce a deterministic, linear-time approach to approximating the Hessian's diagonal. By making a clever adjustment to classic backpropagation rules, they’ve developed a method that provides high-quality curvature information at a fraction of the usual cost.
TL;DR
HesScale is a new method for approximating the diagonal of the Hessian matrix with the same $O(n)$ computational complexity as standard backpropagation. By using exact Hessian diagonals for the final layer and propagating them backward, it achieves significantly higher approximation accuracy than existing methods, enabling efficient second-order optimization for large-scale models.
What Problem Does This Paper Address?
Most deep learning optimizers are "first-order": they look at the gradient (the slope) to decide which way to move. But the slope doesn't tell you how the landscape is changing. If the landscape is "ill-conditioned"—meaning it's very steep in one direction and very flat in another—first-order methods can oscillate wildly or crawl at a snail's pace.
Second-order methods solve this by using the Hessian matrix (second derivatives). However, for a model with a million parameters, the Hessian has a trillion entries. Storing and inverting this matrix is impossible for modern deep learning. Researchers have tried to use just the diagonal of the Hessian as a compromise, but existing methods are either:
- Inaccurate: Like the "empirical Fisher" heuristic used in Adam, which often fails to capture true curvature.
- Expensive/Stochastic: Like AdaHessian, which uses random sampling (Hutchinson’s estimator) and requires multiple passes to become accurate.
Methods
HesScale builds on a deterministic diagonal approximation originally proposed by Becker and Lecun in 1989 (BL89). The core idea is to "backpropagate" the second derivatives through the network layers.
The authors identify a critical weakness in the original BL89 method: it uses an approximation even for the very last layer of the network. HesScale’s "aha moment" is realizing that for common loss functions like cross-entropy with softmax, the exact Hessian diagonal of the last layer is incredibly simple to compute ($q - q \circ q$, where $q$ is the predicted probability).
By starting with this exact value at the output and using a refined backpropagation rule for the hidden layers, HesScale maintains much higher fidelity to the true Hessian as it moves toward the input. The authors also introduce AdaHesScale, an optimizer that replaces the squared-gradient term in Adam with the HesScale diagonal estimate.
Datasets
The authors evaluated HesScale and its corresponding optimizers using the DeepOBS benchmarking suite, which ensures fair comparisons across different methods. The datasets included:
- MNIST: Using a Multi-Layer Perceptron (MLP).
- CIFAR-10: Using a 3-convolutional, 3-dense layer architecture (3C3D).
- CIFAR-100: Using both the 3C3D architecture and the ALL-CNN-C (a 9-layer all-convolutional network).
Key Insights and Ideas
- The Last Layer is Key: A small change—using the exact Hessian for the final layer instead of an approximation—leads to a massive jump in overall approximation quality. As shown in Figure 1, HesScale is orders of magnitude more accurate than the original BL89 or stochastic methods like AdaHessian.
- Deterministic > Stochastic: You don't need random noise to estimate curvature. HesScale proves that a deterministic pass can outperform Monte Carlo-based methods (like GGN-MC or AdaHessian) while being more stable.
- True $O(n)$ Scaling: HesScale doesn't just claim to be fast; it actually matches the scaling behavior of standard backprop.
Key Results
- Approximation Accuracy: In tests measuring the $L^1$ distance to the true Hessian diagonal, HesScale consistently outperformed all other methods. For the final layer, its error is zero by design.
- Computational Efficiency: HesScale is remarkably efficient. The authors found that AdaHesScale is only about 2x the cost of Adam, whereas other second-order approximations like KFAC or exact GGN are significantly slower as the number of parameters grows.
- Optimization Performance: On CIFAR-10 and CIFAR-100, AdaHesScale and its variant AdaHesScaleGN (which uses a Gauss-Newton approximation) consistently outperformed Adam, SGD, and AdaHessian in terms of test accuracy and convergence speed per epoch.
Limitations and Future Work
While HesScale is a major step forward for diagonal approximations, it still ignores off-diagonal information. This means it cannot capture correlations between different weights, which methods like KFAC attempt to do (albeit at a higher cost).
The authors suggest that HesScale’s high-quality diagonal estimates could be useful beyond just optimization—specifically in neural network pruning (deciding which weights are least important) and continual learning (protecting important weights from being overwritten). Future work could involve testing HesScale on even larger architectures like Transformers, where the "ill-conditioning" problem is particularly acute.
Summary updated