PPL Bench: Evaluation Framework For Probabilistic Programming Languages

Sourabh Kulkarni, Kinjal Divesh Shah, Nimar S. Arora, Xiaoyan Wang, Yucen Lily Li, Nazanin Khosravani Tehrani, Michael Tingley, David Noursi, Narjes Torabi, Sepehr Akhavan-Masouleh, Eric Lippert, Erik MeijerarXiv 2020

Abstract

We introduce PPL Bench, a new benchmark for evaluating Probabilistic Programming Languages (PPLs) on a variety of statistical models. The benchmark includes data generation and evaluation code for a number of models as well as implementations in some common PPLs. All of the benchmark code and PPL implementations are available on Github. We welcome contributions of new models and PPLs and as well as improvements in existing PPL implementations. The purpose of the benchmark is two-fold. First, we want researchers as well as conference reviewers to be able to evaluate improvements in PPLs in a standardized setting. Second, we want end users to be able to pick the PPL that is most suited for their modeling application. In particular, we are interested in evaluating the accuracy and speed of convergence of the inferred posterior. Each PPL only needs to provide posterior samples given a model and observation data. The framework automatically computes and plots growth in predictive log-likelihood on held out data in addition to reporting other common metrics such as effective sample size and $\hat{r}$.

Introduction

The field of probabilistic programming has seen an explosion of new languages (PPLs) over the last two decades, from veterans like BUGS and JAGS to modern frameworks like Stan, PyMC3, and BeanMachine. However, choosing the right PPL for a specific task remains difficult due to the fundamental tradeoff between "universality" (the ability to represent any distribution) and "inference speed" (specialized PPLs can optimize for specific structures).

Until now, there hasn't been a standardized way to measure how quickly these languages converge to a correct posterior or how accurately they handle different types of statistical models. PPL Bench is a new open-source modular framework designed to standardize the evaluation of PPLs, allowing for "apples-to-apples" comparisons between popular tools.

System Architecture

PPL Bench is implemented in Python 3 with a focus on modularity. The benchmarking process follows a strict four-step pipeline:

  1. Model Instantiation: Defining a model with ground-truth parameters.
  2. Data Generation: Simulating training and test datasets independently of any specific PPL.
  3. Posterior Sampling: Passing training data to various PPL implementations to generate posterior samples.
  4. Evaluation: Calculating standardized metrics across all PPLs.
The PPL Bench system overview illustrates the modular flow from data generation to evaluation.

Evaluation Methodology

A key methodological choice in PPL Bench is the use of Predictive Log Likelihood (PLL) on held-out data. By plotting PLL against the number of samples, the framework visualizes not just the final accuracy, but the speed of convergence. Other standard metrics included are the Gelman-Rubin statistic ($\hat{r}$) for convergence and Effective Sample Size ($n_{eff}$) to measure the quality of the samples. This approach allows researchers to see how quickly an algorithm "learns" rather than just looking at final numbers.

Benchmark Models

PPL Bench includes four initial statistical models chosen to cover diverse use cases:

  • Bayesian Logistic Regression: A simple, log-concave model that serves as a baseline.
  • Robust Regression: Uses Student-T errors to test how PPLs handle outliers.
  • Noisy-Or Topic Model (LAKI): A discrete latent variable model used in NLP.
  • Crowdsourced Annotation Model: Estimates true labels from a pool of imperfect human labelers.

Results and Insights

The benchmarks revealed significant performance variations across PPLs. While most PPLs eventually converged to the same predictive log-likelihood, validating the correctness of the implementations, the path to convergence varied significantly.

Predictive log-likelihood against samples for Bayesian Logistic Regression, comparing convergence across different PPLs and dataset sizes.

As seen in the convergence plots, different PPLs exhibit varying speeds of adaptation. For example, in some tests, BeanMachine was found to adapt its parameters quicker than Stan, even if Stan was faster in total wall-clock time. In Robust Regression tests, Stan was significantly faster in raw time, but BeanMachine generated more independent samples per second ($n_{eff}/s$) as the dataset size ($N$) increased.

Furthermore, the framework highlights challenges with specific model types. PPLs like Stan do not natively support discrete latent variables and require reparameterization (e.g., the "Gumbel-softmax trick"). This often introduces more variables, making Stan slower than C++-based tools like JAGS for specific models like Noisy-Or. The framework also facilitates the comparison of different algorithms within a language, such as comparing Stan’s NUTS (MCMC) against its Variational Inference (VI) implementations.

Conclusion

PPL Bench provides a strong foundation for standardizing PPL evaluation. While currently a "minimal" suite, its utility depends on community growth. Future work includes expanding the variety of models to include more complex, non-conjugate, and high-dimensional cases, and exploring multi-chain performance. The ultimate goal is for PPL Bench to become a standard benchmark that drives the development of faster, more reliable inference algorithms.

Summary updated

BibTeX
@misc{kulkarni2020ppl,
  author = {Sourabh Kulkarni and Kinjal Divesh Shah and Nimar S. Arora and Xiaoyan Wang and Yucen Lily Li and Nazanin Khosravani Tehrani and Michael Tingley and David Noursi and Narjes Torabi and Sepehr Akhavan-Masouleh and Eric Lippert and Erik Meijer},
  title = {{PPL Bench: Evaluation Framework For Probabilistic Programming Languages}},
  year = {2020},
  eprint = {2010.08886},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2010.08886},
}
Figure