Efficient Semi-Implicit Variational Inference

Vincent Moens, Hang Ren, Alexandre Maraval, Rasul Tutunov, Jun Wang, Haitham AmmararXiv 2021

Abstract

In this paper, we propose CI-VI, an efficient and scalable solver for semi-implicit variational inference (SIVI). Our method maps SIVI's evidence lower bound (ELBO) to a form involving a nonlinear functional nesting of expected values and develops a rigorous optimizer capable of correctly handling bias inherent to nonlinear nested expectations using an extrapolation-smoothing mechanism coupled with gradient sketching. Our theoretical results demonstrate convergence to a stationary point of the ELBO in general non-convex settings typically arising when using deep network models and an order of $O(t^{-\frac{4}{5}})$ gradient-bias-vanishing rate. Finally, in a set of experiments, we demonstrate the effectiveness of our algorithm in approximating complex posteriors on various datasets including those from natural language processing.

Introduction

Variational Inference (VI) is a cornerstone of modern Bayesian machine learning, yet it often suffers from limited representation power. To maintain tractability, practitioners frequently resort to simple variational families, such as Gaussians, which often fail to capture complex posterior features like multi-modality, skewness, or heavy tails. Semi-Implicit Variational Inference (SIVI) was introduced to address this by defining the variational distribution through a mixing procedure, enabling significantly more flexible posterior approximations.

However, SIVI introduces significant optimization challenges because its objective function, the Evidence Lower Bound (ELBO), involves an intractable integral. Previous solutions relied on density ratio estimation—which is notoriously unstable and difficult to scale—or MCMC-based estimators, which are computationally prohibitive and slow to converge. This work introduces CI-VI, a first-order optimization framework that is both computationally efficient and theoretically grounded for high-dimensional settings.

Methodology: The CI-VI Framework

The core innovation of CI-VI lies in reformulating SIVI as a compositional stochastic optimization problem. By mapping the ELBO to a nonlinear functional nesting of expected values, the authors leverage advances in optimization theory to solve the intractability.

Compositional Mapping and Extrapolation-Smoothing

The SIVI ELBO is rewritten as $E_\nu[f_\nu(E_\omega[g_\omega(\theta)])]$. Standard stochastic gradient descent is biased when applied to such nested expectations. CI-VI addresses this through a two-step extrapolation-smoothing mechanism:

  1. Linear Extrapolation: A query point is computed to anticipate the movement of the inner expectation.
  2. Smoothing: A running average of the inner expectation is maintained to stabilize updates. This dual-update strategy ensures that the gradient bias vanishes at a rate of $O(t^{-4/5})$, a significant theoretical improvement over naive Monte Carlo sampling.

Scalability via Gradient Sketching

To handle high-dimensional data, CI-VI incorporates gradient sketching. By utilizing randomized linear algebra, the algorithm avoids expensive full matrix-vector products, allowing for efficient batched updates. The final solver is built upon an ADAM-like adaptive framework, ensuring easy integration into modern deep learning pipelines.

Experimental Evaluation

The authors evaluated CI-VI across a range of benchmarks, from synthetic toy distributions to high-dimensional natural language processing tasks.

Toy Distributions

CI-VI was tested on standard benchmarks for non-Gaussian shapes: Two-Modal, Star, and Banana distributions. Unlike traditional Mean-Field Variational Bayes (MFVB), which often underestimates variance, CI-VI accurately captured the complex geometry and multi-modality of these posteriors.

CI-VI approximations of complex toy posteriors (Two-Modal, Star, and Banana) compared to ground truth.

Bayesian Logistic Regression and VAEs

The method's performance was further validated on Bayesian Logistic Regression (Spam, Nodal, and Waveform datasets) and Variational Autoencoders (MNIST, Fashion-MNIST, and Penn Treebank).

Performance comparison: Marginal posteriors on logistic regression datasets (top) and ELBO convergence on VAE tasks (bottom).

Key findings include:

  • Efficiency: CI-VI achieved an iteration speed of approximately 56ms, significantly faster than standard SIVI (~155ms) or other compositional methods like ASCPG (~157ms).
  • Convergence: Theoretical guarantees of convergence to stationary points were empirically observed across all tasks, with CI-VI consistently reaching higher ELBO values faster than baselines.
  • Scalability: CI-VI successfully modeled the Penn Treebank (PTB) dataset, outperforming existing SIVI solvers that typically struggle with the high dimensionality of language models.

Conclusion

CI-VI provides a rigorous and scalable framework for Semi-Implicit Variational Inference. By framing the ELBO as a nested compositional problem and employing extrapolation-smoothing with gradient sketching, it overcomes the stability and speed limitations of prior methods. Future work includes extending this framework to complex dialogue modeling and time-series analysis.

Summary updated

BibTeX
@misc{moens2021efficient,
  author = {Vincent Moens and Hang Ren and Alexandre Maraval and Rasul Tutunov and Jun Wang and Haitham Ammar},
  title = {{Efficient Semi-Implicit Variational Inference}},
  year = {2021},
  eprint = {2101.06070},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.06070},
}
Figure