Gradients of Functions of Large Matrices

Nicholas Krämer, Pablo Moreno-Muñoz, Hrittik Roy, Søren Hauberg
5/27/2024
7 citations
cs.LGmath.NAstat.ML
bayesian

Official code: pnkraemer/experiments-lanczos-adjoints (9 stars, Python, MIT, last commit 2024-05-28).

Abstract

Tuning scientific and probabilistic machine learning models $-$ for example, partial differential equations, Gaussian processes, or Bayesian neural networks $-$ often relies on evaluating functions of matrices whose size grows with the data set or the number of parameters. While the state-of-the-art for evaluating these quantities is almost always based on Lanczos and Arnoldi iterations, the present work is the first to explain how to differentiate these workhorses of numerical linear algebra efficiently.

Show full abstract

To get there, we derive previously unknown adjoint systems for Lanczos and Arnoldi iterations, implement them in JAX, and show that the resulting code can compete with Diffrax when it comes to differentiating PDEs, GPyTorch for selecting Gaussian process models and beats standard factorisation methods for calibrating Bayesian neural networks. All this is achieved without any problem-specific code optimisation. Find the code at https://github.com/pnkraemer/experiments-lanczos-adjoints and install the library with pip install matfree.

View on arXivView PDF

Code Implementations(1)

MIT
90Python, ShellDec 19, 20232 years agoMIT

Similar Papers

Cite this paper

@article{krmer2024gradients,
  title  = {Gradients of Functions of Large Matrices},
  author = {Nicholas Krämer and Pablo Moreno-Muñoz and Hrittik Roy and Søren Hauberg},
  year   = {2024},
  eprint = {2405.17277},
  archivePrefix = {arXiv},
  doi    = {10.52202/079017-1566},
  url    = {http://arxiv.org/abs/2405.17277v2},
  journal = {NEURIPS 2024 2024}
}

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/2405.17277.svg)](https://codeofpaper.com/paper/2405.17277)

Discussion