paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Functional programming for modular Bayesian inference

面向模块化贝叶斯推断的函数式编程
ICFP 2(ICFP)2018匹配度 4/10 · 论文属于函数式编程与概率编程/贝叶斯推断的交叉,提供了模块化推断库的设计与实现;但未涉及程序分析、LLM/Agent、浮点分析等核心方向,与画像中“贝叶斯程序分析及其与 LLM 交叉”仅有概念上的部分关联。引用 21 inbox
Adam Ścibior, Ohad Kammar, Zoubin Ghahramani
crossref: 2026-09-10

AI 速览

一句话:提出用函数式语言特性实现模块化概率编程库,可组合出最先进的贝叶斯推断算法。

论文面向现代函数式语言设计了一个贝叶斯建模与推断库架构。其核心是利用高阶函数、归纳数据类型以及类型类或表达力强的模块系统,实现推断表示、推断变换与推断表示变换器等抽象,从而让现有最先进的推断算法以模块化方式实现。作者在 Haskell 中给出高效实现,将粒子滤波与 Metropolis-Hastings 采样器作为基本构件,并组合出 RM-SMC、PMMH 与 SMC² 等算法。评估表明其性能与现有概率编程系统相比已具竞争力,还可对随机 Monte Carlo 算法做确定性测试,并用 OCaml 验证该设计可由表达力强的模块系统承载。

问题
如何在函数式语言中以库的形式模块化地实现贝叶斯建模与推断,并复用、组合最先进的推断算法。
方法
基于高阶函数、归纳数据类型和类型类/模块系统,抽象出推断表示、推断变换与表示变换器,在 Haskell 中实现并组合粒子滤波、Metropolis-Hastings 等构件。
评估
与现有概率编程系统进行性能对比,并展示对随机 Monte Carlo 算法的确定性测试,以及在 OCaml 中用模块系统实现同一设计。
原文摘要(Abstract)

We present an architectural design of a library for Bayesian modelling and inference in modern functional programming languages. The novel aspect of our approach are modular implementations of existing state-of-the-art inference algorithms. Our design relies on three inherently functional features: higher-order functions, inductive data-types, and support for either type-classes or an expressive module system. We provide a performant Haskell implementation of this architecture, demonstrating that high-level and modular probabilistic programming can be added as a library in sufficiently expressive languages. We review the core abstractions in this architecture: inference representations, inference transformations, and inference representation transformers. We then implement concrete instances of these abstractions, counterparts to particle filters and Metropolis-Hastings samplers, which form the basic building blocks of our library. By composing these building blocks we obtain state-of-the-art inference algorithms: Resample-Move Sequential Monte Carlo, Particle Marginal Metropolis-Hastings, and Sequential Monte Carlo Squared. We evaluate our implementation against existing probabilistic programming systems and find it is already competitively performant, although we conjecture that existing functional programming optimisation techniques could reduce the overhead associated with the abstractions we use. We show that our modular design enables deterministic testing of inherently stochastic Monte Carlo algorithms. Finally, we demonstrate using OCaml that an expressive module system can also implement our design.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot304,
  title = {Functional programming for modular Bayesian inference},
  author = {Adam Ścibior and Ohad Kammar and Zoubin Ghahramani},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {2},
  number = {ICFP},
  year = {2018},
  doi = {10.1145/3236778}
}