Suspension Analysis and Selective Continuation-Passing Style for Higher-Order Probabilistic Programming Languages

02/25/2023
by   Daniel Lundén, et al.
0

Probabilistic programming languages (PPLs) make encoding and automatically solving statistical inference problems relatively easy by separating models from the inference algorithm. A popular choice for solving inference problems is to use Monte Carlo inference algorithms. For higher-order functional PPLs, these inference algorithms rely on execution suspension to perform inference, most often enabled through a full continuation-passing style (CPS) transformation. However, standard CPS transformations for PPL compilers introduce significant overhead, a problem the community has generally overlooked. State-of-the-art solutions either perform complete CPS transformations with performance penalties due to unnecessary closure allocations or use efficient, but complex, low-level solutions that are often not available in high-level languages. In contrast to prior work, we develop a new approach that is both efficient and easy to implement using higher-order languages. Specifically, we design a novel static suspension analysis technique that determines the parts of a program that require suspension, given a particular inference algorithm. The analysis result allows selectively CPS transforming the program only where necessary. We formally prove the correctness of the suspension analysis and implement both the suspension analysis and selective CPS transformation in the Miking CorePPL compiler. We evaluate the implementation for a large number of Monte Carlo inference algorithms on real-world models from phylogenetics, epidemiology, and topic modeling. The evaluation results demonstrate significant improvements across all models and inference algorithms.

READ FULL TEXT
research
01/27/2023

Automatic Alignment in Higher-Order Probabilistic Programming Languages

Probabilistic Programming Languages (PPLs) allow users to encode statist...
research
12/01/2021

Compiling Universal Probabilistic Programming Languages with Efficient Parallel Sequential Monte Carlo Inference

Probabilistic programming languages (PPLs) allow users to encode arbitra...
research
08/16/2021

Automating the Functional Correspondence between Higher-Order Evaluators and Abstract Machines

The functional correspondence is a manual derivation technique transform...
research
10/25/2019

Selective Lambda Lifting

Lambda lifting is a well-known transformation, traditionally employed fo...
research
10/16/2020

Probabilistic Programming with CuPPL

Probabilistic Programming Languages (PPLs) are a powerful tool in machin...
research
06/30/2016

Swift: Compiled Inference for Probabilistic Programming Languages

A probabilistic program defines a probability measure over its semantic ...
research
07/11/2019

Provenance for Large-scale Datalog

Logic programming languages such as Datalog have become popular as Domai...

Please sign up or login with your details

Forgot password? Click here to reset