Reversible Jump Probabilistic Programming

David A. Roberts, Marcus Gallagher, Thomas TaimreAISTATS 2019

This research, originally presented at AISTATS 2019, introduces a method to automate one of the most mathematically tedious aspects of Bayesian inference: the Reversible Jump Markov chain Monte Carlo (RJMCMC) sampler. By leveraging a new probabilistic programming language (PPL) embedded in Haskell, the authors demonstrate how to move between models of varying dimensions without manually deriving complex Jacobian adjustments.

The Challenge of Trans-dimensional Inference

Probabilistic programming has significantly advanced model building, but inference remains a primary bottleneck. While methods like Hamiltonian Monte Carlo (HMC) are highly efficient for continuous parameters, they are not designed for "trans-dimensional" problems where the model's dimensionality is unknown or changing—such as determining the number of clusters in a dataset or selecting between competing models.

To address these problems, researchers use Reversible Jump MCMC (RJMCMC). However, RJMCMC is notoriously difficult to implement because it requires calculating a "Jacobian adjustment" to ensure the sampler remains mathematically valid (reversible). This process is error-prone and requires significant mathematical expertise. The authors' tool, Stochaskell, aims to automate this process entirely.

Automating the "Jump" with Stochaskell

Stochaskell is a domain-specific language embedded in Haskell that treats the Jacobian calculation as a program transformation problem rather than a manual calculus exercise. The system follows a multi-step pipeline to derive the sampler:

  1. Intermediate Representation (IR): Programs are converted into a Directed Acyclic Graph (DAG) representing the mathematical flow.
  2. Automatic Gradient Computation: The system walks the DAG to compute derivatives required for the Jacobian.
  3. Transformation Inversion: RJMCMC requires inverting the functions that map parameters between dimensions. Stochaskell uses a rule-based symbolic equation solver to find these inverses automatically.
Stochaskell maps high-level probabilistic code (a) to a Directed Acyclic Graph (b) for automatic derivation of RJMCMC terms.

By combining these elements, the system constructs the full RJMCMC acceptance ratio without user intervention. Furthermore, Stochaskell supports hybrid inference, generating C++ code that can interface with tools like Stan to use HMC for fixed-dimension parameters while handling dimension-hopping "jumps" with its own logic.

Key Results and Validation

The authors validated Stochaskell using classic benchmarks in RJMCMC literature. In an experiment involving English soccer data (1871–2015), the tool correctly calculated a posterior probability of 70.76% in favor of a Poisson model over a Negative Binomial model, matching previously published manual results.

In the "Coal Mining Disasters" benchmark—a classic change-point dataset—the system successfully handled a variable number of time segments. The resulting posterior mean rate curve aligns perfectly with the seminal 1995 RJMCMC results by Peter Green, demonstrating that the automated approach maintains high accuracy.

Posterior mean rate for the coal mining disaster dataset, automatically generated by Stochaskell.

Conclusion and Future Work

Stochaskell demonstrates that symbolic manipulation can offload the mathematical "bookkeeping" of trans-dimensional inference to the compiler. While the current system is limited by a relatively simple symbolic inversion solver and could benefit from more aggressive code optimization, it represents a significant step toward making complex Bayesian model selection accessible to a wider range of researchers.

Summary updated

BibTeX
@inproceedings{roberts2019reversible,
  author = {David A. Roberts and Marcus Gallagher and Thomas Taimre},
  title = {{Reversible Jump Probabilistic Programming}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2019},
}
Figure