Prior in variational autoencoders I am currently dealing with variational autoencoders where I've read the original paper "An introduction to variational Bayes" from Kingma and Welling. I am currently still a little confused about the choice of the prior $p(z)$. For my understanding the variational autoencoder has the three possible distribution families we can choose:

*

*The family of distributions for the encoder $q_\phi(z|x)$ parametrised by $\phi$.

*The family of distribtuions for the decoder $p_\theta(x|z)$ parametrised by $\theta$.

*The family of prior distributions $p_\theta(z)$.

Now for my understanding and also according to this notation used, the parameters for the decoder and the prior have to be the same, since overall we want to compute $p_\theta(x,z)$ with a neural network right?
Then, how is it possible to choose $p_\theta(z)=\mathcal{N}(0,I)$ while at the same time optimising the parameters $\theta$ computed by the decoder network?
As a third question: if not restricting the prior to be a standard normal distribution, how do we learn the parameters of the prior $p_\theta(z)$?

Edit: I am aware, that in practice we choose the prior distribution to be standard normal. But why are we allowed to do so?
For my understanding, the whole model (looking at the variational autoencoder as one model) we want to fit $p_\theta(x,z)=p_\theta(x|z) p_\theta(z)$ meaning the parameters $\theta$ are coming from the same parameter space for the decoder and the prior distribution. But when on the one hand fixing the prior distribution and on the other hand computing the parameters $\theta$ for the decoder, then we are kind of violating this assumption aren't we?


Now for my understanding and also according to this notation used, the parameters for the decoder and the prior have to be the same, since overall we want to compute $p_\theta(x,z)$ with a neural network right?

Prior is the distribution for the parameters. Parameters come “from” the prior.

Then, how is it possible to choose $p_\theta(z)=\mathcal{N}(0,I)$ while at the same time optimising the parameters $\theta$ computed by the decoder network?

What you are optimizing is the posterior probability, so likelihood times prior. You choose the prior a priori, plug-in to the Bayes theorem and optimize. When optimizing you consider the prior.

As a third question: if not restricting the prior to be a standard normal distribution, how do we learn the parameters of the prior $p_\theta(z)$?

You assume them based on your prior knowledge, on what you can expect the distributions of the parameters to be before seeing the data. There's nothing special about Gaussians here. Moreover, the above prior choice is dictated rather by convenience than any deep mathematical argument.
It may be easier to understand on practical example, Keras’s blog has a nice tutorial on autoencoders.
