= Recognition network
{title2=$q_\phi(z\mid x)$}
A \b[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 $q_\phi(z\mid x)$, while the <generative decoder> specifies the opposite conditional direction $p_\theta(x\mid z)$. The recognition network supports <amortized inference>; it need not coincide with the exact posterior of the learned <generative model>.<Auto-Encoding Variational Bayes by Diederik P. Kingma and Max Welling>[§3 and Appendix C, neural-network recognition model]{ref}
For a scalar Gaussian recognition law, the <neural network> can output a mean $\mu_\phi(x)$ and log variance $\ell_\phi(x)$. Then
$$
q_\phi(z\mid x)=N(\mu_\phi(x),\exp\ell_\phi(x)),\qquad
z=\mu_\phi(x)+\exp(\ell_\phi(x)/2)\varepsilon,
$$
where $\varepsilon\sim N(0,1)$ is parameter-independent noise. Exponentiating the log variance ensures a positive variance, and the factor $1/2$ converts it to the standard deviation used in <Gaussian reparameterization>.<Auto-Encoding Variational Bayes by Diederik P. Kingma and Max Welling>[Appendix C.2, Gaussian output mean and log variance]{ref}
For an original calculation, suppose one input gives $\mu=1$ and $\ell=\log4$. The recognition variance is4 and its standard deviation is2. A noise draw $\varepsilon=1/2$ gives $z=2$, 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 $z$ 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.
Back to article page