Source-linked AI summary
Automated Variational Inference in Probabilistic Programming
David Wingate, Theophane Weber
TL;DR
Inference in probabilistic programs is difficult for complex, analytically intractable distributions. The paper automatically derives variational programs and optimizes them with stochastic gradients, yielding more efficient inference and fast posterior sampling after convergence.
Problem
Inference is difficult for probabilistic programs with highly structured, non-analytically tractable distributions, while automatically deriving variational methods is generally intractable.
Method
The method derives a variational program by replacing each ERP's target parameters with auxiliary variational parameters and optimizes it using stochastic gradients.
Results
ENAC converges faster and with lower variance than steepest descent, while SOGD performs poorly and diverges for LDA; converged variational programs enable fast approximate posterior sampling.
Takeaways & Limitations
The approach applies regardless of conjugacy, control logic, or parameterization, requiring only ERP log-likelihoods and their gradients with respect to parameters.
Takeaways & Limitations
The approach requires computing an ERP value's log likelihood and its gradient with respect to the ERP parameters.
Abstract
from arXiv · showhide
We present a new algorithm for approximate inference in probabilistic programs, based on a stochastic gradient for variational programs. This method is efficient without restrictions on the probabilistic program; it is particularly practical for distributions which are not analytically tractable, including highly structured distributions that arise in probabilistic programs. We show how to automatically derive mean-field probabilistic programs and optimize them, and demonstrate that our perspective improves inference efficiency over other algorithms.
1 Introduction
Probabilistic programming offers flexible stochastic models, but inference is difficult because conditioning requires effectively running programs backward. Variational inference provides a deterministic alternative, yet automatically deriving it is generally intractable for complex programs.
- Probabilistic programs flexibly combine deterministic and stochastic elements to define distributions over execution traces.
- Inference requires reasoning about p(x|y) from a known subset of variables, effectively running the program backward.
- Universal inference environments commonly use MCMC or Gibbs because sample-based methods are broadly applicable and easy to implement.
- Variational inference instead approximates a complex distribution with a simpler parametric distribution optimized using KL divergence.
- Automatically deriving variational inference is generally intractable for probabilistic programs, motivating a compositional stochastic gradient approach.
2 Automated Variational Inference
The paper automatically constructs variational programs from probabilistic programs and optimizes them with stochastic gradients, avoiding conjugacy and analytic tractability restrictions. The approach supports partial mean-field structure, control-flow dependencies, and extensions including transfer learning, structured approximations, and online inference.
- 2.1 KL Divergence: The variational objective adjusts p_θ(x) to approximate p(x|y), maximizing a reward that is a lower bound on log p(y).Mean-field approximations factor p_θ(x) into history-independent marginal distributions.
- 2.2 Stochastic Gradient Optimization: Stochastic gradient descent provides a generic alternative to coordinate-descent derivations, which fail for highly structured, non-analytically tractable probabilistic programs.The gradient is estimated from sampled traces and can use an optimized constant baseline to reduce Monte Carlo variance.
- 2.3 Compositional Variational Inference: The method derives a variational program by replacing each target-program ERP parameter ψ_t(h_t) with an auxiliary variational parameter θ_t(h_t).Control logic is retained, while stochastic dependencies through parameterization can disappear.
- 2.3 Compositional Variational Inference: The algorithm requires only ERP log-likelihoods and their parameter gradients, adding one requirement beyond an MCMC sampler.It does not require conjugacy, particular control logic, or a specific parameterization of p(x_t; θ_t).
- 2.4 Extensions: The framework extends to learned inference transfer, structured mean-field programs, and online probabilistic programming.Structured approximations are represented as more complex unconditional variational programs with gradients computed as in the mean-field case.
3 Experiments: LDA and QMR
Experiments compare three gradient-based AVI algorithms on QMR-DT and LDA under matched sampling budgets. ENAC converges faster and with lower variance, while its baseline estimation contributes significantly to the advantage.
- 3 Experiments: LDA and QMR: ENAC converges faster and with lower variance than steepest descent, whereas SOGD performs poorly and diverges on LDA.The comparison uses QMR-DT and LDA benchmarks with matched sample budgets and normalized gradient directions.
- 3 Experiments: LDA and QMR: Conjugate-gradient optimization converges faster than steepest descent when using ENAC gradients.
- 3 Experiments: LDA and QMR: Baseline estimation significantly improves ENAC performance beyond the shared use of second-order information.SOGD and ENAC estimate the Fisher information matrix in the same way, isolating baseline estimation as an additional difference.
- 3 Experiments: LDA and QMR: After convergence, the variational program enables very fast approximate posterior sampling and can provide warm starts for MCMC.The approximate samples cost a fraction of samples obtained directly with MCMC.
4 Related Work
Related work applies variational inference and stochastic approximations in several settings, but the cited approaches impose tractability, distribution-family, or manual-derivation constraints. The paper positions AVI as an automatically generated method for more complex probabilistic programs.
- 4 Related Work: Natural conjugate-gradient analysis primarily treats Gaussian approximations and may involve an intractable integral.
- 4 Related Work: Prior probabilistic-programming work used easy variational-program sampling to estimate free energy but did not provide a general optimization algorithm.
- 4 Related Work: Carbonetto’s Sequential Monte Carlo approach requires a variational family containing the target and cannot be automatically generated for arbitrarily complex models.
- 4 Related Work: Earlier stochastic variational methods require manual coordinate-descent derivations under conjugacy assumptions.