I've done some experiments to understand the influence of the dimension of the latent space in a VAE, and it seems that the higher the space, the harder it is to generate realistic images. I might have an intuition of the reason, and I wanted to have your opinion or any other theoretical insight about it.
First, what I've noticed:
- After the training of a deep convolutional VAE with a large latent space (8x8x1024) on MNIST, the reconstruction works very well. Moreover, when I give any sample $x$ to my encoder, the output mean $\mu(x)$ is close to 0 and the output std $\sigma(x)$ is close to 1. Both the reconstruction loss and the latent loss seem to be low.
- However, if I give random samples from $\mathcal{N}(0,I)$ to my decoder, the output is some random white strokes on a black background (like MNIST samples, but not looking like digits).
- If I give an image $x$ to my encoder, it will output a mean $\mu(x)$ (close to 0), and if I give to my decoder random samples from $\mathcal{N}(\mu(x),I)$, the output will be images representing the same digit than the input (both realistic and different from the input)
What I conclude is that:
- The VAE has generated many gaussian distributions of realistic images, whose centers are close to 0 but not exactly 0. Thus, the distribution of realistic images is a mixture of gaussians $\mathcal{D} = \sum_{x \in \mathcal{X}} \alpha_x \mathcal{N}(\mu(x),I)$
- The practical support of $\mathcal{N}(0,I)$ does not overlap with the practical support of $\mathcal{D}$ (except on a set of measure zero). By practical support, I mean the space where most points are actually generated. For a high-dimensional gaussian, it corresponds to a soap bubble.
So here is a visualization of what would happen with a high-dimensional latent space:
The red bubble would be the practical support of $\mathcal{N}(0,I)$ while the union of the black bubbles would be the practical support of $\mathcal{D}$. Only the black bubbles contain realistic images, while the red bubble contains almost no realistic image. The higher the dimension, the thinner the bubbles are and the smaller the overlapping space is.
Is this intuition correct? Is there any other reason for high dimensional latent spaces not to work correctly?