Paper commentary
Variational Inference with Normalizing Flows
Normalizing flows turn a simple Gaussian into a richer variational posterior
- Problem Simple posterior families such as mean-field cannot match the true posterior, even asymptotically. Richer families like mixtures are costly to scale, because each component needs its own likelihood evaluation and gradient.
- Method Normalizing flows push a simple Gaussian through a chain of invertible maps. Planar and radial maps are cheap to compute and let the posterior become more complex with each step.
- Results On binarised MNIST, flow length 80 gave a negative log-probability of at most 85.1. NICE reached at most 87.2 at the same length.
Why simple posterior families cap variational inference
Variational inference replaces an intractable posterior with a family of simpler distributions and searches that family for the closest member. Common families such as mean-field approximations can't contain the true posterior, so even the asymptotic regime stays out of reach. The gap has practical costs, since posterior variance tends to be under-estimated and a limited posterior can bias the MAP estimates of model parameters.
Richer approximations have helped in practice, as deep autoregressive networks did when compared to sigmoid belief networks with mean-field approximations.
Structured mean-field and mixture posteriors add flexibility, but mixtures are costly to scale. Each mixture component needs its own likelihood evaluation and gradient at every parameter update, which hurts scalability. So the authors look for a flexible posterior family that keeps the cost of amortized inference.
How a chain of invertible maps builds a posterior
The key idea is to start from a simple density, such as an independent Gaussian, and push its samples through a chain of invertible maps. Each map changes the density by a Jacobian term, so the result stays a valid probability density at every step. The number of maps, the flow length K, sets how complex the posterior can become.
After K maps the log-density follows the change-of-variables rule, with one log-determinant term per step.
The planar flow uses the form f(z) = z + u h(w^T z + b), with a smooth element-wise nonlinearity h. The matrix determinant lemma reduces its log-determinant to a term of the form ln|1 + u^T psi(z)|, which costs O(D). Planar maps contract and expand the density in the direction perpendicular to the hyperplane w^T z + b = 0. The radial flow instead uses f(z) = z + beta h(alpha, r)(z - z0), with h = 1/(alpha + r), so it contracts or expands around a reference point z0.
Its determinant is also computable in linear time.
In the paper's illustration, two successive transformations turn a spherical Gaussian into a bimodal density. Not every parameter setting gives an invertible map, and the conditions for invertibility are handled in the appendix.
Infinitesimal flows and the asymptotic claim
The authors also consider the limit in which the flow length goes to infinity, which they call an infinitesimal flow. Such a flow is described by a partial differential equation for how the initial density evolves over time. Under the Langevin stochastic differential equation, the stationary density is proportional to exp(-L(z)), where L is an unnormalised log-density.
The argument is that samples from such a flow converge to the true posterior, so the posterior family can in principle contain it. The authors count this as overcoming a commonly cited limitation of variational inference. The Hamiltonian flow works on an augmented space of latent variables and auxiliary variables, with a Hamiltonian built from L and a quadratic term.
The authors state that making these statements rigorous is future work.
How the flow enters the bound and the training loop
For amortized inference, an inference network maps each observation x to the parameters of the initial Gaussian q0 and to the flow parameters lambda. The flow appears only in the last term, the log-determinant sum, which enters with a minus sign.
Training draws a mini-batch, samples z0 from q0, pushes it through the K maps, and evaluates the bound. Gradients reach both the generative parameters and the inference parameters in one computational graph. The updates use a preconditioned method such as RMSprop or AdaGrad.
The paper puts the cost of sampling and computing the log-det-Jacobian terms at O(LN^2) + O(KD). Here L is the number of deterministic layers, N the average hidden size, K the flow length and D the latent dimension. So the cost grows linearly with flow length, and the authors describe the overall algorithm as at most quadratic.
The experiments anneal the bound with an inverse temperature beta_t = min(1, 0.01 + t/10000), which the authors found gave better results. Each step uses one latent sample per data point, and the conditional networks have deterministic layers of 400 hidden units with Maxout.
Do longer flows fit known 2D densities?
To test representational power, the authors define four unnormalised 2D densities with multimodality and periodicity. They compare a planar flow with flow lengths 2, 8 and 32 against NICE on the same targets. Each experiment was repeated 100 times with different seeds, and averaged scores with standard errors are reported.
The planar flow starts from a diagonal Gaussian and uses h(z) = tanh(z) in the mapping. The authors report a substantial improvement in approximation quality as the flow lengthens.
NICE and the planar flow may reach the same asymptotic performance, but the planar flow needs far fewer parameters. The authors attribute this to the planar flow learning all of its parameters, while NICE's mixing step is randomly set rather than learned. For NICE they saw no substantial difference between random orthogonal and random permutation mixing.
Image results on MNIST and CIFAR-10
On binarised MNIST the authors train DLGMs with 40 latent variables for 500,000 parameter updates. They compare the planar flow with NICE on the same model at several flow lengths. The bound improves as the flow lengthens, and the KL divergence to the true posterior falls. The true marginal likelihood is estimated by importance sampling with 200 samples from the inference network.
The planar flow reaches at most 87.5 at length 10 and at most 85.1 at length 80. NICE reaches at most 88.6 at length 10 and at most 87.2 at length 80, so the planar flow scores better at each length shown. Because the model is the same, the authors attribute the gap to the posterior family.
These come from a different model specification and were not re-measured here.
On CIFAR-10 patches the authors use 30 latent variables and a logit-normal observation likelihood. The reported -lnp(x) values are -293.7 at K = 0, -308.6 at K = 2, -317.9 at K = 5 and -320.7 at K = 10. Each value is the negative of a log-probability, so the fall from -293.7 to -320.7 means the log-probability rose. This CIFAR table compares only flow lengths, with no NICE or HVI baseline.
Limitations
The reported experiments use finite flows only: the planar and radial families and NICE. The asymptotic-recovery claim for infinitesimal flows is therefore argued rather than tested.
The Hamiltonian variational approach needs one or more likelihood and gradient evaluations per iteration, at training and at test time. NICE's mixing components are random and not learned, while the planar flow learns all of its parameters. The image experiments fix one DLGM per dataset, with 40 latent variables on MNIST and 30 on CIFAR-10 patches.
Invertibility conditions are worked out in the appendix rather than the main text. Other transformation designs, for example for constrained supports, are left for future work.
Paper info
- Authors
- Danilo Jimenez Rezende, Shakir Mohamed
- Venue
- arXiv · Preprint
- First published
- 2015-5-21
- Added
- 2026-11-6
- Updated
- 2016-6-14
- Version
- v6
- arXiv
- 1505.05770
- Category
- stat.ML · cs.AI · cs.LG · stat.CO · stat.ME
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Danilo Jimenez Rezende, Shakir Mohamed (2015). Variational Inference with Normalizing Flows. arXiv:1505.05770v6. https://arxiv.org/abs/1505.05770v6
BibTeX
@misc{rezende2015variational,
title = {{Variational Inference with Normalizing Flows}},
author = {Danilo Jimenez Rezende and Shakir Mohamed},
year = {2015},
eprint = {1505.05770},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1505.05770v6}
}