Abstract
We put forward an approach to the semantics of probabilistic programs centered on an action-based language equipped with a small-step operational semantics. This approach provides benefits in terms of both clarity and effective implementation. Discrete and continuous distributions can be freely mixed, unbounded loops are allowed. In measure-theoretic terms, a product of Markov kernels is used to formalize the small-step operational semantics. This approach directly leads to an exact sampling algorithm that can be efficiently SIMD-parallelized. An observational semantics is also introduced based on a probability space of infinite sequences, along with a finite approximation theorem. Preliminary experiments with a proof-of-concept implementation based on TensorFlow show that our approach compares favourably to state-of-the-art tools for probabilistic programming and inference.
Work partially supported by the project SERICS (PE00000014) under the NRRP MUR program funded by the EU - NextGenerationEU.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
E.g. when multiple threads execute independent chains in a Markov Chain Monte Carlo method.
- 2.
Variables \(x_i\) are only introduced as syntactic sugar: they will not get instantiated, and might be dispensed with using a terser notation, like \(@i=g\) and \(@i\sim G\).
- 3.
Technically, Definition 2 requires that we specify a density \(\rho _G((c,2r),\cdot )\) also when \(r\le 0\): this can be fixed arbitrarily for our purposes.
- 4.
For this example, we have used \(10^5\) samples. In fact, the stated bounds hold with very high probability: this will be made rigorous in the next section in terms of confidence intervals.
- 5.
For instance, in Python via the Numpy or TensorFlow packages.
- 6.
Like for algorithm \(\mathcal {A}\), since f is assumed to be the lifting of some h defined on \(\Omega \), we only keep the last element of each sequence, \(\omega _{i,t_0}\) in the notation of (13).
- 7.
Our PC configuration is as follows. OS: Windows 10; CPU: 2.8 GHz Intel Core i7; GPU: Nvidia T500, driver v. 522.06; TF: v. 2.10.1; CUDA Toolkit v. 11.8; cuDNN SDK v. 8.6.0.
References
Abadi, M., et al.: Tensorflow: a system for large-scale machine learning. In: Proceedings of the 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI 2016) (2016). arXiv:1605.08695
Ash, R.: Real Analysis and Probability. Academic Press Inc., New York (1972)
Baier, C., Katoen, J.P.: Principles of Model Checking. MIT Press, Cambridge (2008)
Barthe, G., Katoen, J.P., Silva, A.: Foundations of Probabilistic Programming. Cambridge University Press, Cambridge (2020)
Bhat, S., Borgström, J., Gordon, A.D., Russo, C.: Deriving probability density functions from probabilistic functional programs. In: Proceedings of the International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2013) (2013)
Boreale, M., Collodi, L.: Python code for the experiments described in the present paper. https://github.com/Luisa-unifi/probabilistic_programming
Carpenter, B., et al.: A probabilistic programming language. J. Stat. Softw. 76(1) (2017). https://doi.org/10.18637/jss.v076.i01
Chaganty, A., Nori, A.: Efficiently sampling probabilistic programs via program analysis. In: Artificial Intelligence and Statistics (AISTATS) (2013)
Gehr, T., Misailovic, S., Vechev, M.T.: PSI: exact symbolic inference for probabilistic programs. In: Proceedings of the 28th International Conference in Computer Aided Verification (CAV 2016), Toronto, pp. 62–83 (2016)
Goodman, N.D., Mansinghka, V., Roy, D., Bonawitz, K., Tenenbaum, J.: Church: a language for generative models. In: Proceedings of Uncertainty in Artificial Intelligence (2008)
Goodman, N.D., Stuhlmüller, A.: The design and implementation of probabilistic programming languages. http://dippl.org. Accessed 31 Aug 2023
Gordon, A.D., Henzinger, T.A., Nori, A.V., Rajamani, S.K.: Probabilistic programming. In: Proceedings of Future of Software Engineering Proceedings (FOSE 2014), pp. 167–181 (2014)
Gretz, F., Katoen, J.P., McIver, A.: Operational versus weakest pre-expectation semantics for the probabilistic guarded command language. Perform. Eval. 73, 110–132 (2014)
Hoeffding, W.: Probability inequalities for sums of bounded random variables. J. Am. Stat. Assoc. 58(301), 13–30 (1963)
Jansen, N., Dehnert, C., Kaminski, B.L., Katoen, J.P., Westhofen, L.: Bounded model checking for probabilistic programs. In: Proceedings of the International Symposium on Automated Technology for Verification and Analysis (ATVA 2016), vol. 9938, pp. 68–85 (2016)
Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. 22(3), 328–350 (1981)
Maurer, A., Pontil, M.: Empirical bernstein bounds and sample-variance penalization. In: Proceedings of the 22nd Conference on Learning Theory (COLT 2009) (2009)
Milner, R.: Communication and Concurrency. Prentice Hall, International Series in Computer Science (1989)
Moldovan, D.: Autograph documentation. https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/autograph/g3doc/reference/index.md
Munos, R., Audibert, J.Y., Szepesvári, C.: Exploration-exploitation tradeoff using variance estimates in multi-armed bandits. Theoret. Comput. Sci. 410(19), 1876–1902 (2009)
Narayanan, P., Carette, J., Romano, C.S.W., Zinkov, R.: Probabilistic inference by program transformation in hakaru (system description). In: Proceedings of the 13th International Symposium on Functional and Logic Programming (FLOPS 2016), pp. 62–79 (2016)
Nori, A.V., Hur, C.K., Rajamani, S.K., Samuel, S.: An efficient MCMC sampler for probabilistic programs. In: Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, pp. 2476–2482 (2014)
Sankaranarayanan, S., Chakarov, A., Gulwani, S.: Static analysis for probabilistic programs: inferring whole program properties from finitely many paths. In: Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (2013)
Staton, S.: Commutative semantics for probabilistic programming. In: Proceedings of the 26th European Symposium on Programming (ESOP 2017), Uppsala, Sweden (2017)
Staton, S., Wood, F., Yang, H., Heunen, C., Kammar, O.: Semantics for probabilistic programming: higher-order functions. In: Proceedings of the 31st Annual ACM/IEEE Symposium on Logic in Computer Science (LICS) (2016)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Boreale, M., Collodi, L. (2024). Guaranteed Inference for Probabilistic Programs: A Parallelisable, Small-Step Operational Approach. In: Dimitrova, R., Lahav, O., Wolff, S. (eds) Verification, Model Checking, and Abstract Interpretation. VMCAI 2024. Lecture Notes in Computer Science, vol 14500. Springer, Cham. https://doi.org/10.1007/978-3-031-50521-8_7
Download citation
DOI: https://doi.org/10.1007/978-3-031-50521-8_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-50520-1
Online ISBN: 978-3-031-50521-8
eBook Packages: Computer ScienceComputer Science (R0)