A variational autoencoder is a generative model with a latent variable and a learned approximation to its posterior distribution given an observation . Write the model as . A recognition network, implemented as a neural network, produces the parameters of ; a generative decoder specifies . Using one recognition rule across observations is amortized inference, rather than solving a fresh independent optimization problem for every input.[ref]
Auto-Encoding Variational Bayes by Diederik P. Kingma and Max Welling. §2.1–2.3, generative and recognition models; Introduction, neural-network recognition model
Training maximizes an evidence lower bound, often writtenThe first term scores reconstruction under the declared likelihood; the second compares the inferred latent law with the prior. The identityproves that it is a lower bound, since Kullback-Leibler divergence is nonnegative. It becomes tight when the recognition law equals the model posterior, under the usual density/support conditions.[ref]
For a one-dimensional Gaussian example, let the prior be and the recognition law be . Substituting their log densities and using givesAt , , this is . The value is a penalty for this particular latent law, not the whole training loss. Gaussian reparameterization writes with fixed-law standard-normal noise so that gradients can pass through the sampled latent value. After training, generation instead draws from the prior and then the generative decoder; it need not start from an observed input.
A generative decoder maps a latent variable to the parameters of a conditional observation probability distribution, commonly written . In a variational autoencoder, a neural network can supply those parameters. The conditional law, including its observation noise and support, is part of the model; the decoder need not return one deterministic reconstructed observation.[ref]
Stochastic Backpropagation and Approximate Inference in Deep Generative Models by Danilo Jimenez Rezende and others. §2, visible-layer distribution and generative transformations
For a concrete binary example, suppose a decoder specifies two conditionally independent Bernoulli distributions with probabilities and . ThenIf a chosen latent value gives , the conditional probability of is , and its negative log likelihood is approximately . The vector is a vector of probabilities, not itself a binary sample. A model for continuous observations would need a different conditional distribution.[ref]
Auto-Encoding Variational Bayes by Diederik P. Kingma and Max Welling. Appendix C.1–C.2, Bernoulli and Gaussian observation models
Generation draws a latent value from the prior and then draws from the decoder's conditional law. Averaging over latent values givesConditional independence of output components at fixed need not imply independence after this marginalization, because the same latent variable can influence several components. The recognition network runs in the other direction for inference; it is not an algebraic inverse of the generative decoder.
A recognition network is a learned mapping from observed data to parameters of an approximate posterior distribution over latent variables. In a variational autoencoder, it specifies , while the generative decoder specifies the opposite conditional direction . The recognition network supports amortized inference; it need not coincide with the exact posterior of the learned generative model.[ref]
Auto-Encoding Variational Bayes by Diederik P. Kingma and Max Welling. §3 and Appendix C, neural-network recognition model
For a scalar Gaussian recognition law, the neural network can output a mean and log variance . Thenwhere is parameter-independent noise. Exponentiating the log variance ensures a positive variance, and the factor converts it to the standard deviation used in Gaussian reparameterization.[ref]
Auto-Encoding Variational Bayes by Diederik P. Kingma and Max Welling. Appendix C.2, Gaussian output mean and log variance
For an original calculation, suppose one input gives and . The recognition variance is4 and its standard deviation is2. A noise draw gives , while the posterior mean supplied by the same network remains1. Confusing log variance with log standard deviation would instead produce the wrong scale.
A deterministic network evaluation and a random latent sample are distinct steps. Re-evaluating the same fixed network on the same input returns the same distribution parameters; new noise draws can still yield different values. Returning only the mean omits the uncertainty represented by that distribution. Its adequacy must be assessed against the intended inference problem, not inferred merely from the fact that it outputs a positive variance.
Articles by others on the same topic
A Variational Autoencoder (VAE) is a type of generative model that is used in unsupervised machine learning tasks to learn the underlying structure of data. It combines principles from probabilistic graphical models and neural networks. Here are the key components and ideas behind VAEs: ### Structure A VAE typically consists of two main components: 1. **Encoder (Recognition Model)**: This part of the VAE takes input data and encodes it into a lower-dimensional latent space.