Effect Handlers for Programmable Inference

Research output: Chapter in Book/Report/Conference proceedingConference Contribution (Conference Proceeding)

1 Citation (Scopus)

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: Metropolis-Hastings and particle filtering. We show how our approach reveals the algorithms’ high-level 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 languageEnglish
Title of host publicationHaskell 2023
Subtitle of host publicationProceedings of the 16th ACM SIGPLAN International Haskell Symposium
EditorsTrevor L. McDonell, Niki Vazou
PublisherAssociation for Computing Machinery (ACM)
Pages44–58
Number of pages15
ISBN (Electronic)9798400702983
DOIs
Publication statusPublished - 31 Aug 2023
EventACM SIGPLAN International Conference on Functional Programming - Italy, Milan, Italy
Duration: 8 Sept 20239 Sept 2023
https://dl.acm.org/conference/icfp

Publication series

NameProceedings of the ACM SIGPLAN ... Haskell Symposium
ISSN (Print)2152-9213

Conference

ConferenceACM SIGPLAN International Conference on Functional Programming
Country/TerritoryItaly
CityMilan
Period8/09/239/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.

Cite this