# Why do we use Gaussian distributions in Variational Autoencoder?

I still don't understand why we force the distribution of the hidden representation of a Variational Autoencoder (VAE) to follow a multivariate normal distribution. Why this specific distribution and not another one ?

This is maybe linked with another question : Why is the weights distribution in a neural network following a Gaussian Distribution ? Is it just the application of the Central Limit theorem that tells you that many independent inputs will generate many independent errors, and the observed weights are the results of these multiple back-propagated signals... ?

• I thought it would be related to the central limit theory, and this paper may would be of help to you. – Lerner Zhang Apr 11 at 23:36
• Many things in the world are not distributed normally but data scientists and computer scientists model them as Normal distributions anyways. Why? Because it is the most entropic (conservative) modelling decision that we can make for a random variable while still matching a particular expectation (average value) and variance (spread). ---CS109 – Lerner Zhang Apr 19 at 12:11

Normal distribution is not the only distribution used for latent variables in VAEs. There are also works using von Mises-Fisher distribution (Hypershperical VAEs ), and there are VAEs using Gaussian mixtures, which is useful for unsupervised  and semi-supervised  tasks.

Normal distribution has many nice properties, such as analytical evaluation of the KL divergence in the variational loss, and also we can use the reparametrization trick for efficient gradient computation (however, the original VAE paper  names many other distributions for which that works). Moreover, one of the apparent advantages of VAEs is that they allow generation of new samples by sampling in the latent space—which is quite easy if it follows Gaussian distribution. Finally, as @shimao remarked, it does not matter so much what distribution latent variables follow since using the non-linear decoder it can mimic arbitrarily complicated distribution of observations. It is simply convenient.

As for the second question, I agree with @shimao's answer.

• Thank you for your answer ! But would it work if we use a classic auto encoder (without any specific distribution for the hidden representation) and we sample vectors by approximating the distribution for the hidden representation... – Tbertin Apr 12 at 14:59
• Perhaps, but the number of samples you need to get a good density estimate in the latent space grows exponentially with the dimensionality of the latent space. Also, density estimation itself is a tricky problem, so you may start with one problem and end up with two (which does not mean VAEs don't have their own difficulties, compared to standard AE)... – Jan Kukacka Apr 12 at 15:07

We use normal distribution because it is easily reparameterized. Also a sufficiently powerful decoder can map the normal distribution to any other distribution, so from a theoretical viewpoint, the exact choice is not important.

As for your second question, I would question your premise -- I am pretty sure weights are NOT normally distributed -- I recall seeing that resnet weights follow a more laplacian distribution. Anyway that is a pretty unrelated matter to the choice of prior in a VAE.