Lune

NeurIPS2022Top-tier venue

Automatic Differentiation of Programs with Discrete Randomness

Gaurav Arya, Moritz Schauer, Frank Schäfer, Christopher Rackauckas

Abstract

Automatic differentiation (AD), a technique for constructing new programs which compute the derivative of an original program, has become ubiquitous throughout scientific computing and deep learning due to the improved performance afforded by gradient-based optimization. However, AD systems have been restricted to the subset of programs that have a continuous dependence on parameters. Programs that have discrete stochastic behaviors governed by distribution parameters, such as flipping a coin with probability pp of being heads, pose a challenge to these systems because the connection between the result (heads vs tails) and the parameters (pp) is fundamentally discrete. In this paper we develop a new reparameterization-based methodology that allows for generating programs whose expectation is the derivative of the expectation of the original program. We showcase how this method gives an unbiased and low-variance estimator which is as automated as traditional AD mechanisms. We demonstrate unbiased forward-mode AD of discrete-time Markov chains, agent-based models such as Conway's Game of Life, and unbiased reverse-mode AD of a particle filter. Our code package is available at https://github.com/gaurav-arya/StochasticAD.jl.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

10 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Generalizing Stochastic Smoothing for Differentiation and Gradient Estimation cites Storchastic: A Framework for General Stochastic Automatic Differentiation
  • Probabilistic Programming with Programmable Variational Inference cites Storchastic: A Framework for General Stochastic Automatic Differentiation
  • Probabilistic Programming with Programmable Variational Inference cites ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic Programs
  • Auto-Differentiation of Relational Computations for Very Large Scale Machine Learning cites Storchastic: A Framework for General Stochastic Automatic Differentiation
  • ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic Programs cites Storchastic: A Framework for General Stochastic Automatic Differentiation
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers10

  1. ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic ProgramsAlexander K. Lew, Mathieu Huot, Sam Staton, Vikash K. MansinghkaPOPL 2023 · 16 citations
  2. Probabilistic Programming with Programmable Variational InferenceMcCoy R. Becker, Alexander K. Lew, Xiaoyan Wang, Matin Ghavami et al.PLDI 2024 · 8 citations
  3. Auto-Differentiation of Relational Computations for Very Large Scale Machine LearningYuxin Tang, Zhimin Ding, Dimitrije Jankov, Binhang Yuan et al.ICML 2023 · 7 citations
  4. Learning Individual Behavior in Agent-Based Models with Graph Diffusion NetworksFrancesco Cozzi, Marco Pangallo, Alan Perotti, André Panisson et al.NeurIPS 2025 · 5 citations
  5. Generalizing Stochastic Smoothing for Differentiation and Gradient EstimationFelix Petersen, Christian Borgelt, Aashwin Mishra, Stefano ErmonICML 2026 · 4 citations

Builds on4

  1. Differentiable Particle Filtering via Entropy-Regularized Optimal TransportAdrien Corenflos, James Thornton, George Deligiannidis, Arnaud DoucetICML 2021 · 91 citations
  2. Storchastic: A Framework for General Stochastic Automatic DifferentiationEmile van Krieken, Jakub M. Tomczak, Annette ten TeijeNeurIPS 2021 · 19 citations
  3. ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic ProgramsAlexander K. Lew, Mathieu Huot, Sam Staton, Vikash K. MansinghkaPOPL 2023 · 16 citations
  4. Direct Policy Gradients: Direct Optimization of Policies in Discrete Action SpacesGuy Lorberbom, Chris J. Maddison, Nicolas Heess, Tamir Hazan et al.NeurIPS 2020 · 8 citations

Related papers

  1. Randomized Automatic DifferentiationDeniz Oktay, Nick McGreivy, Joshua Aduol, Alex Beatson et al.ICLR 2021 · 31 citations
  2. Fiber Monte CarloNick Richardson, Deniz Oktay, Yaniv Ovadia, James C. Bowden et al.ICLR 2024
  3. GO Hessian for Expectation-Based ObjectivesYulai Cong, Miaoyun Zhao, Jianqiao Li, Junya Chen et al.AAAI 2021
  4. Diffusion Differentiable ResamplingJennifer R. Andersson, Zheng ZhaoICML 2026 · 2 citations
  5. Slice Sampling Reparameterization GradientsDavid M. Zoltowski, Diana Cai, Ryan P. AdamsNeurIPS 2021 · 8 citations
Dusk over the sea between two cliffs drawn in fine vertical lines