[Paper Review] A mathematical model for automatic differentiation in machine learning
This paper proposes a mathematical framework for automatic differentiation (AD) in machine learning that addresses the instability of AD on nonsmooth functions by introducing selection derivatives and a nonsmooth calculus. It shows that artificial critical points from AD arise due to program representation rather than function structure, and proves that stochastic optimization methods avoid these spurious points with probability one, providing a rigorous operational model for AD in practice.
Automatic differentiation, as implemented today, does not have a simple mathematical model adapted to the needs of modern machine learning. In this work we articulate the relationships between differentiation of programs as implemented in practice and differentiation of nonsmooth functions. To this end we provide a simple class of functions, a nonsmooth calculus, and show how they apply to stochastic approximation methods. We also evidence the issue of artificial critical points created by algorithmic differentiation and show how usual methods avoid these points with probability one.
Motivation & Objective
- To address the lack of a stable mathematical theory for automatic differentiation (AD) in modern machine learning, especially for nonsmooth, nonconvex functions.
- To formalize the discrepancy between AD results and classical differentiation, showing that AD acts on program representations, not functions.
- To introduce a new class of nonsmooth functions and a differential calculus (selection derivatives) that captures practical AD behavior.
- To prove that stochastic optimization methods avoid artificial critical points created by AD with probability one.
- To provide a rigorous operational model for AD in deep learning frameworks like PyTorch and TensorFlow.
Proposed method
- Introduces a canonical surjection 𝒫 → 𝒇 mapping programs to their mathematical functions, showing AD operates on program structure, not function equivalence.
- Defines selection derivatives as differential objects for a class of nonsmooth, nonconvex functions common in ML, enabling stable calculus.
- Uses definable sets and stratification theory to analyze the dimension of sets where artificial critical points or non-differentiability occur.
- Applies Baire's category theorem and measure-theoretic arguments to show that the set of initial conditions leading to artificial critical points is meager and of zero measure.
- Establishes that stochastic subgradient sequences using selection derivatives converge to Clarke critical points under boundedness assumptions.
- Proves that for almost all initial conditions, the sequence generated by AD-based optimization behaves like a stochastic subgradient method.
Experimental results
Research questions
- RQ1Why does automatic differentiation produce inconsistent derivatives for mathematically equivalent programs, such as different implementations of ReLU?
- RQ2Can a mathematical operator be defined to generalize algorithmic differentiation for nonsmooth functions while preserving key properties like subgradient inclusion at non-differentiable points?
- RQ3What is the geometric and measure-theoretic nature of artificial critical points introduced by AD in nonsmooth settings?
- RQ4How do stochastic optimization methods avoid artificial critical points created by AD in practice?
- RQ5Can selection derivatives provide a stable, operational calculus that models real-world AD behavior in deep learning frameworks?
Key findings
- Algorithmic differentiation cannot be represented by a consistent differential operator on functions due to program-dependent derivative values, as proven by Theorem 1.
- Artificial critical points arise from program representation, not function structure, and are confined to sets of measure zero and topological meagerness.
- The set of initial conditions leading to artificial critical points or non-differentiability is closed with empty interior and of zero Lebesgue measure.
- For almost all initial conditions, the sequence generated by AD-based optimization is equivalent to a stochastic subgradient sequence with zero-mean noise.
- Stochastic optimization methods converge to Clarke critical points almost surely when bounded, validating their robustness in practice despite AD's spurious behaviors.
- Selection derivatives provide a mathematically sound and operationally relevant calculus for nonsmooth, nonconvex functions in machine learning.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.