# Automatically Marginalized MCMC in Probabilistic Programming

arXiv: https://arxiv.org/abs/2302.00564 · HTML: https://mlsanity.com/paper/2302.00564/

## Key facts

- Cited by 4 papers in the map (data through 14 Oct 2026).
- Builds on 24 of its 57 references that are in the map.
- First posted on arXiv 1 Feb 2023.

## Builds on (most cited first, 24 of 24)

- [Variational Inference with Normalizing Flows](https://mlsanity.com/paper/1505.05770/) (2015)
- [Normalizing Flows for Probabilistic Modeling and Inference](https://mlsanity.com/paper/1912.02762/) (2019)
- [Pyro: Deep Universal Probabilistic Programming](https://mlsanity.com/paper/1810.09538/) (2018)
- [Composable Effects for Flexible and Accelerated Probabilistic Programming in NumPyro](https://mlsanity.com/paper/1912.11554/) (2019)
- [Automatic Differentiation Variational Inference](https://mlsanity.com/paper/1603.00788/) (2016)
- [NeuTra-lizing Bad Geometry in Hamiltonian Monte Carlo Using Neural Transport](https://mlsanity.com/paper/1903.03704/) (2019)
- [An Introduction to Probabilistic Programming](https://mlsanity.com/paper/1809.10756/) (2018)
- [Hamiltonian Monte Carlo for Hierarchical Models](https://mlsanity.com/paper/1312.0906/) (2013)
- [Rao-Blackwellised Particle Filtering for Dynamic Bayesian Networks](https://mlsanity.com/paper/1301.3853/) (2013)
- [Deep Probabilistic Programming](https://mlsanity.com/paper/1701.03757/) (2017)
- [A New Approach to Probabilistic Programming Inference](https://mlsanity.com/paper/1507.00996/) (2015)
- [Involutive MCMC: a Unifying Framework](https://mlsanity.com/paper/2006.16653/) (2020)
- [Automatic Reparameterisation of Probabilistic Programs](https://mlsanity.com/paper/1906.03028/) (2019)
- [Automated learning with a probabilistic programming language: Birch](https://mlsanity.com/paper/1810.01539/) (2018)
- [Delayed Sampling and Automatic Rao-Blackwellization of Probabilistic Programs](https://mlsanity.com/paper/1708.07787/) (2017)
- [Tensor Variable Elimination for Plated Factor Graphs](https://mlsanity.com/paper/1902.03210/) (2019)
- [Reactive Probabilistic Programming](https://mlsanity.com/paper/1908.07563/) (2019)
- [Functional Tensors for Probabilistic Programming](https://mlsanity.com/paper/1910.10775/) (2019)
- [Conditional independence by typing](https://mlsanity.com/paper/2010.11887/) (2020)
- [Semi-Symbolic Inference for Efficient Streaming Probabilistic Programming](https://mlsanity.com/paper/2209.07490/) (2022)
- [Autoconj: Recognizing and Exploiting Conjugacy Without a Domain-Specific Language](https://mlsanity.com/paper/1811.11926/) (2018)
- [Joint Distributions for TensorFlow Probability](https://mlsanity.com/paper/2001.11819/) (2020)
- [Program Analysis of Probabilistic Programs](https://mlsanity.com/paper/2204.06868/) (2022)
- [Nonparametric Involutive Markov Chain Monte Carlo](https://mlsanity.com/paper/2211.01100/) (2022)

## Built on by (most cited first, 4 of 4)

- [Hamiltonian Monte Carlo Inference of Marginalized Linear Mixed-Effects Models](https://mlsanity.com/paper/2410.24079/) (2024)
- [Push: Concurrent Probabilistic Programming for Bayesian Deep Learning](https://mlsanity.com/paper/2306.06528/) (2023)
- [Inference Plans for Hybrid Particle Filtering](https://mlsanity.com/paper/2408.11283/) (2024)
- [Automatic Laplace Collapsed Sampling: Scalable Marginalisation of Latent Parameters via Automatic Differentiation](https://mlsanity.com/paper/2603.26644/) (2026)

## Abstract (arXiv)

Hamiltonian Monte Carlo (HMC) is a powerful algorithm to sample latent variables from Bayesian models. The advent of probabilistic programming languages (PPLs) frees users from writing inference algorithms and lets users focus on modeling. However, many models are difficult for HMC to solve directly, and often require tricks like model reparameterization. We are motivated by the fact that many of those models could be simplified by marginalization. We propose to use automatic marginalization as part of the sampling process using HMC in a graphical model extracted from a PPL, which substantially improves sampling from real-world hierarchical models.
