An illustrated guide to automatic sparse differentiation
Published on: 2025-08-02 03:18:52
In numerous applications of machine learning, Hessians and Jacobians exhibit sparsity, a property that can be leveraged to vastly accelerate their computation. While the usage of automatic differentiation in machine learning is ubiquitous, automatic sparse differentiation (ASD) remains largely unknown. This post introduces ASD, explaining its key components and their roles in the computation of both sparse Jacobians and Hessians. We conclude with a practical demonstration showcasing the performance benefits of ASD.
$$
ewcommand{\colorf}[1]{\textcolor{RoyalBlue}{#1}}
ewcommand{\colorh}[1]{\textcolor{RedOrange}{#1}}
ewcommand{\colorg}[1]{\textcolor{PineGreen}{#1}}
ewcommand{\colorv}[1]{\textcolor{VioletRed}{#1}} \def\sR{\mathbb{R}} \def\vx{\mathbf{x}} \def\vv{\mathbf{v}} \def\vb{\mathbf{e}}
ewcommand{\vvc}[1]{\colorv{\vv_{#1}}}
ewcommand{\vbc}[1]{\colorv{\vb_{#1}}}
ewcommand{\dfdx}[2]{\frac{\partial f_{#1}}{\partial x_{#2}}(\vx)}
ewcommand{\J}[2]{J_{#1}(#2)} \def\Jf{\J{f}{\vx}}
... Read full article.