Probabilistic programming languages aim to describe and automate Bayesian modeling and inference. Modern languages support programmable inference, which allows users to customize inference algorithms by incorporating guide programs to improve inference performance. For Bayesian inference to be sound, guide programs must be compatible with model programs. One pervasive but challenging condition for model-guide compatibility is absolute continuity, which requires that the model and guide programs define probability distributions with the same support. This paper presents a new probabilistic programming language that guarantees absolute continuity, and features general programming constructs, such as branching and recursion. Model and guide programs are implemented as coroutines that communicate with each other to synchronize the set of random variables they sample during their execution. Novel guide types describe and enforce communication protocols between coroutines. If the model and guide are well-typed using the same protocol, then they are guaranteed to enjoy absolute continuity. An efficient algorithm infers guide types from code so that users do not have to specify the types. The new programming language is evaluated with an implementation that includes the type-inference algorithm and a prototype compiler that targets Pyro. Experiments show that our language is capable of expressing a variety of probabilistic models with nontrivial control flow and recursion, and that the coroutine-based computation does not introduce significant overhead in actual Bayesian inference.
翻译:预测性编程语言的目的是描述和自动使用巴伊西亚的模型和推断。现代语言支持可编程的推断,使用户能够通过纳入指导程序定制推算算算法,从而通过定制导算法来提高推算性性能。要使巴伊西亚的推论健全,指导程序必须与模型程序兼容。模型指导兼容性的一个普遍但具有挑战性的条件是绝对连续性,这就要求模型和指导程序以同样的支持来定义概率分布。本文提供了一种新的概率性编程语言,保证绝对连续性,并含有一般编程结构,如分支和循环。模型和指导程序作为连接器,通过相互交流来定制推算法,以同步其执行期间抽样的随机变量集。新指南类型描述并强制执行了交汇程序之间的通信协议。如果模型和指南使用相同的协议进行精密的组合,则保证它们享有绝对的连续性。一个高效的算法导出基于代码的类型,使用户不必指定类型的编程。新的编程语言经过评估,其实施方式包括不包含在实际的Byloavial Revia 和原型滚动中显示我们的重要的滚动的尾贝性算法。