# Why do we regularize the variational autoencoder with a normal distribution?

When we define the loss function of a variational autoencoder (VAE), we add the Kullback-Leibler divergence between the sample taken according to a normal distribution of parameters:

$$N(\mu,\sigma)$$

and we compare it with a normal distribution of parameters

$$N(0,1)$$

My intuition is that it is clever having samples taken from a distribution centered around zero, but I don't understand why we want that examples are taken with a normal distribution.

KL divergence is the loss function that forces the latent space distribution to be Gaussian. If you do not "restrict" the latent space, as is the case with a regular autoencoder, you have no idea what kind of vector to select as an input to the decoder to produce a dog image. Without restriction, there are $$2^n$$ (where $$n$$ is the dimensions of the latent space) possible vectors you could choose from. Chances of selecting one that produces a dog image would be minuscule.