On Correctness of Automatic Differentiation for Non-Differentiable Functions
Not on the map. Why?
Abstract (arXiv)
Differentiation lies at the core of many machine-learning algorithms, and is well-supported by popular autodiff systems, such as TensorFlow and PyTorch. Originally, these systems have been developed to compute derivatives of differentiable functions, but in practice, they are commonly applied to functions with non-differentiabilities. For instance, neural networks using ReLU define non-differentiable functions in general, but the gradients of losses involving those functions are computed using autodiff systems in practice. This status quo raises a natural question: are autodiff systems correct in any formal sense when they are applied to such non-differentiable functions? In this paper, we provide a positive answer to this question. Using counterexamples, we first point out flaws in often-used informal arguments, such as: non-differentiabilities arising in deep learning do not cause any issues because they form a measure-zero set. We then investigate a class of functions, called PAP functions, that includes nearly all (possibly non-differentiable) functions in deep learning nowadays. For these PAP functions, we propose a new type of derivatives, called intensional derivatives, and prove that these derivatives always exist and coincide with standard derivatives for almost all inputs. We also show that these intensional derivatives are what most autodiff systems compute or try to compute essentially. In this way, we formally establish the correctness of autodiff systems applied to non-differentiable functions.
Key facts. Cited by 20 papers in the map (data through 14 Oct 2026). First posted on arXiv 12 Jun 2020.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 4; 2022: 4; 2023: 5; 2024: 3; 2025: 2; 2026: 2.
20 papers.
Sort:
- 2021Nonsmooth Implicit Differentiation for Machine Learning and Optimizationcited by 43
- 2022Automatic differentiation of nonsmooth iterative algorithmscited by 25
- 2024Bounds for the smallest eigenvalue of the NTK for arbitrary spherical data of arbitrary dimensioncited by 13
- 2025Meta-Learning for Physically-Constrained Neural System Identificationcited by 6
- 2021A Gradient Sampling Algorithm for Stratified Maps with Applications to Topological Data Analysiscited by 5
- 2021The structure of conservative gradient fieldscited by 4
- 2022Learning Sparsity-Promoting Regularizers using Bilevel Optimizationcited by 4
- 2023On the Correctness of Automatic Differentiation for Neural Networks with Machine-Representable Parameterscited by 3
- 2023ωPAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programscited by 3
- 2025Deep Learning as the Disciplined Construction of Tame Objectscited by 3
- 2023An Efficient Learning-Based Solver for Two-Stage DC Optimal Power Flow with Feasibility Guaranteescited by 1
- 2023Understanding Automatic Differentiation Pitfallscited by 1
8 more
- 2023Auto-Differentiation of Relational Computations for Very Large Scale Machine Learningcited by 1
- 2021Network control by a constrained external agent as a continuous optimization problemcited by 0
- 2022An Algebraic Approach to Learning and Groundingcited by 0
- 2022Global quantitative robustness of regression feed-forward neural networkscited by 0
- 2024On the numerical reliability of nonsmooth autodiff: a MaxPool case studycited by 0
- 2024BrowNNe: Brownian Nonlocal Neurons & Activation Functionscited by 0
- 2026GradInf: Gradient Estimation as Probabilistic Inferencecited by 0
- 2026LazyHMC: Hamiltonian Monte Carlo Simulation for Lazy, Infinite Dimensional Probabilistic Programscited by 0
- 2026LazyHMC: Hamiltonian Monte Carlo Simulation for Lazy, Infinite Dimensional Probabilistic Programs9 Aug 2026
- 2026GradInf: Gradient Estimation as Probabilistic Inference8 Jul 2026
- 2025Deep Learning as the Disciplined Construction of Tame Objects22 Sep 2025
- 2025Meta-Learning for Physically-Constrained Neural System Identification10 Jan 2025
- 2024BrowNNe: Brownian Nonlocal Neurons & Activation Functions21 Jun 2024
- 2024Bounds for the smallest eigenvalue of the NTK for arbitrary spherical data of arbitrary dimension23 May 2024
- 2024On the numerical reliability of nonsmooth autodiff: a MaxPool case study5 Jan 2024
- 2023Auto-Differentiation of Relational Computations for Very Large Scale Machine Learning31 May 2023
- 2023Understanding Automatic Differentiation Pitfalls12 May 2023
- 2023An Efficient Learning-Based Solver for Two-Stage DC Optimal Power Flow with Feasibility Guarantees3 Apr 2023
- 2023ωPAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programs21 Feb 2023
- 2023On the Correctness of Automatic Differentiation for Neural Networks with Machine-Representable Parameters31 Jan 2023
8 more
- 2022Global quantitative robustness of regression feed-forward neural networks18 Nov 2022
- 2022Learning Sparsity-Promoting Regularizers using Bilevel Optimization18 Jul 2022
- 2022Automatic differentiation of nonsmooth iterative algorithms31 May 2022
- 2022An Algebraic Approach to Learning and Grounding6 Apr 2022
- 2021A Gradient Sampling Algorithm for Stratified Maps with Applications to Topological Data Analysis1 Sep 2021
- 2021Network control by a constrained external agent as a continuous optimization problem23 Aug 2021
- 2021Nonsmooth Implicit Differentiation for Machine Learning and Optimization8 Jun 2021
- 2021The structure of conservative gradient fields3 Jan 2021
- 2021Nonsmooth Implicit Differentiation for Machine Learning and Optimizationcited by 43
- 2022Automatic differentiation of nonsmooth iterative algorithmscited by 25
- 2024Bounds for the smallest eigenvalue of the NTK for arbitrary spherical data of arbitrary dimensioncited by 13
- 2025Meta-Learning for Physically-Constrained Neural System Identificationcited by 6
- 2021A Gradient Sampling Algorithm for Stratified Maps with Applications to Topological Data Analysiscited by 5
- 2021The structure of conservative gradient fieldscited by 4
- 2022Learning Sparsity-Promoting Regularizers using Bilevel Optimizationcited by 4
- 2023On the Correctness of Automatic Differentiation for Neural Networks with Machine-Representable Parameterscited by 3
- 2023ωPAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programscited by 3
- 2025Deep Learning as the Disciplined Construction of Tame Objectscited by 3
- 2023An Efficient Learning-Based Solver for Two-Stage DC Optimal Power Flow with Feasibility Guaranteescited by 1
- 2023Understanding Automatic Differentiation Pitfallscited by 1
12 most cited of 20 All 20 (JSON)
- 2026LazyHMC: Hamiltonian Monte Carlo Simulation for Lazy, Infinite Dimensional Probabilistic Programs9 Aug 2026
- 2026GradInf: Gradient Estimation as Probabilistic Inference8 Jul 2026
- 2025Deep Learning as the Disciplined Construction of Tame Objects22 Sep 2025
- 2025Meta-Learning for Physically-Constrained Neural System Identification10 Jan 2025
- 2024BrowNNe: Brownian Nonlocal Neurons & Activation Functions21 Jun 2024
- 2024Bounds for the smallest eigenvalue of the NTK for arbitrary spherical data of arbitrary dimension23 May 2024
- 2024On the numerical reliability of nonsmooth autodiff: a MaxPool case study5 Jan 2024
- 2023Auto-Differentiation of Relational Computations for Very Large Scale Machine Learning31 May 2023
- 2023Understanding Automatic Differentiation Pitfalls12 May 2023
- 2023An Efficient Learning-Based Solver for Two-Stage DC Optimal Power Flow with Feasibility Guarantees3 Apr 2023
- 2023ωPAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programs21 Feb 2023
- 2023On the Correctness of Automatic Differentiation for Neural Networks with Machine-Representable Parameters31 Jan 2023
12 newest of 20 All 20 (JSON)