Abstract
Inference algorithms for probabilistic programming are complex imperative programs with many moving parts. Efficient inference often requires customising an algorithm to a particular probabilistic model or problem, sometimes called inference programming. Most inference frameworks are implemented in languages that lack a disciplined approach to side effects, which can result in monolithic implementations where the structure of the algorithms is obscured and inference programming is hard. Functional programming with typed effects offers a more structured and modular foundation for programmable inference, with monad transformers being the primary structuring mechanism explored to date.
This paper presents an alternative approach to inference programming based on algebraic effects. Using effect signatures to specify the key operations of the algorithms, and effect handlers to modularly interpret those operations for specific variants, we develop two abstract algorithms, or inference patterns, representing two important classes of inference: MetropolisHastings and particle filtering. We show how our approach reveals the algorithms’ highlevel structure, and makes it easy to tailor and recombine their parts into new variants. We implement the two inference patterns as a Haskell library, and discuss the pros and cons of algebraic effects visàvis monad transformers as a structuring mechanism for modular imperative algorithm design.
This paper presents an alternative approach to inference programming based on algebraic effects. Using effect signatures to specify the key operations of the algorithms, and effect handlers to modularly interpret those operations for specific variants, we develop two abstract algorithms, or inference patterns, representing two important classes of inference: MetropolisHastings and particle filtering. We show how our approach reveals the algorithms’ highlevel structure, and makes it easy to tailor and recombine their parts into new variants. We implement the two inference patterns as a Haskell library, and discuss the pros and cons of algebraic effects visàvis monad transformers as a structuring mechanism for modular imperative algorithm design.
Original language  English 

Title of host publication  Haskell 2023 
Subtitle of host publication  Proceedings of the 16th ACM SIGPLAN International Haskell Symposium 
Editors  Trevor L. McDonell, Niki Vazou 
Publisher  Association for Computing Machinery (ACM) 
Pages  44–58 
Number of pages  15 
ISBN (Electronic)  9798400702983 
DOIs  
Publication status  Published  31 Aug 2023 
Event  ACM SIGPLAN International Conference on Functional Programming  Italy, Milan, Italy Duration: 8 Sept 2023 → 9 Sept 2023 https://dl.acm.org/conference/icfp 
Publication series
Name  Proceedings of the ACM SIGPLAN ... Haskell Symposium 

ISSN (Print)  21529213 
Conference
Conference  ACM SIGPLAN International Conference on Functional Programming 

Country/Territory  Italy 
City  Milan 
Period  8/09/23 → 9/09/23 
Internet address 
Research Groups and Themes
 Programming Languages
Fingerprint
Dive into the research topics of 'Effect Handlers for Programmable Inference'. Together they form a unique fingerprint.Student theses

Effects and effect handlers for probabilistic programming
Nguyen, M. H. (Author), Wang, M. (Supervisor) & Perera, R. (Supervisor), 5 Dec 2023Student thesis: Doctoral Thesis › Doctor of Philosophy (PhD)
File