{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/efficient-matrix-free-approximations-of","title":"M-FAC: Efficient Matrix-Free Approximations of Second-Order Information","arxiv_id":"2107.03356","date":"2021-07-07","proceeding":"NeurIPS 2021 12","authors":["Elias Frantar","Eldar Kurtic","Dan Alistarh"],"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. 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].","url_abs":"https://arxiv.org/abs/2107.03356v5","url_pdf":"https://arxiv.org/pdf/2107.03356v5.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"efficient-matrix-free-approximations-of","repo_url":"https://github.com/IST-DASLab/M-FAC","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"efficient-matrix-free-approximations-of","repo_url":"https://github.com/ist-daslab/efcp","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":null}],"tasks":[{"task_slug":"network-pruning","task_name":"Network Pruning"},{"task_slug":"second-order-methods","task_name":"Second-order methods"}],"methods":[{"method_slug":"pruning","method_name":"Pruning"},{"method_slug":"sgd","method_name":"SGD"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2107.03356","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2107.03356"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ist-daslab/efcp","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/IST-DASLab/M-FAC","reach":null}],"summary":{"ran_draft_wrong":3,"ran_honours":4,"unverified":7},"by_repo_kind":{"official":{"samples":6,"ran":4,"repositories":1},"listed":{"samples":8,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"8050b1947cc48db8","entry":"batch_mvp","repo":"IST-DASLab/M-FAC","repo_kind":"official","path":"prun.py","file_url":"https://github.com/IST-DASLab/M-FAC/blob/HEAD/prun.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8050b1947cc48db8"}},{"code_sha256_prefix":"19650f5d1f338d8a","entry":"batch_vmp","repo":"IST-DASLab/M-FAC","repo_kind":"official","path":"prun.py","file_url":"https://github.com/IST-DASLab/M-FAC/blob/HEAD/prun.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"19650f5d1f338d8a"}},{"code_sha256_prefix":"87ccd31d3ec472fd","entry":"batch_dot","repo":"IST-DASLab/M-FAC","repo_kind":"official","path":"prun.py","file_url":"https://github.com/IST-DASLab/M-FAC/blob/HEAD/prun.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"87ccd31d3ec472fd"}},{"code_sha256_prefix":"3cb7ad181b8a381b","entry":"get_gradients","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3cb7ad181b8a381b"}},{"code_sha256_prefix":"d0a95782e972077b","entry":"get_weights","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d0a95782e972077b"}},{"code_sha256_prefix":"79cfb98e536acac6","entry":"norm","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"79cfb98e536acac6"}},{"code_sha256_prefix":"c1bbbadad5c3cdcf","entry":"test","repo":"IST-DASLab/M-FAC","repo_kind":"official","path":"main_optim.py","file_url":"https://github.com/IST-DASLab/M-FAC/blob/HEAD/main_optim.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c1bbbadad5c3cdcf"}},{"code_sha256_prefix":"7290388bb1e94558","entry":"DenseMFAC","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7290388bb1e94558"}},{"code_sha256_prefix":"80db31a3a92821b5","entry":"HInvFastUpMulti","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"80db31a3a92821b5"}},{"code_sha256_prefix":"289ba747a6543b4b","entry":"HInvFastUpMulti","repo":"IST-DASLab/M-FAC","repo_kind":"official","path":"optim.py","file_url":"https://github.com/IST-DASLab/M-FAC/blob/HEAD/optim.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"289ba747a6543b4b"}},{"code_sha256_prefix":"dadfb3e97237d010","entry":"MFAC","repo":"IST-DASLab/M-FAC","repo_kind":"official","path":"optim.py","file_url":"https://github.com/IST-DASLab/M-FAC/blob/HEAD/optim.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dadfb3e97237d010"}},{"code_sha256_prefix":"1f9104c9660aeb24","entry":"get_first_device","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1f9104c9660aeb24"}},{"code_sha256_prefix":"08f4dde70db58de8","entry":"get_gpus","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"08f4dde70db58de8"}},{"code_sha256_prefix":"c2dc9537f5e560fa","entry":"update_model","repo":"ist-daslab/efcp","repo_kind":"listed","path":"optimizers/dense/MFAC.py","file_url":"https://github.com/ist-daslab/efcp/blob/HEAD/optimizers/dense/MFAC.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c2dc9537f5e560fa"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}