Unbiased Implicit Variational Inference

Michalis K. Titsias, Francisco J. R. Ruiz

Abstract: We develop unbiased implicit variational inference (UIVI), a method that expands the applicability of variational inference by defining an expressive variational family. UIVI considers an implicit variational distribution, providing a more flexible posterior approximation than traditional parametric families. By leveraging a novel gradient identity and an efficient MCMC initialization strategy, UIVI enables the optimization of the evidence lower bound (ELBO) with unbiased gradient estimates, leading to superior performance in complex generative models.

Introduction

In Bayesian machine learning, the central challenge is often estimating the posterior distribution—the updated belief about model parameters after observing data. For most complex models, the exact posterior is intractable, necessitating the use of Variational Inference (VI). VI approximates the posterior by finding a member of a simpler "variational family" that minimizes the divergence from the true distribution. Traditionally, these families are restricted to simple forms, such as Gaussians, to ensure that the optimization process remains mathematically tractable.

However, simple families often fail to capture the intricate, non-Gaussian geometries of true posteriors. Implicit distributions, which define a sampling process through a deep neural network, offer significantly more flexibility. The primary obstacle to their adoption is that their density function ($q(z)$) is typically unknown. This makes it impossible to calculate the entropy term required to optimize the Evidence Lower Bound (ELBO). While previous methods like Semi-Implicit VI (SIVI) attempted to address this using surrogate lower bounds, these bounds can be loose, resulting in suboptimal posterior approximations.

Methodology

Unbiased Implicit Variational Inference (UIVI) introduces a framework for providing unbiased estimates of the ELBO gradient for implicit distributions. The method is built upon three core technical innovations:

1. Semi-Implicit Structure

UIVI defines the variational distribution $q(z)$ as a hierarchical mixture. First, a "noise" variable $\epsilon$ is sampled from a base distribution. This variable then parameterizes a simple, reparameterizable distribution (e.g., a Gaussian) from which the latent variable $z$ is drawn. This structure allows for high expressivity through the neural network mapping $\epsilon \to \text{params}(z)$, while maintaining a link to tractable components.

2. The Gradient Identity

The fundamental mathematical contribution of UIVI is a novel gradient identity. The authors demonstrate that the gradient of the intractable log-density, $\nabla_z \log q(z)$, can be rewritten as an expectation over a "reverse conditional" distribution $q(\epsilon|z)$. This transformation is pivotal because it converts the problem of density estimation into one of sampling, which is often more manageable in high-dimensional spaces.

3. Efficient MCMC with a "Head Start"

To estimate the expectation over $q(\epsilon|z)$, UIVI utilizes Hamiltonian Monte Carlo (HMC). Traditionally, MCMC is considered too computationally expensive for the inner loops of neural network training due to the "burn-in" period required to reach stationarity. UIVI bypasses this by observing that the $\epsilon$ used to generate $z$ in the forward pass provides a natural starting point for the MCMC chain. By initializing at this point, the chain starts at stationarity, allowing for high-quality, unbiased estimates with very few steps (e.g., 10 HMC steps).

Experimental Evaluation

The authors evaluated UIVI across a range of benchmarks, from synthetic toy problems to large-scale generative modeling tasks.

Qualitative results on toy distributions (banana, multimodal, and x-shaped) showing how UIVI captures complex posterior geometries.

On synthetic distributions—including banana-shaped, multimodal Gaussian, and X-shaped targets—UIVI successfully captured complex geometries that standard Gaussian approximations cannot represent. This qualitative success translates to quantitative gains in more complex models.

In Bayesian Multinomial Logistic Regression tasks on the MNIST and HAPT datasets, UIVI consistently achieved higher ELBO values than SIVI, indicating a tighter and more accurate posterior approximation. The performance advantages were further confirmed in Variational Autoencoders (VAEs) trained on MNIST and Fashion-MNIST. On the MNIST dataset, UIVI achieved a test log-likelihood of -94.09, significantly outperforming both SIVI (-97.77) and standard Gaussian VAEs (-98.29).

Test log-likelihood over training time on MNIST, comparing UIVI against SIVI. UIVI achieves better performance with comparable computational efficiency.

Importantly, the computational cost of the MCMC steps did not hinder performance. As shown in the training curves, UIVI's "no burn-in" trick allowed it to maintain a computational speed comparable to SIVI while achieving superior convergence and final log-likelihood.

Conclusion and Future Work

UIVI provides a practical and mathematically rigorous way to utilize highly flexible, implicit variational families. By targeting the ELBO directly with unbiased gradients, it overcomes the limitations of previous biased or bounded approaches.

While the method is robust, it introduces hyperparameters such as HMC step size and the number of leapfrog steps, which may require tuning for specific architectures. Future work could explore integrating more complex conditional distributions, such as normalizing flows, or testing the scalability of the reverse-conditional MCMC approach in the extremely high-dimensional latent spaces required for high-resolution image synthesis.

Summary updated

BibTeX
@inproceedings{titsias2019unbiased,
  author = {Michalis K. Titsias and Francisco J. R. Ruiz},
  title = {{Unbiased Implicit Variational Inference}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2019},
  url = {https://openreview.net/forum?id=gDxMQLx9lAt},
}
Figure