I'm a bit confused on how Variational Autoencoders are trained. In particular I'm confused on how the latent variable is generated for each input.

My questions are as follows:

  1. When running stochastic gradient descent does the sampled latent variable stick with the data point during the entire run or does a new latent variable get sampled each time descent is run?

  2. If running batch or full gradient descent, each data point gets its own set of sampled latent variables right?

  3. How do you check for convergence? Assuming the latent variable is sampled at each iteration, it's not clear to me how you can evaluate if you have converged or not given the stochastic nature of the performance function.


VAE's have an encoder. The encoder maps an input to a latent vector. The latent vector doesn't "stick". Instead, in each iteration, we use the encoder to map to a latent distribution, sample from that latent distribution, then use the decoder to map to a reconstruction, and compute the loss. Yes, each data point is mapped to its own latent vector. Yes, you run the encoder anew and sample anew for each point and each iteration of training.

You check for convergence in the standard way for any neural network: you look for the value of the loss function to plateau.

  • $\begingroup$ This is confusing as for example, arxiv.org/pdf/1606.05908.pdf mentions sampling for backprop. $\endgroup$ – FourierFlux Jan 27 '20 at 5:43
  • $\begingroup$ Also to be clear about the convergence question - I am confused because convergence won't be deterministic according to this paper in that if you check the error two different times it may produce a different result because of the random sampling aspect. $\endgroup$ – FourierFlux Jan 27 '20 at 5:56
  • $\begingroup$ @FourierFlux, sorry about that. You're right, that wasn't written very well. See edited answer for a better explanation. I'm not sure what you mean by deterministic convergence, but I don't think that's something you should expect for any neural network; the value of the loss is a noisy signal. However when you average it over many training samples I think the noise is unlikely to be a major issue. $\endgroup$ – D.W. Jan 27 '20 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.