Slicing Probabilistic Programs

被引:0
作者
Hur, Chung-Kil [1 ]
Nori, Aditya V. [1 ]
Rajamani, Sriram K. [1 ]
Samuel, Selva [1 ]
机构
[1] Seoul Natl Univ, Seoul 151, South Korea
关键词
Probabilistic Programming; Program Slicing; Bayesian Reasoning;
D O I
10.1145/2666356.2594303
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Probabilistic programs use familiar notation of programming languages to specify probabilistic models. Suppose we are interested in estimating the distribution of the return expression r of a probabilistic program P. We are interested in slicing the probabilistic program P and obtaining a simpler program SLI (P) which retains only those parts of P that are relevant to estimating r, and elides those parts of P that are not relevant to estimating r. We desire that the SLI transformation be both correct and efficient. By correct, we mean that P and SLI (P) have identical estimates on r. By efficient, we mean that estimation over SLI (P) be as fast as possible. We show that the usual notion of program slicing, which traverses control and data dependencies backward from the return expression r, is unsatisfactory for probabilistic programs, since it produces incorrect slices on some programs and sub-optimal ones on others. Our key insight is that in addition to the usual notions of control dependence and data dependence that are used to slice non-probabilistic programs, a new kind of dependence called observe dependence arises naturally due to observe statements in probabilistic programs. We propose a new definition of SLI (P) which is both correct and efficient for probabilistic programs, by including observe dependence in addition to control and data dependences for computing slices. We prove correctness mathematically, and we demonstrate efficiency empirically. We show that by applying the SLI transformation as a pre-pass, we can improve the efficiency of probabilistic inference, not only in our own inference tool R2, but also in other systems for performing inference such as Church and Infer. NET.
引用
收藏
页码:133 / 144
页数:12
相关论文
共 50 条
[41]   Bounded Expectations: Resource Analysis for Probabilistic Programs [J].
Van Chan Ngo ;
Carbonneaux, Quentin ;
Hoffmann, Jan .
ACM SIGPLAN NOTICES, 2018, 53 (04) :496-512
[42]   Automated quantized inference for probabilistic programs with AQUA [J].
Huang, Zixin ;
Dutta, Saikat ;
Misailovic, Sasa .
INNOVATIONS IN SYSTEMS AND SOFTWARE ENGINEERING, 2022, 18 (03) :369-384
[43]   A logic for information flow analysis with an application to forward slicing of simple imperative programs [J].
Amtoft, Torben ;
Banerjee, Anindya .
SCIENCE OF COMPUTER PROGRAMMING, 2007, 64 (01) :3-28
[44]   Dynamic slicing of concurrent AspectJ programs: An explicit context-sensitive approach [J].
Singh, Jagannath ;
Mohapatra, Durga Prasad .
SOFTWARE-PRACTICE & EXPERIENCE, 2018, 48 (01) :233-260
[45]   PMAF: An Algebraic Framework for Static Analysis of Probabilistic Programs [J].
Wang, Di ;
Hoffmann, Jan ;
Reps, Thomas .
PROCEEDINGS OF THE 39TH ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION, PLDI 2018, 2018, :513-528
[46]   Towards Verified Stochastic Variational Inference for Probabilistic Programs [J].
Lee, Wonyeol ;
Yu, Hangyeol ;
Rival, Xavier ;
Yang, Hongseok .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4 (POPL)
[47]   PMAF: An algebraic framework for static analysis of probabilistic programs [J].
Wang D. ;
Hoffmann J. ;
Reps T. .
ACM SIGPLAN Notices, 2018, 53 (04) :513-528
[48]   Compiling Discrete Probabilistic Programs for Vectorized Exact Inference [J].
Pan, Jingwen ;
Shaikhha, Amir .
PROCEEDINGS OF THE 32ND ACM SIGPLAN INTERNATIONAL CONFERENCE ON COMPILER CONSTRUCTION, CC 2023, 2023, :13-24
[49]   Formal Verification of Higher-Order Probabilistic Programs [J].
Sato, Tetsuya ;
Aguirre, Alejandro ;
Barthe, Gilles ;
Gaboardi, Marco ;
Garg, Deepak ;
Hsu, Justin .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2019, 3 (POPL)
[50]   PROPER: Tool for Analyzing Termination and Correctness of Probabilistic Programs [J].
Zhao X.-H. ;
Deng Y.-X. ;
Fu H.-F. .
Ruan Jian Xue Bao/Journal of Software, 2022, 33 (12) :4464-4475