Probabilistic programming languages (PPLs) make encoding and automatically solving statistical inference problems relatively easy by separating models from the inference algorithm. A popular choice for solving inference problems is to use Monte Carlo inference algorithms. For higher-order functional PPLs, these inference algorithms rely on execution suspension to perform inference, most often enabled through a full continuation-passing style (CPS) transformation. However, standard CPS transformations for PPL compilers introduce significant overhead, a problem the community has generally overlooked. State-of-the-art solutions either perform complete CPS transformations with performance penalties due to unnecessary closure allocations or use efficient, but complex, low-level solutions that are often not available in high-level languages. In contrast to prior work, we develop a new approach that is both efficient and easy to implement using higher-order languages. Specifically, we design a novel static suspension analysis technique that determines the parts of a program that require suspension, given a particular inference algorithm. The analysis result allows selectively CPS transforming the program only where necessary. We formally prove the correctness of the suspension analysis and implement both the suspension analysis and selective CPS transformation in the Miking CorePPL compiler. We evaluate the implementation for a large number of Monte Carlo inference algorithms on real-world models from phylogenetics, epidemiology, and topic modeling. The evaluation results demonstrate significant improvements across all models and inference algorithms.
翻译:预测性编程语言(PPLs)通过将模型与推算算法区分开来,使编码和自动解决统计推论问题相对容易。解决推论问题的流行选择是使用蒙特卡洛推算算法。对于更高级的功能性 PPPL,这些推算法依靠执行暂停来进行推论,通常通过完全连续的风格(CPS)转换来进行推论。然而,对PPPL编程者的标准CPS转换引入了重要的间接成本,这是社区普遍忽视的一个问题。由于不必要的关闭分配或使用高层次语言通常无法提供的高效、但复杂、低层次的解决办法,因此,国家最先进的解决办法要么是用完整的CPPS转换,执行绩效处罚。与以前的工作不同,我们开发了新的方法,既高效又容易使用更高级语言(CPS)执行。我们设计了一种新的静态模拟分析技术,决定了需要暂停的模型部分,特别是推断性算法。分析结果允许有选择性的CPS转换程序只在必要时进行。我们正式证明暂停性分析的准确性、但复杂和低层次分析结果分析,我们用CPSDL进行重大的模拟的大规模模拟分析。</s>