ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic Programs

Alexander K. Lew, Mathieu Huot, Sam Staton, Vikash K. Mansinghka
12/13/2022
cs.PLcs.MSstat.CO

Official code: probcomp/adev (71 stars, Haskell, BSD-3-Clause, last commit 2023-11-21).

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.

Show full abstract

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

View on arXivView PDF

Code Implementations(1)

probcomp/adevOfficial100%
BSD-3-Clause

Haskell prototype to accompany the paper "ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic Programs"

711HaskellNov 15, 20223 years agoBSD-3-Clause

Similar Papers

Cite this paper

@article{lew2022adev,
  title  = {ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic Programs},
  author = {Alexander K. Lew and Mathieu Huot and Sam Staton and Vikash K. Mansinghka},
  year   = {2022},
  eprint = {2212.06386},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2212.06386}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2212.06386.svg)](https://codeofpaper.com/paper/2212.06386)

Discussion