🤖 AI Summary
In machine learning, the prohibitively high computational cost of computing Jacobian and Hessian matrices severely limits their practical deployment in large-scale problems—especially when sparsity structure remains underutilized. To address this, we propose Automated Sparse Differentiation (ASD), a fully automatic sparse automatic differentiation framework. ASD introduces a novel operator-overloading mechanism that jointly detects global and local sparsity patterns, circumventing failures of control-flow-graph-based analysis. It implements a decoupled Julia software stack, compatible with any AD backend without requiring modifications to user code. The framework integrates sparse structural analysis, matrix coloring, and hybrid symbolic-numerical differentiation. Experimental results demonstrate that ASD achieves up to 1000× speedup on scientific machine learning and optimization tasks. Crucially, it enables efficient, single-pass generation of large-scale Jacobians and Hessians for the first time—outperforming conventional AD methods in both efficiency and scalability.
📝 Abstract
From implicit differentiation to probabilistic modeling, Jacobians and Hessians have many potential use cases in Machine Learning (ML), but conventional wisdom views them as computationally prohibitive. Fortunately, these matrices often exhibit sparsity, which can be leveraged to significantly speed up the process of Automatic Differentiation (AD). This paper presents advances in Automatic Sparse Differentiation (ASD), starting with a new perspective on sparsity detection. Our refreshed exposition is based on operator overloading, able to detect both local and global sparsity patterns, and naturally avoids dead ends in the control flow graph. We also describe a novel ASD pipeline in Julia, consisting of independent software packages for sparsity detection, matrix coloring, and differentiation, which together enable ASD based on arbitrary AD backends. Our pipeline is fully automatic and requires no modification of existing code, making it compatible with existing ML codebases. We demonstrate that this pipeline unlocks Jacobian and Hessian matrices at scales where they were considered too expensive to compute. On real-world problems from scientific ML and optimization, we show significant speed-ups of up to three orders of magnitude. Notably, our ASD pipeline often outperforms standard AD for one-off computations, once thought impractical due to slower sparsity detection methods.