[Paper Review] Differentiating through Stochastic Differential Equations: A Primer
This primer presents two complementary approaches to differentiating through SDEs—discretize-then-optimize and optimize-then-discretize—for Itô and Stratonovich dynamics, with detailed derivations and a Black–Scholes example.
Dynamical systems are essential to model various phenomena in physics, finance, economics, and are also of current interest in machine learning. A central modeling task is investigating parameter sensitivity, whether tuning atmospheric coefficients, computing financial Greeks, or optimizing neural networks. These sensitivities are mathematically expressed as derivatives of an objective function with respect to parameters of interest and are rarely available analytically, necessitating numerical methods for approximating them. While the literature for differentiation of deterministic systems is well-covered, the treatment of stochastic systems, such as stochastic differential equations (SDEs), in most curricula is less comprehensive than the subtleties arising from the interplay of noise and discretization require. This paper provides a primer on numerical differentiation of SDEs organized as a two-tale narrative. Tale 1 demonstrates differentiating through discretized SDEs, known the discretize-optimize approach, is reliable for both Itô and Stratonovich calculus. Tale 2 examines the optimize-discretize approach, investigating the continuous limit of backward equations from Tale 1 corresponding to the desired gradients. Our aim is to equip readers with a clear guide on the numerical differentiation of SDEs: computing gradients correctly in both Itô and Stratonovich settings, understanding when discretize-optimize and optimize-discretize agree or diverge, and developing intuition for reasoning about stochastic differentiation beyond the cases explicitly covered.
Motivation & Objective
- Motivate the need for numerical differentiation of stochastic dynamical systems for sensitivities and parameters in physics, finance, and ML.
- Clarify subtleties arising from noise and discretization when differentiating SDEs.
- Provide accessible, classroom-friendly guidance on implementing gradient computations for SDE objectives.
- Bridge deterministic ODE differentiation techniques to stochastic settings via two narrative tales.
Proposed method
- Discretize-then-optimize: discretize forward SDEs with Euler-Maruyama (Itô) or Heun (Stratonovich) schemes and differentiate the discrete objective via automatic differentiation.
- Derive pathwise gradients by differentiating the discrete objective with respect to initial state, enabling backward (adjoint) or forward differentiation; show backward adjoint recursions for Itô and Stratonovich.
- Show that discrete adjoints for Itô converge to a continuous adjoint in deterministic limits and discuss how to handle running costs and additional parameters via state augmentation.
- Use Stratonovich-optimized differentiation with Heun discretization to obtain correct continuous limits and derive the corresponding discrete adjoint recursion.
- Augment state with parameters or running-cost accumulators to compute sensitivities with respect to parameters in the SDEs (e.g., θ) or running costs (Y).
- Validate numerically on the Black–Scholes model by comparing discrete adjoint gradients to analytical Greeks and observing convergence behavior.
Experimental results
Research questions
- RQ1Can gradients of SDE objectives be computed by differentiating through discretized SDE schemes for Itô and Stratonovich formulations?
- RQ2Do discrete adjoints converge to well-defined continuous adjoint processes as the time step vanishes, and how do discretize-optimize and optimize-discretize compare in this limit?
- RQ3How do discretization choices (Euler-Maruyama for Itô vs Heun for Stratonovich) affect accuracy and convergence of gradient estimates?
- RQ4How can parameters and running costs be incorporated into the gradient computation via state augmentation and backward adjoints?
Key findings
- Discretize-then-optimize yields correct gradients for Itô and Stratonovich SDEs when gradients are averaged over stochastic paths.
- Backward (adjoint) recursions reduce computational cost versus full Jacobian propagation, enabling efficient pathwise gradient estimation.
- For Stratonovich SDEs, the Heun scheme provides a forward-compatible discretization that preserves Stratonovich limits and yields a tractable discrete adjoint.
- Numerical validation on Black–Scholes shows gradient error decreases with decreasing time step as O(sqrt(Δt)) in Euler-Maruyama discretization, with Monte Carlo noise causing plateaus at small Δt.
- Augmenting the state to include parameters or running costs allows simultaneous differentiation with respect to initial conditions and parameters (θ, running cost Y).
- The optimize-discretize approach is not generally unbiased for Itô SDEs due to non-smooth stochastic paths, but discretize-optimize remains a safe and direct method for obtaining the exact gradient of the discrete objective.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.