Predicting the outputs of finite networks trained with noisy gradients

Gadi Naveh, Oded Ben-David, Haim Sompolinsky, Zohar Ringel · DOI

Abstract

A recent line of works studied wide deep neural networks (DNNs) by approximating them as Gaussian Processes (GPs). A DNN trained with gradient flow was shown to map to a GP governed by the Neural Tangent Kernel (NTK), whereas earlier works showed that a DNN with an i.i.d. prior over its weights maps to the so-called Neural Network Gaussian Process (NNGP). Here we consider a DNN training protocol, involving noise, weight decay and finite width, whose outcome corresponds to a certain non-Gaussian stochastic process. An analytical framework is then introduced to analyze this non-Gaussian process, whose deviation from a GP is controlled by the finite width. Our contribution is three-fold: (i) In the infinite width limit, we establish a correspondence between DNNs trained with noisy gradients and the NNGP, not the NTK. (ii) We provide a general analytical form for the finite width correction (FWC) for DNNs with arbitrary activation functions and depth and use it to predict the outputs of empirical finite networks with high accuracy. Analyzing the FWC behavior as a function of $n$, the training set size, we find that it is negligible for both the very small $n$ regime, and, surprisingly, for the large $n$ regime. (iii) We flesh out algebraically how these FWCs can improve the performance of finite convolutional neural networks (CNNs) relative to their GP counterparts on image classification tasks.

Introduction

Deep learning theory has recently focused on the "infinite width" limit, where neural networks behave like Gaussian Processes (GPs). Two primary frameworks have emerged: the Neural Network Gaussian Process (NNGP), describing networks at initialization, and the Neural Tangent Kernel (NTK), describing networks trained via deterministic gradient flow. However, these models often fail to capture the "feature learning" observed in real-world finite networks, the stochastic nature of training with noisy gradients (SGD), and the performance advantages of finite-width Convolutional Neural Networks (CNNs) over their infinite-width counterparts. This paper bridges this gap by introducing a framework that accounts for noise, weight decay, and finite width ($N$).

Theoretical Framework: The Neural Network Stochastic Process

The authors model the training process—specifically SGD with noise and weight decay—as a Langevin equation. They demonstrate that at equilibrium, the weight distribution follows a Gibbs distribution, corresponding to the posterior of a Bayesian Neural Network.

To move beyond the Gaussian limit of infinite width, the researchers employ an Edgeworth expansion. This perturbative approach allows for the calculation of the leading-order correction, which scales as $1/N$, to the network's predictive mean and variance. For large training sets ($n$), they utilize an "Equivalent Kernel" (EK) method to efficiently estimate these corrections without the computational burden of inverting large matrices.

Key Insights: NNGP and the U-Shaped Correction

A significant finding is that in the infinite-width limit, a network trained with noisy gradients and weight decay converges to the NNGP rather than the NTK. The noise allows weights to explore the function space ergodically, drifting far from their initial values.

Furthermore, the Finite Width Correction (FWC) exhibits a non-monotonic, "U-shaped" behavior relative to the training set size ($n$). The correction is negligible for very small $n$ (where the GP itself is a poor model) and, surprisingly, also for very large $n$. Its impact is most pronounced at intermediate training set sizes.

Leading Finite Width Correction (FWC) and GP discrepancy as a function of training set size.

Results: Accuracy and Scaling

The derived FWC formula predicts the outputs of empirical finite-width networks with high precision. In synthetic experiments involving a 2-layer network learning a quadratic target, the $1/N$ correction reduced the Mean Squared Error (MSE) of the prediction by over an order of magnitude compared to standard GP predictions.

Prediction accuracy and error scaling with network width.

The study also addresses the "CNN gap." In the infinite-width limit, CNNs behave like Locally Connected Networks (LCNs), losing the benefits of weight sharing. The authors show that the $1/N$ correction term is precisely what captures the performance boost provided by weight sharing in finite CNNs. Numerical tests on CIFAR-10 confirmed that finite CNNs can outperform their infinite-width NNGP counterparts, a phenomenon explained by the theory's higher-order cumulants.

Conclusion

By modeling noisy gradient descent as a stochastic process, this work provides a robust analytical framework for predicting the behavior of finite-width neural networks. The introduction of Finite Width Corrections not only improves predictive accuracy but also offers a theoretical explanation for why finite-width architectures, particularly CNNs, often exhibit superior performance compared to their idealized infinite-width versions. Future work will aim to extend this analysis to include pooling layers and investigate the effects of larger learning rates.

Summary updated

BibTeX
@misc{naveh2020predicting,
  author = {Gadi Naveh and Oded Ben-David and Haim Sompolinsky and Zohar Ringel},
  title = {{Predicting the outputs of finite networks trained with noisy gradients}},
  year = {2020},
  eprint = {2004.01190},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2004.01190},
}
Figure