R2: An Efficient MCMC Sampler for Probabilistic Programs


  • Aditya Nori Microsoft Research
  • Chung-Kil Hur Seoul National University
  • Sriram Rajamani Microsoft Research
  • Selva Samuel Microsoft Research




Probabilistic Programming, Program analysis, Sampling


We present a new Markov Chain Monte Carlo (MCMC) sampling algorithm for probabilistic programs. Our approach and tool, called R2, has the unique feature of employing program analysis in order to improve the efficiencyof MCMC sampling. Given an input program P, R2 propagates observations in P backwards to obtaina semantically equivalent program P' in which every probabilistic assignment is immediately followed by an observe statement. Inference is performed by a suitably modified version of the Metropolis-Hastings algorithm that exploits the structure of the program P'. This has the overall effect of preventing rejections due to program executions that fail to satisfy observations in P. We formalize the semantics of probabilistic programs and rigorously prove the correctness of R2. We also empirically demonstrate the effectiveness of R2—in particular, we show that R2 is able to produce results of similar quality as the CHURCH and STAN probabilistic programming tools with much shorter execution time.




How to Cite

Nori, A., Hur, C.-K., Rajamani, S., & Samuel, S. (2014). R2: An Efficient MCMC Sampler for Probabilistic Programs. Proceedings of the AAAI Conference on Artificial Intelligence, 28(1). https://doi.org/10.1609/aaai.v28i1.9060



AAAI Technical Track: Reasoning under Uncertainty