Effects and effect handlers for probabilistic programming

Student thesis: Doctoral ThesisDoctor of Philosophy (PhD)

Abstract

Probabilistic programming languages allow programmers to construct statistical models, representing random variables they know and those they wish to learn. Using the same language, the programmer can then simulate data from the model, or apply an inference algorithm to learn the relationships between the model’s variables. Although used widely, existing probabilistic languages do not fully support modular and type-safe programming, which has specific impacts on end-users. When modelling, models are either not readily composable, or are restricted to a specific instance of simulation or inference, thus limiting their reusability. Most inference frameworks are then designed without a disciplined approach to side-effects, which can result in monolithic implementations where the structure of the inference algorithms is obscured and programming (customising) them is hard. 

This thesis describes a novel approach for designing modular and type-safe probabilistic programming languages, based on algebraic effects and effect handlers – a typed functional programming technique for structuring effects. The approach is demonstrated in Haskell as a host language. Part I develops a language for probabilistic models that are modular, first-class, and reusable for both simulation and inference; it shows how these features enable new highly expressive treatment of models, such as composition and higher-orderness. Part II then develops a framework for inference programming that is modular and type-driven, where specific algorithms can be modularly derived from abstract classes of inference algorithms; it illustrates how the approach reveals the algorithms’ high-level structure, and makes it possible to tailor and recombine their parts into new variants.
Date of Award5 Dec 2023
Original languageEnglish
Awarding Institution
  • University of Bristol
SponsorsEngineering and Physical Sciences Research Council
SupervisorMeng Wang (Supervisor) & Roly N T Perera (Supervisor)

Cite this

'