Skip to main content

Guaranteed Inference for Probabilistic Programs: A Parallelisable, Small-Step Operational Approach

  • Conference paper
  • First Online:
Verification, Model Checking, and Abstract Interpretation (VMCAI 2024)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14500))

  • 189 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 74.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    E.g. when multiple threads execute independent chains in a Markov Chain Monte Carlo method.

  2. 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. 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. 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. 5.

    For instance, in Python via the Numpy or TensorFlow packages.

  6. 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. 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

  1. 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

  2. Ash, R.: Real Analysis and Probability. Academic Press Inc., New York (1972)

    Google Scholar 

  3. Baier, C., Katoen, J.P.: Principles of Model Checking. MIT Press, Cambridge (2008)

    Google Scholar 

  4. Barthe, G., Katoen, J.P., Silva, A.: Foundations of Probabilistic Programming. Cambridge University Press, Cambridge (2020)

    Book  Google Scholar 

  5. 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)

    Google Scholar 

  6. Boreale, M., Collodi, L.: Python code for the experiments described in the present paper. https://github.com/Luisa-unifi/probabilistic_programming

  7. Carpenter, B., et al.: A probabilistic programming language. J. Stat. Softw. 76(1) (2017). https://doi.org/10.18637/jss.v076.i01

  8. Chaganty, A., Nori, A.: Efficiently sampling probabilistic programs via program analysis. In: Artificial Intelligence and Statistics (AISTATS) (2013)

    Google Scholar 

  9. 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)

    Google Scholar 

  10. 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)

    Google Scholar 

  11. Goodman, N.D., Stuhlmüller, A.: The design and implementation of probabilistic programming languages. http://dippl.org. Accessed 31 Aug 2023

  12. 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)

    Google Scholar 

  13. 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)

    Article  Google Scholar 

  14. Hoeffding, W.: Probability inequalities for sums of bounded random variables. J. Am. Stat. Assoc. 58(301), 13–30 (1963)

    Article  MathSciNet  Google Scholar 

  15. 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)

    Google Scholar 

  16. Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. 22(3), 328–350 (1981)

    Article  MathSciNet  Google Scholar 

  17. Maurer, A., Pontil, M.: Empirical bernstein bounds and sample-variance penalization. In: Proceedings of the 22nd Conference on Learning Theory (COLT 2009) (2009)

    Google Scholar 

  18. Milner, R.: Communication and Concurrency. Prentice Hall, International Series in Computer Science (1989)

    Google Scholar 

  19. Moldovan, D.: Autograph documentation. https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/autograph/g3doc/reference/index.md

  20. 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)

    Article  MathSciNet  Google Scholar 

  21. 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)

    Google Scholar 

  22. 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)

    Google Scholar 

  23. 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)

    Google Scholar 

  24. Staton, S.: Commutative semantics for probabilistic programming. In: Proceedings of the 26th European Symposium on Programming (ESOP 2017), Uppsala, Sweden (2017)

    Google Scholar 

  25. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Michele Boreale .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics