Abstract
The variational autoencoder (VAE) is a powerful generative model that can estimate the probability of a data point by using latent variables. In the VAE, the posterior of the latent variable given the data point is regularized by the prior of the latent variable using Kullback Leibler (KL) divergence. Although the standard Gaussian distribution is usually used for the prior, this simple prior incurs over-regularization. As a sophisticated prior, the aggregated posterior has been introduced, which is the expectation of the posterior over the data distribution. This prior is optimal for the VAE in terms of maximizing the training objective function. However, KL divergence with the aggregated posterior cannot be calculated in a closed form, which prevents us from using this optimal prior. With the proposed method, we introduce the density ratio trick to estimate this KL divergence without modeling the aggregated posterior explicitly. Since the density ratio trick does not work well in high dimensions, we rewrite this KL divergence that contains the high-dimensional density ratio into the sum of the analytically calculable term and the low-dimensional density ratio term, to which the density ratio trick is applied. Experiments on various datasets show that the VAE with this implicit optimal prior achieves high density estimation performance.
Introduction
Standard Variational Autoencoders (VAEs) map high-dimensional data into a low-dimensional latent space. To regularize this space, a prior distribution—typically a simple Gaussian—is used, and the encoder is forced to match it via Kullback-Leibler (KL) divergence. However, this restrictive prior often leads to posterior collapse or over-regularization, where the latent variables become uninformative, degrading data generation and density estimation quality.
Theoretically, the "optimal" prior is the aggregated posterior, defined as the average of all encoded data points. Using this prior would maximize the model's objective function. However, the aggregated posterior lacks a closed-form solution, making direct KL divergence calculation impossible. Existing solutions like VampPrior rely on complex mixtures of distributions that are computationally expensive and difficult to tune.
Methodology
The proposed VAE with Implicit Optimal Priors utilizes the density ratio trick to estimate the KL divergence between the encoder and the aggregated posterior without explicit modeling.
Latent Space Decomposition
A significant challenge with the density ratio trick is its instability in high-dimensional spaces. To circumvent this, the authors decompose the KL divergence into two components:
- A standard KL term between the encoder and a Gaussian distribution, which is analytically calculable.
- A density ratio term comparing the aggregated posterior to a Gaussian.
By performing this calculation in the latent space—which is typically much lower-dimensional than the data space (e.g., 40 vs. 784 dimensions)—the density ratio trick becomes highly effective and stable.
Optimization
The training follows a two-step procedure. First, the VAE parameters are updated to maximize the evidence lower bound (ELBO). Second, a small discriminator network is trained to distinguish between samples from the encoder and samples from a standard Gaussian, refining the density ratio estimation.
Experimental Evaluation
The method was evaluated on synthetic (OneHot) and real-world datasets (MNIST, OMNIGLOT, FreyFaces, and Histopathology).
Latent Space Organization
On the synthetic OneHot dataset, the proposed method demonstrates superior latent space organization. While standard VAEs often result in overlapping representations, the implicit optimal prior creates distinct, well-separated clusters, as shown in Figure 1.
Training Stability and Performance
The proposed method consistently outperformed baselines in terms of test log-likelihood across all image datasets. Furthermore, it exhibited greater training stability. As seen in Figure 2, the ELBO for the proposed method converges reliably compared to the high variance seen in Adversarial Variational Bayes (AVB).
Discussion and Conclusion
Key Advantages
- Simplicity: By avoiding explicit modeling (e.g., the "pseudo-inputs" in VampPrior), the method eliminates sensitive hyperparameters like the number of mixture components.
- Efficiency: The approach is significantly faster than mixture-based priors. On MNIST, the proposed method trained 2.83 times faster than VampPrior.
- Robustness: The model is less sensitive to initialization and hyperparameter choices.
Limitations and Future Work
The primary limitation is that the prior is "implicit," meaning direct sampling for data generation requires ancestral sampling (starting from a training data point). Additionally, while dropout helps, the discriminator can still overfit. Future work may explore combining implicit priors with Normalizing Flows to further enhance encoder flexibility.
In conclusion, the VAE with Implicit Optimal Priors effectively addresses the over-regularization problem by leveraging the aggregated posterior through a stable, low-dimensional density ratio trick. This results in better density estimation, faster training, and more interpretable latent spaces.
Summary updated