πVAE: a stochastic process prior for Bayesian deep learning with MCMC

Swapnil Mishra, Seth R. Flaxman, Tresnia Berah, Harrison Zhu, Mikko S. Pakkanen, Samir BhattStat. Comput 2022

Introduction

Stochastic processes, particularly Gaussian Processes (GPs), represent the gold standard for modeling uncertainty in functions. However, their practical application is often hindered by two significant challenges: cubic scalability ($O(n^3)$) relative to the number of data points and the extreme difficulty of performing fully Bayesian inference in high-dimensional, highly correlated parameter spaces. While deep learning offers scalability, it frequently lacks the rigorous uncertainty quantification inherent in stochastic processes.

This paper introduces πVAE (prior encoding variational autoencoder), a framework designed to bridge this gap. By encoding complex function priors into a low-dimensional latent space, πVAE enables efficient, fully Bayesian inference via Markov Chain Monte Carlo (MCMC), achieving state-of-the-art performance in spatial interpolation while remaining computationally tractable.

The πVAE Framework

The core innovation of πVAE is a two-stage approach that decouples the learning of a function prior from the subsequent Bayesian inference.

Stage 1: Prior Encoding

In the first stage, a specialized Variational Autoencoder (VAE) is trained to learn a specific class of functions. Inspired by the Karhunen-Loève expansion, the model decomposes a function into a set of learnable basis functions—represented by a neural network feature map $\Phi(s)$—and a latent weight vector $\beta$. The VAE learns to compress these function realizations into a low-dimensional, approximately uncorrelated latent space $Z$.

The πVAE training architecture, showing the encoding of function realizations into a latent space and their subsequent reconstruction.

Unlike standard VAEs, πVAE defines a valid stochastic process. It can be evaluated at any arbitrary input location $s$, making it suitable for continuous spatial and temporal modeling rather than being restricted to a fixed grid.

Stage 2: Bayesian Inference

Once the prior is encoded, the encoder is discarded. The decoder serves as a fixed, differentiable prior for new data. Because the latent space $Z$ is low-dimensional (typically $<50$) and well-behaved due to the VAE's KL-penalty, off-the-shelf MCMC tools like Stan can sample the posterior extremely efficiently. This allows for rigorous uncertainty estimation that is often impossible with traditional GP methods on large datasets.

Experimental Evaluation and Results

The authors evaluated πVAE across several benchmarks, including simulated 1-D regression, Log-Gaussian Cox Processes, and large-scale real-world datasets like East Africa Land Surface Temperature (~89,000 locations) and Kin40K.

Key Findings

  • Spatial Interpolation: On the East Africa temperature data, πVAE achieved a Test MSE of 0.38, significantly outperforming full-rank GPs (2.47) and low-rank GMRFs (4.36).
  • Uncertainty Quantification: Qualitative results on tasks like MNIST completion demonstrated that πVAE successfully captures epistemic uncertainty, showing higher variance in regions with missing data.
  • Efficiency: While the initial training of the prior is computationally intensive, the subsequent MCMC inference step is remarkably fast, often taking only seconds or minutes.
A visualization of the Bayesian inference results, showing the posterior mean and 95% credible interval fitting a set of observations.

Discussion and Future Work

πVAE demonstrates that deep learning can be used to "learn" MCMC-friendly priors for complex stochastic processes. By forcing the latent space to follow a standard normal distribution, the authors create a posterior surface that is highly conducive to Hamiltonian Monte Carlo (HMC) sampling.

However, the approach has limitations. The upfront cost of training the prior is high, and the model's performance is inherently tied to the quality and relevance of the encoded prior. Future work will focus on extending the framework to higher-dimensional input spaces ($>10$) and exploring a broader range of stochastic processes, such as Dirichlet processes, within the πVAE architecture.

Summary updated

BibTeX
@article{mishra2022vae,
  author = {Swapnil Mishra and Seth R. Flaxman and Tresnia Berah and Harrison Zhu and Mikko S. Pakkanen and Samir Bhatt},
  title = {{πVAE: a stochastic process prior for Bayesian deep learning with MCMC}},
  journal = {Stat. Comput},
  year = {2022},
  doi = {10.1007/s11222-022-10151-w},
}
Figure