Deterministic and probabilistic rounding error analysis of neural networks in floating-point arithmetic

Théo Beuzeville, Alfredo Buttari, Serge Gratton, Théo MaryIMA 2025

Abstract

The use of artificial neural networks is now becoming widespread across a wide variety of tasks. In this context of very rapid development, issues related to the storage and computational performance of these models emerge, as networks are sometimes very deep and comprise up to trillions of parameters. For these reasons, the use of reduced precision is increasingly being considered, although its accuracy and robustness have historically been approached mostly from a practical standpoint. This work provides formal tools to better understand, explain, and predict the accuracy and stability of neural networks when using floating-point arithmetic. By applying a rounding error analysis based on existing tools in numerical linear algebra, we obtain both forward and backward error bounds. This includes both deterministic worst-case bounds as well as probabilistic bounds that are sharper on average. These bounds ensure the proper functioning of neural networks once trained and provide recommendations on architectures and training methods to enhance robustness.

Introduction

As neural networks grow to trillions of parameters, the industry is racing toward "low-precision" arithmetic (like FP16 or BF16) to save memory and energy. However, most practitioners treat the resulting loss in accuracy as an empirical "black box"—testing it and proceeding if it works. The challenge is that in safety-critical fields like medicine or autonomous driving, empirical success isn't enough. We lack formal tools to explain why certain architectures are more robust to rounding errors than others. This paper fills that gap by adapting classical error analysis—specifically the concepts of backward error and condition numbers—to the specific structure of deep learning models.

Methodology

The authors treat each layer of a neural network as a matrix-vector product followed by a non-linear activation function. Their key methodological contributions include:

  1. Integrating Activations: They developed a way to "back-propagate" the rounding errors generated during the computation of non-linear activation functions (like ReLU or tanh) into perturbations of the layer's input data. This allows the entire layer to be analyzed as a single perturbed operation.
  2. Probabilistic Bounds: While deterministic bounds provide a "worst-case" guarantee, they are often too pessimistic for large networks. Using Martingale theory and the Azuma-Hoeffding inequality, the authors derived probabilistic bounds that replace the layer size $n$ with $\sqrt{n}$, providing a much tighter and more realistic estimate of error in practice.
  3. Linearized Validation: Since exact backward error is computationally intractable for deep networks, they validated their theoretical bounds against a linearized backward error, which they computed by solving a constrained optimization problem using the CVXPY library.

Key Insights and Ideas

  • The Activation Condition Number: The rounding error isn't just about the weights; it's heavily dictated by the condition number of the activation function. If the input to a tanh layer falls into a "threshold region" where the function is nearly flat, the condition number approaches zero, and rounding errors can be amplified significantly.
  • The Power of Zero-Mean: For large-scale networks, if the parameters are zero-mean (a common result of techniques like Xavier/Glorot initialization), the error bound becomes independent of the layer size $n$. This explains why massive models can often run surprisingly well in low precision.
  • CNNs vs. Fully Connected: Convolutional layers naturally have lower backward errors because their weight matrices are sparse. However, they often have higher condition numbers, making them potentially more sensitive to input perturbations.

Results

The researchers evaluated their framework using synthetic random networks and the FashionMNIST benchmark. The experiments confirmed that the theoretical bounds accurately track the behavior of real-world rounding errors. The probabilistic approach significantly improves upon deterministic bounds, reducing the impact of consecutive rounding errors from $nu$ to $\sqrt{n}u$. Furthermore, the refined bounds (which assume zero-mean parameters) proved remarkably sharp when applied to a network during training, capturing the actual error behavior much more closely than standard linear algebra bounds.

Conclusion and Future Work

While a major step forward, the authors acknowledge limitations, such as the bounds becoming meaningless if an activation function's condition number hits zero (e.g., a perfectly flat ReLU region). Future work could explore the gap between linearized approximations and true non-linear backward error. Ultimately, these tools could be used to automatically identify which specific layers in a model require high precision and which can be safely compressed, leading to more efficient mixed-precision training.

Summary updated

BibTeX
@inproceedings{beuzeville2025deterministic,
  author = {Théo Beuzeville and Alfredo Buttari and Serge Gratton and Théo Mary},
  title = {{Deterministic and probabilistic rounding error analysis of neural networks in floating-point arithmetic}},
  booktitle = {IMA},
  year = {2025},
  doi = {10.1093/imanum/draf130},
}
Figure