An Empirical Analysis of the Advantages of Finite v.s. Infinite Width Bayesian Neural Networks

Jiayu Yao, Yaniv Yacoby, Beau Coker, Weiwei Pan, Finale Doshi-Velez

TL;DR

While infinite-width Bayesian Neural Networks (BNNs) conveniently converge to well-behaved Neural Network Gaussian Processes (NNGPs), smaller, finite-width BNNs often achieve superior generalization in practice. This paper demonstrates that under model mismatch, finite-width BNNs outperform their infinite-width limits because their functional priors feature heavy-tailed frequency spectra, giving them the flexibility to capture diverse frequency components that rigid NNGPs cannot.

What Problem Does This Paper Address?

In the infinite-width limit, single-layer BNNs converge to Gaussian Processes (known as NNGPs). This limit is appealing because GP inference is mathematically exact and computationally well-behaved, avoiding the intractable posterior sampling required by finite-width BNNs.

However, empirical deep learning presents a paradox: larger widths often degrade BNN test performance on real-world regression and classification tasks. Researchers lack a clear understanding of why finite-width BNNs generalize better despite having lower parameter capacity, and when enduring the severe computational burden of finite-width MCMC inference is worth the effort.

Methods

The authors analyze one-hidden-layer BNNs with erf and ReLU activations (whose infinite limits correspond analytically to Arcsin and Arccos GP kernels, respectively):

  • Gold-Standard Sampling: Rather than relying on variational approximations, the authors use the No-U-Turn Sampler (NUTS) Hamiltonian Monte Carlo across widths $H \in [2, 200]$ to isolate true Bayesian posterior behavior from approximation artifacts.
  • Log Data Likelihood (LDL): To quantitatively assess inductive bias without intractable marginal likelihood estimators, datasets generated from BNN priors are evaluated under the true data-generating GP likelihood.
  • Discrete Cosine Transform (DCT) Spectral Analysis: Functions sampled from BNN priors and posteriors are transformed into DCT frequency coefficients to examine spectral heavy-tailedness directly.
  • Differentiable Low-Pass Filtering: The authors introduce a function-space prior transformation: functions are mapped to a discrete grid, decomposed via DCT, stripped of their top frequency coefficients ($k \ge (1-t)N_{\text{grid}}$), and reconstructed before computing the likelihood. This allows direct causal testing of whether high-frequency spectral components drive finite-width performance.

Datasets

  • Synthetic GP Datasets: 1D regression tasks sampled from GPs with RBF (lengthscales $l \in \{0.5, 1.0, 1.5, 2.0\}$), Arcsin, and Arccos kernels. Each configuration contains 200 unique functions ($N_{\text{train}} = 21$, $N_{\text{test}} = 100$). Controlled model mismatch occurs whenever the data GP kernel differs from the BNN’s limiting NNGP kernel.
  • Real-World Benchmarks: Standard UCI regression benchmarks—UCI Boston, UCI Energy (evaluating individual outputs), and Sic97—split into 80/10/10 train/validation/test sets.

Key Insights and Ideas

  • Model Mismatch is Crucial: When the BNN's limiting kernel perfectly matches the data-generating GP, the infinite-width NNGP wins. But when there is structural mismatch (e.g., fitting an RBF-generated process with an Arcsin or Arccos prior), finite-width BNNs outperform the limiting NNGP. Greater mismatch produces a wider performance gap.
  • More Diverse Inductive Biases: Finite-width BNNs generate datasets spanning both significantly higher and lower log data likelihoods than NNGPs, showing that finite-width models retain richer, non-Gaussian functional distributions.
  • Heavier-Tailed Frequency Spectra: Spectral analysis reveals that the 97th and 99th percentiles of DCT coefficients are significantly higher in finite-width BNNs than in NNGPs. This heavy-tailed spectrum closely matches the true data-generating distributions.
  • High Frequencies Provide Flexibility: Causal filtering experiments verify that progressively removing high-frequency components from finite-width BNN priors (increasing threshold $t$) steadily degrades test performance ($\Delta\text{MSE}$ increases). The network's capacity to allocate probability mass across non-zero frequencies is what allows it to adapt under mismatch.

Key Results

  • Generalization Under Mismatch: On GP-RBF synthetic data, finite-width BNNs consistently attain lower test MSE ($\Delta\text{MSE} < 0$) and lower negative log-likelihood ($\Delta\text{NLL} < 0$) than the limiting NNGP, monotonically approaching NNGP performance as hidden width $H \to 200$.
  • Real-World Regression: Finite-width BNNs outperform limiting NNGPs across larger real datasets (Sic97 and both dimensions of UCI Energy), confirming that the synthetic mismatch findings transfer to real-world data distributions.
  • Ablation via Low-Pass Filtering: Removing high frequencies via low-pass filtering reverses the finite-width advantage: at filtering threshold $t = 0.97$, the $\Delta\text{MSE}$ of a finite-width ReLU BNN jumps from approximately $-0.05$ (outperforming the NNGP) to $+0.30$ (substantially worse than the NNGP).

Limitations and Future Work

  • Shallow Architecture Focus: The study is primarily limited to single-hidden-layer architectures on one-dimensional or tabular regression tasks to keep exact MCMC inference and grid-based DCT transforms computationally feasible.
  • Inference Scalability: Because exact NUTS inference scales poorly with model size and dimensionality, applying these spectral insights to large-scale deep vision or language models remains challenging.
  • Optimal Width Selection: The paper explains why finite width helps under mismatch, but does not provide an analytical rule to determine the optimal hidden width $H^*$ for an arbitrary dataset size.

Summary updated

BibTeX
@inproceedings{yao2022empirical,
  author = {Jiayu Yao and Yaniv Yacoby and Beau Coker and Weiwei Pan and Finale Doshi-Velez},
  title = {{An Empirical Analysis of the Advantages of Finite v.s. Infinite Width Bayesian Neural Networks}},
  booktitle = {ICBINB @ NeurIPS},
  year = {2022},
  url = {https://openreview.net/forum?id=QNKUyhiZb_O},
}
Figure