NeurIPS 2026Coming to NeurIPS in Sydney?Explore papers, orals & directions

Efficient Matrix-Free Approximations of Second-Order Information, with Applications to Pruning and Optimization

Elias Frantar, Eldar Kurtic, Dan AlistarharXiv 2021

Introduction

In deep learning, first-order optimization methods like SGD or Adam are standard because they only require the gradient of the loss landscape. However, second-order methods that utilize the Hessian matrix (the curvature) can offer significantly smarter updates and more accurate network pruning. The primary barrier to using second-order information is the sheer size of the Hessian; for a ResNet50, storing it would require roughly 2.5 Petabytes of memory.

This paper introduces M-FAC (Matrix-Free Approximate Curvature), a method that computes Inverse-Hessian Vector Products (IHVPs) in linear time and space. By refactoring the empirical Fisher approximation, M-FAC enables global second-order optimization and pruning without ever explicitly constructing the massive Hessian matrix.

The M-FAC Method

M-FAC leverages the empirical Fisher approximation, which estimates the Hessian as a sum of rank-one matrices (outer products of individual gradients). Using the Woodbury-Sherman-Morrison formula, the authors derive a way to compute the IHVP using only vector-vector and scalar operations.

The approach is split into two primary algorithms:

  • Static Algorithm (Pruning): Computes the exact IHVP for a fixed set of $m$ gradients in $O(dm)$ time, where $d$ is the number of parameters.
  • Dynamic Algorithm (Optimization): Uses a sliding-window approach to update the Hessian estimate as new gradients arrive during training. This allows for preconditioned SGD with an update cost of $O(dm + m^3)$, avoiding full recomputation.

State-of-the-Art Neural Network Pruning

A key advantage of M-FAC is its ability to utilize global curvature information. Traditional methods often rely on layer-wise or block-diagonal approximations to remain computationally feasible, but these discard important cross-layer dependencies. M-FAC scales linearly with the model dimension, making global approximations practical.

Pruning performance comparison for ResNet50 and MobileNetV1-STR.

In pruning tasks, M-FAC significantly outperforms previous state-of-the-art methods like WoodFisher. For instance, on MobileNetV1 at 89% sparsity, M-FAC is over 100x faster than WoodFisher when using the same number of gradients. Furthermore, because of its efficiency, M-FAC can process 10x more gradients than WoodFisher can fit in memory, leading to a +1.14% improvement in Top-1 accuracy while still being 6x faster.

Optimization and Efficiency

Beyond pruning, M-FAC serves as a powerful optimizer. It consistently achieves higher accuracy than SGD and Adam on models like WideResNet and BERT. Crucially, it does so with minimal overhead; the M-FAC optimizer is only 5% to 55% slower per step than vanilla SGD, whereas other second-order methods like AdaHessian can be over 300% slower.

Accuracy and runtime comparison between M-FAC and baselines.

Conclusion

M-FAC represents a significant step forward in making second-order information practical for large-scale deep learning. By bypassing matrix instantiation, it provides the benefits of global curvature with linear complexity. While storing the $m$ gradient vectors remains a memory challenge for the largest models, M-FAC's efficiency and performance gains in pruning and optimization set a new benchmark for the field.

Summary updated

BibTeX
@misc{frantar2021efficient,
  author = {Elias Frantar and Eldar Kurtic and Dan Alistarh},
  title = {{Efficient Matrix-Free Approximations of Second-Order Information, with Applications to Pruning and Optimization}},
  year = {2021},
  url = {https://openreview.net/forum?id=FHpc1lcj9y},
}
Figure