Model Selection for Bayesian Autoencoders
- Bayesian Deep Learning
- Generative Modeling
- Uncertainty Quantification
We select Bayesian autoencoder weight priors by matching their output distributions to data, then combine posterior sampling with latent density estimation for generation.
Paper NeurIPS 2021
- EURECOM
- CSIRO's Data61, Australian National University & University of Sydney
A Bayesian autoencoder (BAE) places uncertainty over its encoder and decoder weights, making the weight prior a central modeling choice. We choose that prior by matching the distribution of its outputs to reference images, then infer the weights and fit a density model in the learned latent space. Across small image datasets, this improves reconstruction scores and generated samples relative to standard weight priors and several autoencoder baselines.
Making prior knowledge visible
The nonlinear encoder–decoder mapping makes a Gaussian weight prior difficult to interpret. Standard normal weights produce noise-like images; optimized priors produce recognizable structure, including for out-of-distribution inputs.

We use independent Gaussian weights and biases, sharing their means and variances within each layer :
These layerwise parameters form . Reparameterized samples let gradients reach through both networks and the observation likelihood. For reconstruction, the targets equal the inputs . We write distributions over reconstruction targets with conditioning on these inputs left implicit.
Our functional-prior study matches neural-network function samples to a Gaussian-process prior.
Matching distributions through one-dimensional projections
Empirical Bayes motivates selecting through the marginal , which integrates over weights and network outputs. For a fixed data distribution , maximizing expected log marginal likelihood is equivalent to minimizing Kullback–Leibler (KL) divergence:
Both density evaluation and empirical KL estimation are difficult here. We use distributional sliced-Wasserstein distance as a sample-based surrogate:
Here projects each distribution along the unit direction , and measures the Wasserstein distance between the resulting one-dimensional distributions. The admissible direction distributions satisfy a constraint, controlled by , that encourages directional diversity. Sorting projected samples gives the one-dimensional transport cost. A learned mapping searches for informative directions while the prior parameters minimize their discrepancy. Model samples include likelihood noise after the autoencoder output. The implementation uses 1,000 projections and 32 prior weight samples per input.
Posterior inference and latent density estimation
After prior optimization, stochastic gradient Hamiltonian Monte Carlo approximates the weight posterior. We retain 32 samples after burn-in and thinning. To generate images, we fit a Dirichlet process mixture to posterior-mean encoder representations. Its mixture complexity adapts to the data. Generation then uses
This supplies an explicit sampling distribution over latent codes and averages decoder uncertainty when producing an image.

Transferring information through the prior
On MNIST, 100 zero digits specify the prior, while posterior inference uses digits one through nine. On Frey–Yale, 1,956 Frey faces specify the prior and Yale faces support inference. These settings test information transfer separately from pooling both datasets for training.


Generating faces with limited observations
CelebA experiments reserve 1,000 images for prior selection and use 500–4,000 for inference, with four random splits. Images have resolution and typically 50 latent dimensions. Predictive reconstruction log-likelihood measures reconstruction and uncertainty; Fréchet Inception Distance (FID) evaluates generated-image distributions using 10,000 samples. DiffAugment-GAN achieves lower mean FID at every tested budget; that baseline also uses StyleGAN2 and differentiable augmentation.


Prior selection and posterior tempering
MNIST ablations distinguish changing prior structure from increasing likelihood weight through posterior tempering. At temperature , tempering raises the likelihood to the power while retaining the prior. The optimized prior retains predictive variation as reference data increase, and its best tested reconstruction score occurs at , the ordinary Bayesian posterior.

