一句话:提出编译方法,将含数组隐变量与共轭似然的高层概率推断程序转换为高效代码。
概率编程语言让领域专家无需关心底层细节即可表达模型与推断算法,但一类常见推断算法(涉及随机数组隐变量或共轭似然)的高效实现过去依赖繁琐且易错的手写底层代码。论文展示如何直接简洁表达这些算法的高层概率程序在保持效率的同时被编译:引入变换将带数组的高层概率程序转为纯循环代码,并利用领域特定不变式与范数优化代码,按每次执行特化并进行 JIT 编译。实验表明所得性能可与手工实现竞争。
Probabilistic programming languages are valuable because they allow domain experts to express probabilistic models and inference algorithms without worrying about irrelevant details. However, for decades there remained an important and popular class of probabilistic inference algorithms whose efficient implementation required manual low-level coding that is tedious and error-prone. They are algorithms whose idiomatic expression requires random array variables that are latent or whose likelihood is conjugate . Although that is how practitioners communicate and compose these algorithms on paper, executing such expressions requires eliminating the latent variables and recognizing the conjugacy by symbolic mathematics. Moreover, matching the performance of handwritten code requires speeding up loops by more than a constant factor. We show how probabilistic programs that directly and concisely express these desired inference algorithms can be compiled while maintaining efficiency. We introduce new transformations that turn high-level probabilistic programs with arrays into pure loop code. We then make great use of domain-specific invariants and norms to optimize the code, and to specialize and JIT-compile the code per execution. The resulting performance is competitive with manual implementations.
@article{paperbot614,
title = {From high-level inference algorithms to efficient code},
author = {Rajan Walia and Praveen Narayanan and Jacques Carette and Sam Tobin-Hochstadt and Chung-chieh Shan},
journal = {Proceedings of the ACM on Programming Languages},
volume = {3},
number = {ICFP},
year = {2019},
doi = {10.1145/3341702}
}