On the Correctness of Automatic Differentiation for Neural Networks with Machine-Representable Parameters
Wonyeol Lee, Sejun Park, Alex Aiken
Abstract
Recent work has shown that forward- and reverse- mode automatic differentiation (AD) over the reals is almost always correct in a mathematically precise sense. However, actual programs work with machine-representable numbers (e.g., floating-point numbers), not reals. In this paper, we study the correctness of AD when the parameter space of a neural network consists solely of machine-representable numbers. In particular, we analyze two sets of parameters on which AD can be incorrect: the incorrect set on which the network is differentiable but AD does not compute its derivative, and the non-differentiable set on which the network is non-differentiable. For a neural network with bias parameters, we first prove that the incorrect set is always empty. We then prove a tight bound on the size of the non-differentiable set, which is linear in the number of non-differentiabilities in activation functions, and give a simple necessary and sufficient condition for a parameter to be in this set. We further prove that AD always computes a Clarke subderivative even on the non-differentiable set. We also extend these results to neural networks possibly without bias parameters.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 1aa80072-3ce4-4372-9151-fd16b51c2ebcCited by top-tier papers1
Ask how each one uses itBuilds on12
- Minimum Width for Universal ApproximationSejun Park, Chulhee Yun, Jaeho Lee, Jinwoo ShinICLR 2021 · 148 citations
- A mathematical model for automatic differentiation in machine learningJérôme Bolte, Edouard PauwelsNeurIPS 2020 · 84 citations
- On Correctness of Automatic Differentiation for Non-Differentiable FunctionsWonyeol Lee, Hangyeol Yu, Xavier Rival, Hongseok YangNeurIPS 2020 · 50 citations
- A simple differentiable programming languageMartín Abadi, Gordon D. PlotkinPOPL 2020 · 49 citations
- Automatic differentiation in PCFDamiano Mazza, Michele PaganiPOPL 2021 · 47 citations
Related papers
- Floating-Point Networks with Automatic Differentiation Can Represent Almost All Floating-Point Functions and Their GradientsSejun Park, Yeachan Park, Geonho HwangICML 2026
- Floating-Point Neural Networks Can Represent Almost All Floating-Point FunctionsGeonho Hwang, Yeachan Park, Wonyeol Lee, Sejun ParkICML 2025
- Floating-Point Neural Networks are Provably Robust Universal ApproximatorsGeonho Hwang, Wonyeol Lee, Yeachan Park, Sejun Park et al.CAV 2025
- On the complexity of nonsmooth automatic differentiationJérôme Bolte, Ryan Boustany, Edouard Pauwels, Béatrice Pesquet-PopescuICLR 2023
- On Minimum Depth and Width of Floating-Point Neural Networks for Representing Floating-Point FunctionsSejun Park, Yeachan Park, Geonho HwangICML 2026
