Reinterpreting Importance-Weighted Autoencoders
Chris Cremer, Quaid Morris, David Duvenaud
Background
The importance-weighted autoencoder (IWAE; Burda et al. (2016)) is a variational inference strategy capable of producing arbitrarily tight evidence lower bounds. IWAE maximizes the following multi-sample evidence lower bound (ELBO):
which is a tighter lower bound than the ELBO maximized by the variational autoencoder (VAE; Kingma & Welling (2014)):
In this section, we derive the implicit distribution that arises from importance sampling from a distribution using as a proposal distribution. Given a batch of samples from , the following is the unnormalized importance-weighted distribution:
Here are some properties of the approximate IWAE posterior:
For a more detailed derivation, see the appendix. Note that we are abusing the VAE lower bound notation because this implies an expectation over an unnormalized distribution. Consequently, we replace the expectation with an equivalent integral.
See section 5.2 for a proof that is a normalized distribution. Using in the VAE ELBO, , results in an upper bound of . See section 5.3 for the proof, which is a special case of the proof in Naesseth et al. (2017). The procedure to sample from is shown in Algorithm 1. It is equivalent to sampling-importance-resampling (SIR).
3 Visualizing the nonparameteric approximate posterior
Resampling for prediction
During training, we sample the distribution and implicitly weight them with the IWAE ELBO. After training, we need to explicitly reweight samples from .
In figure 2, we demonstrate the need to sample from rather than for reconstructing MNIST digits. We trained the model to maximize the IWAE ELBO with K=50 and 2 latent dimensions, similar to Appendix C in Burda et al. (2016). When we sample from and reconstruct the samples, we see a number of anomalies. However, if we perform the sampling-resampling step (Alg. 1), then the reconstructions are much more accurate. The intuition here is that we trained the model with with then sampled from ( with ), which are very different distributions, as seen in Fig. 1.
Discussion
We’d like to thank an anonymous ICLR reviewer for providing insightful future directions for this work. We’d like to thank Yuri Burda, Christian Naesseth, and Scott Linderman for bringing our attention to oversights in the paper. We’d also like to thank Christian Naesseth for the derivation in section 5.3 and for providing many helpful comments.
References
Appendix
(8): Change of notation . (10): has the same expectation as so we can replace with the sum of terms.
(17): Change of notation . (19): has the same expectation as so we can replace with the sum of terms. (20): Linearity of expectation.
Let
(28): Given that is concave for , and , then . (30): Change of notation . (34): has the same expectation as so we can replace with the sum of terms.
The previous section showed that . That is, the IWAE ELBO with the base is a lower bound to the VAE ELBO with the importance weighted . Due to Jensen's inequality and as shown in Burda et al. (2016), we know that the IWAE ELBO is an upper bound of the VAE ELBO: . Furthermore, the log marginal likelihood can be factorized into: , and rearranged to: .
Following the observations above and substituting for :
Thus, , meaning is closer to the true posterior than in terms of KL divergence.
5 In the limit of the number of samples
Another perspective is in the limit of . Recall that the marginal likelihood can be approximated by importance sampling: