ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic Programs

Type: Article

Publication Date: 2023-01-09

Citations: 9

DOI: https://doi.org/10.1145/3571198

Abstract

Optimizing the expected values of probabilistic processes is a central problem in computer science and its applications, arising in fields ranging from artificial intelligence to operations research to statistical computing. Unfortunately, automatic differentiation techniques developed for deterministic programs do not in general compute the correct gradients needed for widely used solutions based on gradient-based optimization. In this paper, we present ADEV, an extension to forward-mode AD that correctly differentiates the expectations of probabilistic processes represented as programs that make random choices. Our algorithm is a source-to-source program transformation on an expressive, higher-order language for probabilistic computation, with both discrete and continuous probability distributions. The result of our transformation is a new probabilistic program, whose expected return value is the derivative of the original program's expectation. This output program can be run to generate unbiased Monte Carlo estimates of the desired gradient, which can then be used within the inner loop of stochastic gradient descent. We prove ADEV correct using logical relations over the denotations of the source and target probabilistic programs. Because it modularly extends forward-mode AD, our algorithm lends itself to a concise implementation strategy, which we exploit to develop a prototype in just a few dozen lines of Haskell (https://github.com/probcomp/adev).

Locations

  • Proceedings of the ACM on Programming Languages - View - PDF
  • arXiv (Cornell University) - View - PDF
  • DSpace@MIT (Massachusetts Institute of Technology) - View - PDF
  • Oxford University Research Archive (ORA) (University of Oxford) - View - PDF
  • DataCite API - View

Similar Works

Action Title Year Authors
+ Automatic Differentiation of Programs with Discrete Randomness 2022 Gaurav Arya
Moritz Schauer
Frank Schäfer
Christopher Rackauckas
+ $ω$PAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programs 2023 Mathieu Huot
Alexander K. Lew
Vikash K. Mansinghka
Sam Staton
+ Towards Verified Stochastic Variational Inference for Probabilistic Programs 2019 Wonyeol Lee
Hangyeol Yu
Xavier Rival
Hongseok Yang
+ Towards Denotational Semantics of AD for Higher-Order, Recursive, Probabilistic Languages 2021 Alexander K. Lew
Mathieu Huot
Vikash K. Mansinghka
+ PDF Chat Towards Denotational Semantics of AD for Higher-Order, Recursive, Probabilistic Languages 2021 Alexander K. Lew
Mathieu Huot
Vikash K. Mansinghka
+ Towards Denotational Semantics of AD for Higher-Order, Recursive, Probabilistic Languages 2021 Alexander K. Lew
Mathieu Huot
Vikash K. Mansinghka
+ PDF Chat Towards verified stochastic variational inference for probabilistic programs 2019 Wonyeol Lee
Hangyeol Yu
Xavier Rival
Hongseok Yang
+ PDF Chat Automatic Differentiation in Prolog 2023 Tom Schrijvers
Birthe van den Berg
Fabrizio Riguzzi
+ Automatic Differentiation in Prolog 2023 Tom Schrijvers
Birthe van den Berg
Fabrizio Riguzzi
+ An Introduction to Probabilistic Programming 2018 Jan-Willem van de Meent
Brooks Paige
Hongseok Yang
Frank Wood
+ PDF Chat Smoothness Analysis for Probabilistic Programs with Application to Optimised Variational Inference 2023 Wonyeol Lee
Xavier Rival
Hongseok Yang
+ Expectation Programming: Adapting Probabilistic Programming Systems to Estimate Expectations Efficiently 2021 Tim Reichelt
Adam Goliński
C.-H. Luke Ong
Tom Rainforth
+ Smoothness Analysis for Probabilistic Programs with Application to Optimised Variational Inference 2022 Wonyeol Lee
Xavier Rival
Hongseok Yang
+ PDF Chat The Elements of Differentiable Programming 2024 Mathieu Blondel
Vincent Roulet
+ Expectation Programming. 2021 Tim Reichelt
Adam Goliński
C.-H. Luke Ong
Tom Rainforth
+ SPPL: probabilistic programming with fast exact symbolic inference 2021 Feras A. Saad
Martin Rinard
Vikash K. Mansinghka
+ Proving Expected Sensitivity of Probabilistic Programs with Randomized Variable-Dependent Termination Time 2019 Peixin Wang
Hongfei Fu
Krishnendu Chatterjee
Yuxin Deng
Ming Xu
+ PDF Chat Proving expected sensitivity of probabilistic programs with randomized variable-dependent termination time 2019 Peixin Wang
Hongfei Fu
Krishnendu Chatterjee
Yuxin Deng
Ming Xu
+ PDF Chat Compositional Expected Cost Analysis of Functional Probabilistic Programs 2024 Pedro H. Azevedo de Amorim
+ PDF Chat Proving expected sensitivity of probabilistic programs 2017 Gilles Barthe
Thomas Espitau
Benjamin Grégoire
Justin Hsu
Pierre-Yves Strub