Abstract
Traditional variational inference (VI) requires tedious, model-specific mathematical derivations, creating a significant barrier to exploring complex probabilistic models. This paper introduces Black Box Variational Inference (BBVI), a generic algorithm that automates inference by requiring only the model's log-likelihood and the ability to sample from a variational distribution. By combining stochastic optimization with advanced variance reduction techniques—specifically Rao-Blackwellization and control variates—BBVI enables researchers to deploy and iterate on non-conjugate models with ease.
Introduction
Probabilistic latent variable models are powerful tools for uncovering hidden structures in complex data. However, calculating the posterior distribution is often intractable. Variational inference addresses this by framing posterior estimation as an optimization problem, maximizing the Evidence Lower Bound (ELBO). Despite its popularity, traditional VI suffers from an "analytic burden": practitioners must manually derive gradients for every new model. This requirement limits the speed of research and prevents the use of models that do not fit into standard conjugate families.
Methods
BBVI treats the model as a "black box," decoupling model design from inference implementation. The core of the approach is the Score Function Estimator, which expresses the gradient of the ELBO as an expectation, allowing for Monte Carlo estimation using samples from the variational distribution.
To make this stochastic optimization practical, the authors introduce two critical variance reduction techniques:
- Rao-Blackwellization: This technique exploits the conditional independence structure of the model. Instead of using all samples for every parameter gradient, it only considers variables within a parameter's "Markov blanket," significantly reducing noise.
- Control Variates: The algorithm uses the score function itself as a control variate. Since its expectation is zero, it can be subtracted from the gradient estimate to stabilize it without introducing bias.
Additionally, AdaGrad is employed to provide adaptive learning rates, managing the varying scales of parameters and the inherent noise in stochastic gradients.
Experimental Setup
The authors evaluated BBVI using a longitudinal healthcare dataset consisting of approximately 33,000 clinic visits from 976 patients with chronic kidney disease. The task involved modeling 17 different laboratory measurements over time using latent factors to capture patient health trajectories. This non-conjugate setting is ideal for demonstrating the flexibility of BBVI.
Results and Discussion
The experimental results highlight two primary advantages of BBVI: efficiency and stability.
Speed and Convergence
Compared to standard sampling-based methods like Metropolis-Hastings within Gibbs, BBVI reached higher predictive likelihoods significantly faster. While the Gibbs sampler's progress plateaued after several hours, BBVI continued to improve, demonstrating superior convergence properties for complex models.
The Necessity of Variance Reduction
A key finding was that the basic score function estimator is too noisy for practical use. As shown in the variance analysis, Rao-Blackwellization and control variates reduce the gradient variance by several orders of magnitude. Without these techniques, the stochastic optimization fails to converge.
Rapid Prototyping
The generic nature of BBVI allowed the authors to quickly compare multiple model architectures, such as Gamma-Normal time-series models versus static counterparts. They found that models accounting for longitudinal dynamics provided a significantly better fit, a discovery facilitated by the "plug-and-play" nature of the algorithm.
Conclusion
Black Box Variational Inference transforms inference into a commodity, allowing researchers to focus on model development rather than mathematical derivation. While it introduces a higher computational cost due to sampling, the reduction in analytic effort and the ability to handle non-conjugate models represent a major step forward. Future work may explore dynamic sample sizing and Quasi-Monte Carlo methods to further optimize performance.
Summary updated