Get free YouTube views, likes and subscribers
Get Free YouTube Subscribers, Views and Likes

[Haskell'23] Effect Handlers for Programmable Inference

Follow
ACM SIGPLAN

Effect Handlers for Programmable Inference (Video, Haskell 2023)
Minh Nguyen, Roly Perera, Meng Wang, and Steven Ramsay
(University of Bristol, UK; University of Bristol, UK; University of Bristol, UK; University of Bristol, UK)

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.

Article: https://doi.org/10.1145/3609026.3609729

ORCID: https://orcid.org/0000000338459928, https://orcid.org/0000000192499862, https://orcid.org/000000017780630X, https://orcid.org/0000000208258386

Video Tags: probabilistic programming, algebraic effects, functional programming, modularity, icfpws23haskellmainid59p, doi:10.1145/3609026.3609729, orcid:0000000338459928, orcid:0000000192499862, orcid:000000017780630X, orcid:0000000208258386

Presentation at the Haskell 2023 conference, September 8–9, 2023, https://icfp23.sigplan.org/home/haske...
Sponsored by ACM SIGPLAN, https://www.sigplan.org/

posted by Chonak