Bayesian Numerical Integration with Neural Networks

Katharina Ott, Michael Tiemann, Philipp Hennig, Francois-Xavier Briol

TL;DR

Bayesian Quadrature provides uncertainty-aware numerical integration but scales poorly due to the cubic computational cost of Gaussian processes. Bayesian Stein Networks (BSNs) solve this by pairing a neural network featuring a physics-inspired diffusion Stein layer with a lightweight Laplace approximation. This allows the network's integral to be tracked by a single scalar parameter, achieving orders-of-magnitude speedups and scaling to sample sizes where Gaussian processes fail.

What Problem Does This Paper Address?

Computing the expectation of a function $f$ under a probability distribution $\Pi$, $\Pi[f] = \int_{\mathcal{X}} f(x)\pi(x)dx$, is foundational across machine learning, physics, and Bayesian inference.

Standard Monte Carlo (MC) methods are asymptotically unbiased but converge slowly at a rate of $\mathcal{O}(n^{-1/2})$, making them impractical when evaluating $f$ involves expensive simulations (e.g., fluid dynamics or climate models). Bayesian Quadrature (BQ) drastically improves sample efficiency by fitting a Gaussian process (GP) prior to $f$. However, BQ faces steep hurdles:

  1. Poor scalability: Inverting kernel matrices costs $\mathcal{O}(n^3)$ in computation and $\mathcal{O}(n^2)$ in memory.
  2. Analytical intractability: Computing the integral in closed form requires tractable kernel integrals against $\pi$, which fails for arbitrary or unnormalized densities (such as Bayesian posteriors).

While Bayesian neural networks (BNNs) scale far better to high dimensions and larger sample sizes, analytically integrating a standard BNN's posterior mean is intractable.

Methods

The authors introduce Bayesian Stein Networks (BSNs), combining three core components:

  • Diffusion Stein Layer: By definition, a Stein operator $\mathcal{S}_m$ maps any regular vector-valued function $u$ to a zero-mean function under $\pi$, i.e., $\Pi[\mathcal{S}_m[u]] = 0$. The BSN architecture is defined as: $$g_\theta(x) = \mathcal{S}_m[u_{\theta_u}](x) + \theta_0$$ where $u_{\theta_u}$ is a standard deep neural network and $\theta_0 \in \mathbb{R}$. Taking expectations yields $\Pi[g_\theta] = \theta_0$. Thus, training the network to fit $f$ automatically fits the scalar $\theta_0$ to $\Pi[f]$.

  • Score-Only Dependence: The diffusion Stein operator requires only the score $\nabla_x \log \pi(x)$, enabling BSNs to integrate over unnormalized densities without computing normalization constants.

  • Laplace Uncertainty Quantification: The network is trained using regularized MSE (MAP estimation). A Generalized Gauss-Newton (GGN) Laplace approximation provides a Gaussian distribution over the weights, directly yielding a calibrated marginal posterior variance over $\theta_0 \approx \Pi[f]$.
  • Optimization Tailoring: Because the Stein operator introduces derivative terms that sharpen the loss landscape, standard first-order optimizers (like Adam) converge slowly. The authors found that continuously differentiable CELU activations combined with second-order L-BFGS optimization dramatically improve convergence and stability.

Datasets

The authors evaluated BSN on three distinct benchmarks:

  1. Genz Benchmark Functions: Six standard synthetic test integrands (Continuous, Discontinuous, Gaussian Peak, Corner Peak, Oscillatory, Product Peak) transformed to $\mathbb{R}^d$ and integrated against standard Gaussian densities for dimensions up to $d=20$.
  2. Goodwin Oscillator: A 4-dimensional nonlinear ODE describing mRNA and protein feedback dynamics. The task involves inferring posterior parameter expectations from an unnormalized posterior distribution conditioned on 2,400 synthetic observations.
  3. Wind Farm Layout Design Model: A real-world engineering problem using a low-order fluid dynamics wake model to evaluate expected turbine thrust coefficients, where evaluations take ~130 seconds each over truncated Gaussian and Gaussian mixture parameters.

Key Insights and Ideas

  • Integration by Construction: Rather than integrating an arbitrary trained model after the fact, the Stein layer enforces zero-mean constraints so that the integral is explicitly represented by a network bias parameter ($\theta_0$).
  • Closing the Intermediate Regime: BQ works well for very few points ($n < 10^3$) and MC excels for massive budgets ($n > 10^6$). BSN fills the critical middle ground ($10^3 \le n \le 10^5$), delivering high sample efficiency where GP memory limits are breached.
  • Unnormalized Target Handling: Unlike standard BQ, BSN does not require an analytical double-integral of the GP covariance against the prior, unlocking tasks where $\pi$ is an unnormalized posterior from MCMC.

Key Results

  • Genz Benchmarks: For $d=2$ and $n=5,120$, BSN outperformed MC by up to two orders of magnitude (e.g., Continuous Genz relative error of $1.11 \times 10^{-5}$ vs. $1.59 \times 10^{-3}$). On the discontinuous Genz test, BSN surpassed BQ ($2.56 \times 10^{-3}$ vs. $1.12 \times 10^{-2}$).
  • Memory & Dimension Scalability: In $d=20$, both BQ and Stein Control Functionals crashed due to exceeding the 20 GB cluster memory limit near $n \approx 10^4$. BSN scaled smoothly beyond $n = 10^5$ with near-constant memory footprint.
  • Goodwin Oscillator: BSN outperformed or matched MALA sampling on parameter posterior expectations without needing to normalize the posterior density.
  • Wind Farm Simulation: BSN provided accurate estimates with negligible overhead relative to simulation runtime, providing calibrated Laplace uncertainty bounds where BQ failed because closed-form kernel integration was impossible for truncated Gaussian priors.

Limitations and Future Work

  • Prior Specification: Unlike GPs, where properties like periodicity or length-scales are easily embedded into covariance kernels, engineering functional inductive biases into BNN priors remains difficult.
  • Theoretical Rates: While asymptotic consistency can be shown, explicit finite-sample convergence rates for BSNs remain an open theoretical question.
  • Architectural Scaling: Full-batch L-BFGS limits the network size to relatively small architectures (e.g., 2 hidden layers with 32 units). Extending BSNs to larger networks via stochastic mini-batching without losing optimization stability is a major avenue for future research.

Summary updated

BibTeX
@inproceedings{ott2023bayesian,
  author = {Katharina Ott and Michael Tiemann and Philipp Hennig and Francois-Xavier Briol},
  title = {{Bayesian Numerical Integration with Neural Networks}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2023},
  url = {https://openreview.net/forum?id=d8xcdyUA6S},
}
Figure