Abstract
Probabilistic Programming Languages (PPLs) provide a powerful framework for defining complex generative models, but performing efficient inference remains a significant challenge. Traditional methods like MCMC and SMC are computationally expensive and do not leverage past computations. This paper introduces a system for deep amortized inference in universal PPLs. By pairing a probabilistic model with a neural-network-powered "guide program" that mirrors the model's structure, the system learns to perform fast, approximate posterior inference. This approach transforms slow, iterative reasoning into a rapid, feed-forward pattern recognition task, enabling scalable inference across a variety of domains.
Introduction
Probabilistic Programming Languages (PPLs) allow researchers to express complex probability distributions through code. However, the inverse problem—inference—is notoriously difficult. Finding the latent variables that explain observed data typically requires general-purpose algorithms like Markov Chain Monte Carlo (MCMC) or Sequential Monte Carlo (SMC). While flexible, these methods are "forgetful," solving every new inference problem from scratch even if the underlying structure is identical.
This paper addresses the need for efficient, scalable inference by leveraging amortization. Amortization uses deep learning to "learn how to infer" from past experiences, making future inferences nearly instantaneous. The authors implement this system as an extension to WebPPL, introducing the concept of a "guide program" to facilitate this learning process.
Methods: The Guide Program
The core innovation is the guide program $q$, which is designed to mirror the control flow of the original model $p$.
Structural Mirroring and Neural Data Flow
A guide program follows the same sequence of random choices as the model. However, while the model defines the generative process, the guide's parameters are computed by neural networks that take observed data as input. This allows the guide to learn a mapping from observations to approximate posterior distributions over latent variables.
Optimization and Variance Reduction
To handle the mix of discrete and continuous variables common in PPLs, the authors developed a unified gradient estimator. It combines the Pathwise (PW) estimator for continuous variables and the Likelihood Ratio (LR) estimator for discrete variables. To mitigate the high variance associated with discrete choices, the system employs variance reduction techniques, including per-choice likelihood ratio weights and moving-average baselines.
Scalability with mapData
The authors introduced the mapData construct to distinguish between global model parameters and local variables specific to individual data points. This distinction is crucial for enabling mini-batching, allowing the system to scale to large datasets that would otherwise be computationally prohibitive.
Experimental Evaluation
The system was evaluated on several modeling tasks:
- Gaussian Mixture Models (GMM): Tested on synthetic datasets to verify basic functionality.
- QMR-DT: A bipartite medical diagnosis network with 200 causes and 100 effects.
- Latent Dirichlet Allocation (LDA): Topic modeling on research abstracts from the Stanford Computation and Cognition Lab.
- MNIST: Training Variational Autoencoders (VAEs) and Sigmoid Belief Networks (SBNs) on handwritten digits.
Key Results and Insights
The experiments demonstrated that amortization creates a "virtuous cycle": learning to perform local inference speeds up global model learning, which in turn improves the quality of the inferences.
- Efficiency: Amortized guides were significantly faster at test time than traditional methods. In the QMR-DT task, the amortized guide even trained faster than standard mean-field approaches by sharing parameters across data points via the neural network.
- Accuracy: In medical diagnosis, the learned guide predicted more than twice as many "active effects" compared to the prior model.
- Flexibility: The framework successfully unified diverse models, from simple Bayesian networks to deep generative models like VAEs, under a single optimization framework.
- Automatic Derivation: For many models, the system can automatically insert "mean-field" guides, reducing the manual effort required from programmers.
Conclusion and Future Work
While the system significantly advances amortized inference, some limitations remain. The most effective guides often require manual design (e.g., using RNNs for structured data). Additionally, models with many discrete variables still train more slowly than purely continuous ones.
Future work includes exploring more automated guide generation using Recurrent Neural Networks (RNNs) and extending the system to handle time-series data. By bridging the gap between flexible probabilistic modeling and efficient deep learning, this work paves the way for more scalable and accessible probabilistic reasoning.
Summary updated