In modern machine learning, it is increasingly common to embed iterative solvers—such as those used for Lasso or Ridge regression—as differentiable blocks within larger neural network architectures. This paradigm, known as differentiable programming, relies on our ability to compute the gradient of the final output with respect to the input parameters. A standard approach to achieve this is "differentiating through the loop," a process formally called piggyback automatic differentiation (AD).
While the asymptotics of piggyback AD are well understood for smooth, differentiable functions, many state-of-the-art algorithms involve nonsmooth components. Features like $\ell_1$ penalties (Lasso), ReLU activations, or projections onto constraints mean that the classical chain rule does not strictly apply.
The Core Question: Differentiating the Limit
This nonsmoothness raises a fundamental theoretical question: Does the limit of the derivatives computed by AD actually equal the derivative of the limit of the algorithm? If the algorithm is nonsmooth, does the "piggybacked" gradient hold any valid mathematical meaning?
The authors of this paper provide a rigorous theoretical foundation to answer this question, proving that for a large class of algorithms, the derivatives computed step-by-step do indeed converge to a meaningful derivative of the final solution.
Methodology: Conservative Jacobians and Contractions
To tackle the lack of classical derivatives everywhere, the authors utilize the framework of conservative Jacobians. Conservative Jacobians provide a set-valued generalization of derivatives that still obeys a version of the chain rule, making them highly suitable for analyzing automatic differentiation.
The theoretical framework relies on a few key technical pillars:
- Assumption of Contraction: The iteration mapping (the step the algorithm takes) is assumed to be a "contraction" in a specific sense, ensuring the algorithm converges to a unique fixed point.
- Set-Valued Fixed Point: The limit of the AD process is characterized as a unique fixed point in the space of matrices.
- The "Infinite" Chain Rule: The authors prove that the sequence of Jacobians generated by AD converges to a conservative Jacobian of the fixed-point mapping. This is the crucial step that justifies using AD on nonsmooth algorithms in practice.
Key Findings and Empirical Results
The theoretical claims are evaluated using numerical simulations on four classic optimization scenarios: Ridge Regression and Lasso Regression (using Forward-Backward splitting), Sparse Inverse Covariance Selection (using Douglas-Rachford splitting), and Trend Filtering (using ADMM).
AD is Robust to Nonsmoothness
For most common proximal algorithms (FB, DR, ADMM), the "piggyback" Jacobians converge linearly to the correct derivative. As shown in the convergence plots, the distance between the current Jacobian and the true limit Jacobian decreases at a linear rate, matching the convergence rate of the iterates themselves. Furthermore, despite the nonsmoothness, the AD-computed derivative matches the classical derivative for almost all parameter values. This is a significant relief for practitioners relying on frameworks like PyTorch or JAX.
The "Heavy-Ball" Warning
One of the most surprising and important findings is that inertial methods (like the Heavy-Ball method or Nesterov acceleration) can fail in this context. Even if the algorithm's iterates converge perfectly to the correct solution, the derivatives computed via AD can oscillate or explode if the objective function is nonsmooth. The authors provide a concrete example where the Heavy-Ball method converges, but its AD-computed Jacobians diverge. This suggests that while acceleration is beneficial for optimization, it carries hidden risks for differentiation.
Limitations and Future Directions
While this paper establishes a strong foundation for nonsmooth AD, the current theory relies heavily on the iteration map being a contraction. This covers many proximal methods but leaves out optimization algorithms where the fixed point isn't unique or the contraction property doesn't hold.
Additionally, the failure of the Heavy-Ball method opens a critical new research direction: discovering how to safely differentiate through accelerated or momentum-based solvers in nonsmooth settings. Future work will likely focus on relaxing the contraction assumption to study a wider, more abstract class of algorithmic recursions.
Summary updated