[Paper Review] A Tutorial on VAEs: From Bayes' Rule to Lossless Compression
This tutorial provides a comprehensive derivation of Variational Autoencoders (VAEs) from Bayesian principles and information theory, clarifying their objective through Bayes' Rule, importance sampling, and lossless compression. It identifies key misconceptions—such as training with MSE loss or treating the latent vector as a parameter—and demonstrates via a 2D toy example that VAEs can model complex distributions but may struggle with efficient latent space coverage due to the ELBO's bias toward low-variance posteriors.
The Variational Auto-Encoder (VAE) is a simple, efficient, and popular deep maximum likelihood model. Though usage of VAEs is widespread, the derivation of the VAE is not as widely understood. In this tutorial, we will provide an overview of the VAE and a tour through various derivations and interpretations of the VAE objective. From a probabilistic standpoint, we will examine the VAE through the lens of Bayes' Rule, importance sampling, and the change-of-variables formula. From an information theoretic standpoint, we will examine the VAE through the lens of lossless compression and transmission through a noisy channel. We will then identify two common misconceptions over the VAE formulation and their practical consequences. Finally, we will visualize the capabilities and limitations of VAEs using a code example (with an accompanying Jupyter notebook) on toy 2D data.
Motivation & Objective
- To clarify the probabilistic and information-theoretic foundations of VAEs, moving beyond common misconceptions in practice.
- To explain the VAE objective through multiple derivations: Bayesian inference, importance sampling, and change-of-variables.
- To reinterpret the VAE through the lens of lossless compression and noisy channel transmission, linking it to information theory.
- To identify and correct two widespread misconceptions: using MSE loss for VAE training and treating the latent vector as a parameter.
- To empirically demonstrate the capabilities and limitations of VAEs using a visualizable 2D data example with a Jupyter notebook.
Proposed method
- Derives the VAE objective using Bayes' Rule, showing how the evidence lower bound (ELBO) arises from posterior approximation.
- Applies importance sampling to improve the estimation of the log-likelihood, reducing bias in the training objective.
- Uses the change-of-variables formula to formalize the reparameterization trick for gradient estimation in the latent space.
- Reinterprets the VAE as a system for lossless compression, where the encoder compresses data and the decoder reconstructs it with minimal information loss.
- Models the VAE as a noisy channel, where the latent variable acts as a stochastic bottleneck, linking to rate-distortion theory.
- Employs a 2D toy dataset with a multi-modal distribution to visualize the VAE’s latent space, density estimation, and reconstruction behavior.
Experimental results
Research questions
- RQ1How does the VAE objective emerge from Bayesian inference and the evidence lower bound (ELBO)?
- RQ2In what ways can the VAE be interpreted through the lens of lossless compression and noisy channel transmission?
- RQ3Why does the standard VAE objective discourage exploration of low-probability regions in the latent space?
- RQ4What are the practical consequences of the misconception that VAEs can be trained with mean-squared error loss?
- RQ5How does the importance-weighted autoencoder (IWAE) improve upon the standard VAE in terms of log-likelihood estimation and latent space coverage?
Key findings
- The negative ELBO objective in VAEs introduces a bias that discourages the model from exploring low-probability regions of the latent space, especially when the posterior variance decreases during training.
- Using importance sampling to approximate the log-likelihood leads to a tighter bound on the true log-likelihood compared to the standard ELBO, resulting in better density estimation.
- The IWAE with 10 importance samples achieves significantly better negative log-likelihood scores than the standard VAE, even with half the effective data per iteration.
- The VAE's latent space expansion is slowed as the posterior variance decreases, potentially delaying convergence or preventing full coverage of high-probability data regions.
- The misconception that VAEs can be trained with MSE loss leads to incorrect assumptions about the model’s probabilistic nature and may result in blurry reconstructions.
- Despite theoretical potential for perfect modeling under ideal conditions (e.g., fully disentangled latents or high-dimensional discrete data), such solutions are often infeasible to learn via gradient descent in practice.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.