NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learnable Explicit Density for Continuous Latent Space and Variational Inference

Chin-Wei Huang, Ahmed Touati, Laurent Dinh, Michal Drozdzal, Mohammad Havaei, Laurent Charlin, Aaron C. CourvillearXiv 2017

TL;DR

Standard Variational Autoencoders (VAEs) often generate blurry samples because they rely on overly simplistic Gaussian distributions for their priors and posteriors. This paper introduces a unified framework that makes both the prior and posterior highly flexible using normalizing flows, proving mathematically that inverse autoregressive flows can universally approximate any posterior while demonstrating that a learnable prior significantly eases the inference process.

What Problem Does This Paper Address?

Variational Autoencoders (VAEs) are powerful generative models, but they frequently underperform compared to alternatives like GANs or autoregressive models when it comes to sample sharpness. A core reason for this is the standard practice of using simple, independent (factorial) Gaussian distributions for both the latent prior $p(z)$ and the approximate posterior $q(z|x)$.

This oversimplification introduces two major issues:

  1. Mathematical Mismatch: The true data distribution often projects onto a complex, multi-modal shape in the latent space. Forcing the prior to be a simple Gaussian creates a mismatch with the aggregated posterior, meaning the model risks sampling from "untrained" regions of the latent space during generation.
  2. Inference Limitations: If the approximate posterior $q(z|x)$ isn't flexible enough to match the true posterior $p(z|x)$, the marginal log-likelihood cannot be fully optimized, leading to an overestimation of data entropy and resulting in blurry images.

Methods

The authors propose a Learnable Explicit Density (LED) VAE framework that removes the Gaussian restriction from both sides of the latent space using normalizing flows (invertible neural networks that transform simple distributions into complex ones via the change-of-variables formula).

  • For the Prior: They employ Real Non-Volume Preserving (Real NVP) transformations ($h: z_0 \rightarrow z$). This allows the prior to warp and mold itself around the aggregated data points projected into the latent space.
  • For the Posterior: They utilize Inverse Autoregressive Flows (IAF) ($g: z' \rightarrow z$). Crucially, the authors provide a formal mathematical proof showing that under autoregressive assumptions, these flows act as universal approximators for any continuous probability density.

By modifying the Evidence Lower Bound (ELBO) objective function, they jointly train these invertible transformations alongside the standard encoder and decoder networks.

Datasets

The proposed method was evaluated on two benchmarks:

  1. Mixture of Bivariate Gaussians: A synthetic, multi-modal toy dataset used to visually inspect how well the model maps complex data distributions in the latent space.
  2. Binarized MNIST: The standard handwritten digit dataset, used to quantitatively evaluate the generative performance via estimated negative log-likelihood (NLL).

Key Insights and Ideas

  • Priors Simplify Posteriors: One of the most elegant insights is that updating the prior actually makes the posterior easier to model. Because the true posterior is proportional to the prior ($p(z|x) \propto p(x|z)p(z)$), reshaping the prior to fit the aggregate posterior reduces the regions of high density that the approximate posterior fails to cover.
Figure 1. Effect of prior on posterior. Matching the prior p(z) with the marginal approximate posterior Ex[q(z|x)] makes the true posterior p(z|x) easier to model, since it pushes the true pos- terior to be closer to the approximate posterior.
  • Asymmetric Optimization Dynamics: The authors discover that models with a flexible prior are significantly easier to train than those with only a flexible posterior. Learning the posterior relies on a "zero-forcing" reverse KL divergence, which easily gets stuck in local minima if the true posterior is multimodal. Conversely, learning the prior acts like a "zero-avoiding" forward KL divergence, making it much more robust during training.

Key Results

On the toy dataset, the LED VAE successfully warped a simple base distribution into a complex, multi-modal shape that perfectly matched the true data distribution.

Figure 2. Fitting a Gaussian mixture distribution. E[·] indicates marginalization over the data x ∼pD(x). Clockwise from top left: projection of data distribution pD(x) onto the prior space E(q(z|x)), and the base distribution space E(q(z0|x)); density maps of the base distribution p(z0), the transformed prior p(z) and and marginal model distribution p(x).

On binarized MNIST, the quantitative results clearly demonstrated the superiority of flexible priors:

  • Prior vs. Posterior Complexity: As shown in the ResConv architecture results from Table 1, increasing the number of prior layers ($L_{prior} = 12$) yielded a significantly better NLL of 81.44 compared to a baseline VAE (83.11). This easily outperformed simply adding complexity to the posterior ($L_{post} = 12$), which only achieved 88.70 in the MLP setting.
  • Combined Synergy: The best performance was achieved by scaling both simultaneously. Combining a 16-layer NVP prior with a 16-layer MADE posterior pushed the NLL down to 80.60 (Table 2).
Table 1. Effect of increasing prior complexity. Lpost: number of MADE layers used for posterior. Two hidden layers of 512 nodes were used for each layer of transformation. Lprior: number of NVP layers used for prior. One hidden layer of 100 nodes was used for each layer of transformation. For multi-layer perceptron, two hidden layers with 200 nodes were used and the dimension of the latent variable is 50. Rectifier is used as non-linear activation. For Residual ConvNet, we have 3 layers of residual strided convolu- tion (He et al., 2015) with [16,32,32] feature maps, using filter of size 3×3. Before the stochastic layer a hidden layer of 450 nodes is used. The dimension of the latent variable is 32. We use exponential linear units (Clevert et al., 2015) as non-linearity.
Table 2. Effect of increasing both prior and posterior complexity.

Limitations and Future Work

While the theoretical foundations and toy examples are compelling, the authors note that experiments on larger, more complex image datasets (like CIFAR-10 or ImageNet) were left for future work. Additionally, their proof regarding IAF implies that the commonly used affine coupling laws have inherent structural limitations. They suggest that designing even more sophisticated, non-affine invertible functions will be a crucial next step in achieving truly exact approximate inference.

Summary updated

BibTeX
@misc{huang2017learnable,
  author = {Chin-Wei Huang and Ahmed Touati and Laurent Dinh and Michal Drozdzal and Mohammad Havaei and Laurent Charlin and Aaron C. Courville},
  title = {{Learnable Explicit Density for Continuous Latent Space and Variational Inference}},
  year = {2017},
  eprint = {1710.02248},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.02248},
}
Figure