paperbot · PL 论文追踪

全部论文 待读 收藏

P2 From high-level inference algorithms to efficient code

从高层推断算法到高效代码
ICFP 3(ICFP)2019匹配度 3/10 · 该论文属于概率编程语言的编译与代码生成,虽与贝叶斯推断相关,但未涉及用户核心关注的静态分析、LLM/Agentic 程序分析、浮点程序分析或贝叶斯程序分析与 LLM 的交叉,方向匹配度较低。引用 9 inbox
Rajan Walia, Praveen Narayanan, Jacques Carette, Sam Tobin-Hochstadt, Chung-chieh Shan
crossref: 2026-09-10

AI 速览

一句话:提出编译方法,将含数组隐变量与共轭似然的高层概率推断程序转换为高效代码。

概率编程语言让领域专家无需关心底层细节即可表达模型与推断算法,但一类常见推断算法(涉及随机数组隐变量或共轭似然)的高效实现过去依赖繁琐且易错的手写底层代码。论文展示如何直接简洁表达这些算法的高层概率程序在保持效率的同时被编译:引入变换将带数组的高层概率程序转为纯循环代码,并利用领域特定不变式与范数优化代码,按每次执行特化并进行 JIT 编译。实验表明所得性能可与手工实现竞争。

问题
高层概率程序能简洁表达涉及数组隐变量或共轭似然的推断算法,但其高效执行通常需要消去隐变量、识别共轭关系并进行符号数学处理,因而往往只能依赖手写低层代码。
方法
引入新的程序变换,将带数组的高层概率程序转换为纯循环代码,并利用领域特定不变式与范数进行优化,同时按执行特化并 JIT 编译。
评估
通过将编译生成代码的性能与手工实现进行比较,结果表明其性能可与手工实现竞争。
原文摘要(Abstract)

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.

链接与引用

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

BibTeX
@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}
}