Abstract
In modern machine learning and optimization, differentiating through iterative solvers has become a standard practice for end-to-end learning. However, the mathematical validity of this process remains non-trivial when the solvers involve nonsmooth operations, such as projections or $L_1$ norms. This paper provides a rigorous theoretical framework for the automatic differentiation (AD) of nonsmooth iterative algorithms. By utilizing the concept of conservative Jacobians, the authors prove that the sequence of Jacobians generated by AD converges to a valid sensitivity measure for a wide class of proximal algorithms. Conversely, they identify a critical failure mode: momentum-based methods, while convergent in their iterates, can produce exploding derivatives in nonsmooth settings.
Introduction
The rise of differentiable programming frameworks like PyTorch and JAX has popularized the "optimize-then-differentiate" paradigm. In this workflow, an iterative algorithm $x_{k+1} = F(x_k, \theta)$ is treated as a differentiable block, and its sensitivity to parameters $\theta$ is calculated by differentiating through the loop—a process known as "piggyback" automatic differentiation.
While this approach is well-understood for smooth functions, many contemporary problems in signal processing and machine learning rely on nonsmooth regularizers (e.g., Lasso, Total Variation) or nonsmooth activations (e.g., ReLU). When the transition function $F$ is nonsmooth, standard calculus rules do not directly apply. This research addresses whether the derivatives calculated during these iterative processes converge to a meaningful limit and whether they can be safely integrated into machine learning pipelines.
Theoretical Framework: Conservative Jacobians
To analyze nonsmooth AD, the authors employ the framework of conservative Jacobians. Unlike the classical Clarke Jacobian, conservative Jacobians are set-valued maps that satisfy a nonsmooth version of the chain rule. This property makes them uniquely suited for the algorithmic nature of AD, where functions are composed of many elementary operations.
The core of the analysis treats the sequence of Jacobians as a fixed-point iteration in the space of matrices. The authors demonstrate that if the underlying algorithm is a "set-valued affine contraction"—meaning it pulls points closer together in a specific sense—the Jacobians generated by both forward-mode (JVP) and reverse-mode (VJP) AD will behave predictably.
Convergence in Proximal Splitting
The study applies this theory to several workhorse algorithms in optimization:
- Forward-Backward (FB) Splitting
- Douglas-Rachford (DR) Splitting
- Alternating Direction Method of Multipliers (ADMM)
For these methods, the authors prove that the AD-generated Jacobians converge to the true Jacobian of the solution at a linear rate, matching the convergence rate of the iterates themselves. Furthermore, they show that for almost all parameter values $\theta$, the classical Jacobian exists, and the AD process converges to it. This provides a formal justification for why practitioners often find success differentiating through nonsmooth loops in practice.
The Momentum Trap
One of the paper's most significant contributions is the identification of a "hidden trap" involving momentum. In smooth optimization, inertial methods like the Heavy-Ball algorithm are prized for accelerating convergence. However, the authors prove that in nonsmooth settings, momentum can be catastrophic for AD.
Specifically, they demonstrate that for certain piecewise quadratic functions, the iterates $x_k$ of the Heavy-Ball method converge perfectly to the solution, but the associated Jacobians oscillate and explode to infinity. This occurs because the "Jacobian of the iteration" can have eigenvalues with a magnitude greater than one at the points where the function is nonsmooth. This finding serves as a critical warning: adding momentum to a nonsmooth solver within a differentiable pipeline can lead to numerical instability and gradient explosion, even if the solver itself is stable.
Numerical Verification
The theoretical results were verified across several classic optimization scenarios, including Ridge Regression, Lasso, Sparse Inverse Covariance Selection, and Trend Filtering.
- Linear Convergence: In cases like Lasso and ADMM, numerical experiments confirmed that the distance to the true solution and the distance to the true Jacobian both drop linearly on a log scale.
- Failure Demonstration: The authors provided a concrete example where the Heavy-Ball method’s iterates converged to zero, but the AD-generated derivatives exploded to values exceeding 200, illustrating the theoretical risk of momentum in nonsmooth AD.
Conclusion and Future Work
This work provides a mathematical "safety manual" for differentiating through nonsmooth solvers. It confirms that for standard proximal methods, piggyback AD is a theoretically sound and numerically stable way to compute sensitivities. However, it highlights a fundamental incompatibility between momentum-based acceleration and nonsmooth automatic differentiation.
Future research directions include extending this framework to non-convex problems, such as those found in Deep Equilibrium Networks (DEQs), and developing "AD-safe" accelerated algorithms that can provide the speed of momentum without the risk of gradient explosion.
Summary updated