Bayesian Inference with Deep Weakly Nonlinear Networks

Boris Hanin, Alexander ZlokapaarXiv 2024 · DOI

Abstract

Understanding the interplay between depth, width, and dataset size in deep learning remains a fundamental challenge in neural network theory. While the "infinite width" or Kernel regime provides a tractable limit, it often fails to capture the feature-learning capabilities of finite-width nonlinear networks. This paper introduces an analytically solvable model for Bayesian learning in deep nonlinear networks by employing "shaped" nonlinearities and a perturbative expansion in $1/N$. The analysis reveals that the network's behavior is governed by an "effective depth" parameter, $LP/N$, which dictates the onset of feature learning. Furthermore, the study demonstrates that increasing depth can improve model evidence and generalization even in the regime of "benign overfitting," providing a theoretical basis for the success of deep architectures in noisy environments.

Introduction

Despite the empirical success of deep learning, theoretical frameworks often struggle to bridge the gap between simple linear models and complex nonlinear architectures. Existing theories typically focus on either the Neural Tangent Kernel (NTK) regime—where networks are so wide they behave like linear models—or deep linear models, which lack the essential complexity of nonlinear activations. This research addresses this gap by studying weakly nonlinear networks, allowing for the computation of Bayesian posteriors and model evidence—quantities that are usually mathematically intractable for deep, nonlinear systems.

Theoretical Framework

To maintain mathematical tractability while preserving nonlinear dynamics, the authors utilize a "physics-inspired" approach involving several key components:

Shaped Nonlinearities

The researchers employ a specific activation function: $\phi(t) = t + \psi t^3 / L$. By scaling the cubic nonlinearity by the inverse of the depth ($1/L$), they ensure the network remains stable as it grows deeper. This prevents the signal from collapsing to zero or exploding, a common issue in deep nonlinear theory.

Combinatorial Graphical Models

To characterize the prior statistics of the network's outputs, the computations are represented as a random graph process. This framework allows the authors to replace high-dimensional integrals with a more manageable "self-loop process," facilitating the derivation of the network's statistical properties before data is introduced.

Perturbative Expansion

The Bayesian inference equations are solved by expanding them in powers of $1/N$ (where $N$ is the width). This perturbative approach reveals the "Kernel" behavior at the zeroth order and captures the emergence of "Feature Learning" at the first order. This allows for an explicit calculation of how the network adapts its internal representations to the training data.

The Effective Depth: $LP/N$

A central contribution of this work is the identification of the "effective depth" parameter: $LP/N$ (Depth $\times$ Samples / Width). This single parameter controls the transition from the kernel regime to the feature-learning regime. When $LP/N$ is small, the network behaves like a fixed kernel; as it increases, the network begins to adapt its internal features to the dataset. This provides a precise metric for understanding when depth and data size overcome the simplifying effects of large width.

Key Insights and Results

Nonlinearity as Curvature

At infinite width, the use of a nonlinear network is shown to be equivalent to a kernel method where data is projected onto a curved manifold. The strength and sign of the nonlinearity ($\psi$) determine the geometry of this manifold (e.g., spherical, hyperbolic, or flat), providing a geometric interpretation of activation functions.

Data-Dependent Kernels

The authors prove that at the first order in $1/N$, Bayesian inference is equivalent to using a kernel that "re-weights" inputs based on their overlap with the training data's covariance. This demonstrates how even weakly nonlinear networks begin to perform a form of automated feature selection.

Depth and Benign Overfitting

In the context of noisy data, the paper shows that increasing depth can actually improve both model evidence and generalization error at zero temperature. This offers a theoretical justification for why deeper models often perform better in practice, even when they possess enough parameters to fit the noise in the training set perfectly.

Methodology and Evaluation

As a theoretical study, the authors evaluate their derivations using a Power Law Data Model. In this synthetic environment, the training data features a covariance spectrum with eigenvalues decaying as $j^{-\alpha}$. This setup allows for precise control over the data's "shape" and noise levels, enabling the authors to map out phase diagrams that predict when depth will increase or decrease model evidence based on the data's power-law exponent and label alignment.

Limitations and Future Directions

While this model provides a rare analytical window into deep nonlinear learning, it has specific limitations:

  • Perturbative Constraints: The results are currently limited to the first few orders of $1/N$. A non-perturbative solution that sums the entire series remains an open challenge.
  • Activation Functions: The analysis focuses on cubic "shaped" nonlinearities. While these serve as proxies for many odd functions (like tanh), they do not yet account for non-odd activations such as ReLU.
  • Dimensionality: The current theory requires the number of datapoints ($P$) to be less than the input dimension ($N_0$). Extending this to the high-dimensional regime ($P > N_0$) is a primary goal for future research.

Summary updated

BibTeX
@misc{hanin2024bayesian,
  author = {Boris Hanin and Alexander Zlokapa},
  title = {{Bayesian Inference with Deep Weakly Nonlinear Networks}},
  year = {2024},
  eprint = {2405.16630},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.16630},
}
Figure