Abstract
Automatic Differentiation Variational Inference (ADVI) is a useful tool for efficiently learning probabilistic models in machine learning. Generally approximate posteriors learned by ADVI are forced to be unimodal in order to facilitate use of the reparameterization trick. In this paper, we show how stratified sampling may be used to enable mixture distributions as the approximate posterior, and derive a new lower bound on the evidence analogous to the importance weighted autoencoder (IWAE). We show that this "SIWAE" is a tighter bound than both IWAE and the traditional ELBO, both of which are special instances of this bound. We verify empirically that the traditional ELBO objective disfavors the presence of multimodal posterior distributions and may therefore not be able to fully capture structure in the latent space. Our experiments show that using the SIWAE objective allows the encoder to learn more complex distributions which regularly contain multimodality, resulting in higher accuracy and better calibration in the presence of incomplete, limited, or corrupted data.
Introduction
In Bayesian machine learning, approximating the posterior distribution—the probability of latent variables given observed data—is a central challenge. Variational Inference (VI), particularly Automatic Differentiation Variational Inference (ADVI), has become a standard approach due to its efficiency. However, ADVI typically relies on the "reparameterization trick," which necessitates the use of continuous, differentiable approximate distributions. This requirement has historically restricted researchers to simple, unimodal distributions like Gaussians.
Real-world data, however, is frequently ambiguous and multimodal. For instance, a partial view of a handwritten digit might be consistent with several different numbers. A unimodal approximation fails here, either collapsing to a single mode (mode-seeking) or producing a blurry average of all possibilities. While mixture models could theoretically represent these distinct modes, they are difficult to integrate into ADVI because the discrete step of selecting a mixture component is non-differentiable.
Methods: Stratified Sampling and SIWAE
To enable the use of mixture distributions within the ADVI framework, the authors introduce two primary innovations:
- Stratified Sampling: Instead of the standard approach of randomly selecting a single component from a mixture, the authors propose sampling from every component. By calculating a weighted average across all components, the sampling process becomes differentiable, allowing gradients to propagate back to the parameters of every individual mode in the mixture.
- Stratified Importance Weighted Autoencoder (SIWAE): Building upon the Importance Weighted Autoencoder (IWAE), the authors derive a new mathematical lower bound on the evidence. SIWAE draws multiple samples from each mixture component. The use of importance weighting ensures that "poor" samples—those with low likelihood—are penalized less severely than in the standard Evidence Lower Bound (ELBO). This encourages components to explore the latent space rather than collapsing into a single point.
Key Insights
A critical finding is that the traditional ELBO objective is inherently "mode-seeking" and actively disfavors multimodality. Even when provided with a mixture distribution, ELBO training often forces all components to converge to a single peak. SIWAE mitigates this by using importance weighting as a "safety net," preventing components that explore low-likelihood regions from being immediately eliminated by the optimizer.
Furthermore, models trained with standard ELBO tend to "hedge their bets" with wide, indistinct decision boundaries. In contrast, SIWAE-trained models learn distinct, sharp modes in the latent space, effectively shifting uncertainty from the model's output into the structured latent space itself.
Experimental Results
The SIWAE objective was evaluated across several benchmarks designed to test its ability to handle multimodality, including synthetic 2D datasets and a modified "Single-Column MNIST" task.
- Superior Mode Capture: In toy problems with four distinct modes, SIWAE successfully captured the entire posterior structure. In contrast, standard methods like SELBO and Score Function Estimators often failed, capturing only a subset of the modes.
- Tighter Evidence Bounds: SIWAE achieved a log-evidence of -1.505 on a generative toy task, significantly outperforming SELBO (-2.024) and score function methods (-2.038).
- Improved Calibration and Accuracy: On the Single-Column MNIST task, SIWAE significantly reduced the Expected Calibration Error (ECE), leading to more reliable uncertainty estimates. Additionally, classification accuracy improved steadily as the number of mixture components and samples increased, a trend not observed with SELBO.
Conclusion
The Stratified Importance Weighted Autoencoder (SIWAE) provides a robust framework for learning complex, multimodal posterior distributions in ADVI. By combining stratified sampling with importance weighting, it overcomes the mode-collapse issues prevalent in traditional variational inference. While SIWAE incurs higher computational costs due to increased sampling requirements, its benefits in terms of accuracy, calibration, and representational power make it a valuable tool for modeling ambiguous or limited data. Future work may address the scaling of gradient variance and the computational overhead in high-dimensional spaces.
Summary updated