Revisiting the Equivalence of Bayesian Neural Networks and Gaussian Processes: On the Importance of Learning Activations

Marcin Sendera, Amin Sorkhei, Tomasz Kuśmierczyk

TL;DR

Imposing Gaussian Process (GP) function-space priors onto Bayesian Neural Networks (BNNs) traditionally requires either restrictive analytical derivations or deep heuristics that break theoretical convergence guarantees. This paper shows that learning parametric activation functions alongside simple Gaussian weight priors allows shallow, single-hidden-layer BNNs to accurately match arbitrary GP priors. Leveraging closed-form 2-Wasserstein optimization, trainable periodic activations for stationarity, and hypernetwork-based conditioning, the approach matches GP priors while enabling fast, scalable posterior inference.

What Problem Does This Paper Address?

While Gaussian Processes (GPs) provide interpretable, expressive function-space priors (e.g., smoothness, periodicity), their exact posterior inference scales cubically ($\mathcal{O}(N^3)$) with dataset size. Conversely, Bayesian Neural Networks (BNNs) scale well to large datasets and integrate neatly into deep learning pipelines, but their weight-space priors are notoriously difficult to specify and interpret.

Although infinitely wide BNNs converge to GPs via the Central Limit Theorem (CLT), solving the inverse problem—configuring a BNN to replicate a specific, desired GP prior—remains a major challenge:

  1. Analytical solutions (like Meronen et al., 2020 for the Matérn kernel) often require binary white-noise weight priors, making posterior inference (via MCMC or VI) virtually intractable.
  2. Gradient-based weight matching (like Tran et al., 2022) relies on deep architectures and complex Normalizing Flow (NF) priors across weights. Assigning distinct NF priors to each parameter violates CLT exchangeability assumptions, turning the model into an unstable heuristic that degrades when the network is made wider and fails on out-of-distribution (OOD) data.

Methods

The authors propose matching wide, shallow BNN priors to GP priors by learning both weight prior variances and parameterized activation functions:

GP Prior p_gp(f(X))  <--- [Minimize closed-form 2-Wasserstein divergence] --->  BNN Prior p_nn(f^l(X | λ))
                                                                                      |
                                                                        Parameters λ = {σ_w, σ_b, η_activation}
  • Closed-Form 2-Wasserstein Objective: Because wide BNN pre-activations and GPs both follow multivariate Gaussian distributions over finite input sets $X$, the 2-Wasserstein metric has an exact, closed-form solution. This eliminates unstable adversarial/inner minimax optimization.
  • Learnable Activation Functions: Instead of fixed activations (e.g., ReLU, TanH), the network uses flexible, parameterized activations $\phi(\cdot \mid \eta)$—implemented via small neural networks (5–10 hidden units), Rational/Padé functions, or Piecewise Linear (PWL) functions.
  • Trainable Periodic Activations for Global Stationarity: Standard BNNs only match stationary GP behavior locally inside the training domain. By parameterizing activations as finite Fourier sums, $\phi(x) = \sum_{k=1}^K [A_i \cos(2\pi \psi_i x) + A_j \sin(2\pi \psi_j x)]$, the BNN enforces translation invariance and global stationarity by construction.
  • Hypernetwork Conditioning for Model Selection: Rather than fixing GP hyperparameters (like lengthscale $\ell$) upfront, an MLP hypernetwork predicts the BNN's prior variances and activation parameters directly from the GP hyperparameters. This allows researchers to tune hyperparameters using marginal likelihood / ELBO maximization during downstream inference.

Datasets

The authors evaluate their method across multiple benchmarks:

  • Synthetic 1D & 2D Tasks: 1D regression with RBF, Matérn-5/2, and Periodic kernels; 2D classification for uncertainty decomposition (aleatoric vs. epistemic).
  • UCI Regression Benchmarks: Five standard tabular datasets with input dimensions $d \in [8, 12]$: Boston ($d=12$), Concrete ($d=8$), Energy ($d=8$), Protein ($d=9$), and Wine ($d=11$).
  • UCI Household Electric Power Consumption (HouseElectric): A massive dataset (~2 million points) standard for testing scalable GP inference, split into 7/9 training and 2/9 test sets.

Key Insights and Ideas

  • Activations Matter More Than Depth: Adding layers to match functional priors is counterproductive. A single-hidden-layer BNN with learned activations outperforms deep BNNs with fixed activations, preserving theoretical CLT convergence while simplifying the posterior landscape.
  • Normalizing Flow Priors on Weights Are Fragile: While deep BNNs with NF priors achieve good in-distribution scores, making them wider destroys their performance (e.g., in 1D regression, TanH NF prior test RMSE degrades from $0.28$ at width 50 to $0.89$ at width 1024), and their uncertainty estimates deteriorate significantly out-of-distribution.
  • Local vs. Global Stationarity: Standard learned activations overfit to the bounding box of the input training points. Trainable periodic Fourier activations resolve this, keeping divergence constant across large spatial shifts.
  • Simple Weight Priors Enable Scalable VI: Because weights retain zero-centered Gaussian priors with learned variances, posterior inference scales effectively to millions of points using RealNVP-based Stochastic Variational Inference (SVI).

Key Results

  • 1D Regression Prior Fidelity: On an RBF kernel target, the proposed shallow BNN achieved a 2-Wasserstein divergence of 7.06, compared to 7.77 (Gaussian prior), 8.37 (Hierarchical prior), and 8.09 (Normalizing Flow prior) for deep 3-layer BNN baselines.
  • UCI Regression: Across Boston, Concrete, Energy, Protein, and Wine datasets, a single-layer BNN (width 128) with learned activations matched or outperformed deep multi-layer baselines (e.g., Boston test RMSE: $2.8348$ vs. $2.8402$).
  • Scaling on HouseElectric (~2M Points): Combining hypernetwork-conditioned priors with RealNVP posterior inference achieved Test RMSE 0.0535 and NLL -1.5155, outperforming Stochastic Variational GP (SVGP: RMSE 0.0566, NLL -1.4600). Posterior inference finished in ~2 hours on a single GPU, compared to over 3 days for exact GP.
  • OOD Robustness: Under input shifts up to $\pm 50$ units outside the training interval $[-3, 3]$, periodic activations maintained a 2-Wasserstein divergence below $0.0125$, whereas standard MLP activations exceeded $1000$.

Limitations and Future Work

  • Optimization Unidentifiability: The mapping from activations to covariance is non-unique (e.g., sign symmetry $\phi(-f)$ vs. $\phi(f)$ and scaling ambiguities). Poor initialization can occasionally cause the prior optimizer to get trapped in suboptimal local minima, requiring a restart.
  • Multi-Output / Multivariate Extensions: While the authors outline conceptual paths for multi-task and vector-valued GP matching (such as shared hidden representations or independent parallel BNNs), empirical validation remains focused on single-output regression and classification.
  • Pre-training Overhead: Fitting the prior requires a preliminary optimization step (~1 hour on CPU/GPU for complex kernels), though this cost can be amortized by pre-computing a shared library of functional priors.

Summary updated

BibTeX
@inproceedings{sendera2025revisiting,
  author = {Marcin Sendera and Amin Sorkhei and Tomasz Kuśmierczyk},
  title = {{Revisiting the Equivalence of Bayesian Neural Networks and Gaussian Processes: On the Importance of Learning Activations}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2025},
  url = {https://openreview.net/forum?id=AligBAsYWE},
}
Figure