Sparser, Better, Faster, Stronger: Sparsity Detection for Efficient Automatic Differentiation

Adrian Hill, Guillaume Dalle
1/29/2025
cs.LGcs.MS

No official code found. Best implementation: adrhill/SparseConnectivityTracer.jl (60 stars, MIT, last commit 2026-04-20).

Abstract

From implicit differentiation to probabilistic modeling, Jacobian and Hessian matrices have many potential use cases in Machine Learning (ML), but they are viewed as computationally prohibitive. Fortunately, these matrices often exhibit sparsity, which can be leveraged to speed up the process of Automatic Differentiation (AD). This paper presents advances in sparsity detection, previously the performance bottleneck of Automatic Sparse Differentiation (ASD). Our implementation of sparsity detection is based on operator overloading, able to detect both local and global sparsity patterns, and supports flexible index set representations. It is fully automatic and requires no modification of user code, making it compatible with existing ML codebases. Most importantly, it is highly performant, unlocking Jacobians and Hessians at scales where they were considered too expensive to compute. On real-world problems from scientific ML, graph neural networks and optimization, we show significant speed-ups of up to three orders of magnitude. Notably, using our sparsity detection system, ASD outperforms standard AD for one-off computations, without amortization of either sparsity detection or matrix coloring.

View on arXivView PDF

Code Implementations(1)

MIT

Fast operator-overloading Jacobian & Hessian sparsity pattern detection.

6013JuliaMar 28, 20246 months agoMIT
asdautodiffautomatic-differentiationhessianjacobian+2 more

Similar Papers

Cite this paper

@article{hill2025sparser,
  title  = {Sparser, Better, Faster, Stronger: Sparsity Detection for Efficient Automatic Differentiation},
  author = {Adrian Hill and Guillaume Dalle},
  year   = {2025},
  eprint = {2501.17737},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2501.17737v2}
}

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

Discussion