一句话:提出基于协程和类型系统的框架,验证可编程 MCMC 中用户引导程序的正确性与可组合性。
概率编程语言的可编程推理允许用户用 guide 程序定制 MCMC 推断,但 guide 错误会破坏统计可靠性。本文提出基于协程的验证框架与新型类型系统,描述模型和一系列 guide 间的通信协议,每个 guide 只更新部分随机变量。作者证明可将 guide 类型翻译为有限范数上下文无关进程,在多项式时间内检查模型与 guide 的结构类型等式,并给出支持通用递归与分支的类型推断算法。还提出覆盖检查算法,验证顺序组合 guide 的支持与模型一致,这是多 guide MCMC 的关键可靠性条件。基准评估显示,算法能高效推断类型并检测现有静态分析无法处理的 sound/unsound guide。
Probabilistic programming languages (PPLs) provide language support for expressing flexible probabilistic models and solving Bayesian inference problems. PPLs with programmable inference make it possible for users to obtain improved results by customizing inference engines using guide programs that are tailored to a corresponding model program. However, errors in guide programs can compromise the statistical soundness of the inference. This article introduces a novel coroutine-based framework for verifying the correctness of user-written guide programs for a broad class of Markov chain Monte Carlo (MCMC) inference algorithms. Our approach rests on a novel type system for describing communication protocols between a model program and a sequence of guides that each update only a subset of random variables. We prove that, by translating guide types to context-free processes with finite norms, it is possible to check structural type equality between models and guides in polynomial time. This connection gives rise to an efficient type-inference algorithm for probabilistic programs with flexible constructs such as general recursion and branching. We also contribute a coverage-checking algorithm that verifies the support of sequentially composed guide programs agrees with that of the model program, which is a key soundness condition for MCMC inference with multiple guides. Evaluations on diverse benchmarks show that our type-inference and coverage-checking algorithms efficiently infer types and detect sound and unsound guides for programs that existing static analyses cannot handle.
@article{Pham0S024,
title = {Programmable MCMC with Soundly Composed Guide Programs},
author = {Long Pham and Di Wang and Feras A. Saad and Jan Hoffmann},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {OOPSLA2},
year = {2024},
doi = {10.1145/3689748}
}