Recognition network 2026-11-05
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]
For a scalar Gaussian recognition law, the neural network can output a mean and log variance . Then
where 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]
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.
Variational autoencoder 2026-11-05
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]
Training maximizes an evidence lower bound, often written
The first term scores reconstruction under the declared likelihood; the second compares the inferred latent law with the prior. The identity
proves 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 gives
At , , 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.