M-FAC: Efficient Matrix-Free Approximations of Second-Order Information

Elias Frantar, Eldar Kurtic, Dan Alistarh
7/7/2021
70 citations
cs.LG

Official code: IST-DASLab/M-FAC (17 stars, Python, MIT, last commit 2022-02-23).

Abstract

Efficiently approximating local curvature information of the loss function is a key tool for optimization and compression of deep neural networks. Yet, most existing methods to approximate second-order information have high computational or storage costs, which can limit their practicality.

Show full abstract

In this work, we investigate matrix-free, linear-time approaches for estimating Inverse-Hessian Vector Products (IHVPs) for the case when the Hessian can be approximated as a sum of rank-one matrices, as in the classic approximation of the Hessian by the empirical Fisher matrix. We propose two new algorithms as part of a framework called M-FAC: the first algorithm is tailored towards network compression and can compute the IHVP for dimension $d$, if the Hessian is given as a sum of $m$ rank-one matrices, using $O(dm^2)$ precomputation, $O(dm)$ cost for computing the IHVP, and query cost $O(m)$ for any single element of the inverse Hessian. The second algorithm targets an optimization setting, where we wish to compute the product between the inverse Hessian, estimated over a sliding window of optimization steps, and a given gradient direction, as required for preconditioned SGD. We give an algorithm with cost $O(dm + m^2)$ for computing the IHVP and $O(dm + m^3)$ for adding or removing any gradient from the sliding window. These two algorithms yield state-of-the-art results for network pruning and optimization with lower computational overhead relative to existing second-order methods. Implementations are available at [9] and [17].

View on arXivView PDF

Code Implementations(1)

IST-DASLab/M-FACOfficial100%
MIT

Efficient reference implementations of the static & dynamic M-FAC algorithms (for pruning and optimization)

173Python, CudaJun 16, 20214 years agoMIT

Similar Papers

Cite this paper

@article{frantar2021mfac,
  title  = {M-FAC: Efficient Matrix-Free Approximations of Second-Order Information},
  author = {Elias Frantar and Eldar Kurtic and Dan Alistarh},
  year   = {2021},
  eprint = {2107.03356},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2107.03356}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2107.03356.svg)](https://codeofpaper.com/paper/2107.03356)

Discussion