Basic Prerequisites: 03 · BSDEs & Nonlinear Feynman–Kac and Deep Learning for Sequences.
1. Intuition & Practical Objective
Pages 02–03 produced the object: a semi-linear PDE, equivalently a BSDE, whose solution is a pair - the price and the hedge. Page 04 is about computing it when the dimension is too large for a grid and the payoff too non-linear for a closed form. There are two complementary algorithms, and they solve the same equation from opposite ends:
| Deep BSDE (E–Han–Jentzen 2017) | Deep Galerkin / DGM (Sirignano–Spiliopoulos 2018) | |
|---|---|---|
| what is minimised | the terminal mismatch | the PDE residual (+ terminal penalty) |
| how the equation is used | integrated forward along simulated paths | differentiated at sampled collocation points |
| what the network outputs | (the hedge) at each step | (the value) directly |
| strengths | low dimension per step, hedging-native, no second derivatives | mesh-free, handles free boundaries and irregular domains, gives everywhere |
| weaknesses | needs a good -architecture; pain at the terminal layer | residual needs (second derivatives of a network), harder to train |
The one-sentence essence:
Both methods replace the unknown function by a neural network and the equation by a Monte-Carlo loss; Deep BSDE parametrises the control and enforces the terminal condition, Deep Galerkin parametrises the value and enforces the differential equation - and they exist because the classical curse of dimensionality (grid cost ) is not shared by Monte Carlo or by gradient-based function approximation.
Four things to carry out of this page:
- The loss is the whole algorithm. Deep BSDE’s loss is only the terminal mismatch - the dynamics are imposed by construction through the forward recursion . That is why it is often described as “a BSDE solved forward”: there is no residual to estimate, hence no second derivatives, hence no discretisation of a differential operator.
- The trainable objects are the hedge, not the price. The initial value is a single scalar; everything else is . A solver that recovers the price but not the hedge has trained the 1-dimensional part of the problem and failed the infinite-dimensional part (§3 shows the price converging to while the hedge needs the same iterations to reach ).
- Deep BSDE is not inherently “deep”. The “deep” is in the time direction: the network is applied at each of time steps with shared or step-specific weights, so the composite map is layers deep. The per-step architecture is often shallow - a linear combination of a few features already reproduces Black–Scholes (§3).
- Dimension is the motivation. For a finite-difference grid needs nodes; the Deep BSDE of Han–Jentzen–E reaches with a handful of networks because the Monte Carlo error is dimension-free and the network represents the function compactly. This is the commercial argument for the method, and it applies to hedging (baskets, multi-factor models) exactly as it applies to pricing.
The practical objective: write down both loss functions, implement the Deep BSDE forward scheme with a from-scratch optimiser, understand why the terminal-mismatch loss contains no differential operator, and know the DGM residual’s shape well enough to sanity-check it.
2. Mathematical Ground Truth & Derivations
2.1 The Deep BSDE loss (terminal-mismatch form)
Discretise into steps, , , . Parametrise
and define by the forward recursion (this is the whole trick - the backward SDE is turned into a forward one by treating as the unknown):
and train by the only loss available,
(E–Han–Jentzen 2017; E–Han–Jentzen 2018, PNAS). Why this is legitimate:
- The dynamics are exact by construction. Whatever is, the path satisfies the discretised BSDE; only the terminal condition can fail. Minimising the terminal mismatch therefore forces the discretised solution, and at the optimum approximates and approximates .
- No derivatives of the network appear. The loss contains no ; the drift of is the driver, which is known. This is why Deep BSDE is easy to train relative to DGM.
- The hedge comes for free. : the network is the hedge (in diffusive units). Deep BSDE is a hedging algorithm that happens to price.
- Variance reduction is essential. The gradient of the loss is an expectation over paths, so the Monte-Carlo error of the gradient is the training noise; antithetic sampling, common random numbers across iterations and batch-size control are what make it converge (see NM · 04 Variance Reduction).
2.2 The Deep Galerkin loss (residual form)
Parametrise the value directly, , and minimise the PDE residual on collocation points plus a terminal penalty,
(Sirignano–Spiliopoulos 2018). Because the residual is evaluated by sampling , the method needs no mesh - the same reason Monte Carlo beats finite differences in high dimension - but it demands second derivatives of the network ( contains ), which are available by autodiff but noisy, and it must be trained to satisfy the terminal condition and the interior simultaneously (a balance that the weight controls).
2.3 The LSMC baseline (what the networks replace)
Before either method there was least-squares Monte Carlo (Longstaff–Schwartz 2001 for American options; Gobet–Lemor–Warin 2005 for BSDEs):
The -estimator is exact for the discretised problem: since and , the martingale representation of gives . The three methods then differ only in the function class used for the conditional expectation:
| method | function class for |
|---|---|
| LSMC (vanilla) | a fixed basis (polynomials, payoff functions) |
| LSMC + regression trees | trees / boosting (Longstaff–Schwartz’s own suggestion) |
| Deep BSDE | a neural network, in the time-direction stack |
| Deep hedging | a neural network, applied to the risk measure over whole paths |
This table is the cleanest way to see the whole family: the algorithms differ in what they plug into the regression slot, and in what they regress.
3. Computational Implementation - Deep BSDE trained from scratch, and the DGM residual
We implement the Deep BSDE forward scheme with a frozen-feature -net - a one-hidden-layer network whose nonlinearities are fixed (1, u, u², tanh), leaving only the output weights trainable - so that the exact gradient is available in closed form and full-batch SGD needs no autodiff. That keeps the whole algorithm standard-library. We then verify the DGM residual loss on the same PDE with a one-parameter hypothesis class.
Reading the output.
- The Deep BSDE converges to the right price and the right hedge. Loss falls ; the price goes from the initial guess to (Black–Scholes , a gap) and the hedge from (a deliberately wrong start) to (Black–Scholes , ). By iteration both are essentially converged - the residual gap is the SGD step size, not a bias.
- The floor of the loss is the discretisation, not the optimiser. The loss bottoms out near , i.e. an RMS terminal mismatch of - the same order as the 4-step discrete-hedging error of 05 · Failure Modes & Practice ( at ). A Deep BSDE loss that stops decreasing at a positive value is not a bug: it is the model’s own residual. This is the single most misread output of the whole method.
- The DGM residual has the right shape and the right minimiser. The residual loss is -shaped with an interior zero at , exactly the true : the loss drops from () to (), bottoms at with residual (finite-difference noise only), and rises again to at . Note the asymmetry: the loss is larger and rises faster on the low- side, because the residual is - a useful reminder that a DGM loss is a quadratic form in the wrong parameter, and the network must find its minimum, not its “flat” region.
- The -net matters more than the -scalar. Sixteen of the seventeen trainable parameters sit in the -net ( time steps features); the price is one scalar. Everything in the convergence curve after iteration 3 is the hedge being refined. This is the algorithmic counterpart of the LSMC asymmetry of page 03.
4. Failure Modes & First-Principles Breakdowns
- Reading the loss floor as a training failure. As above: a positive terminal-mismatch loss at the optimum is the discretisation residual. The correct diagnostic is whether the loss equals the model’s own hedging error, not whether it reaches zero.
- Not realising that with the price is pinned by the mean and all the learning is in . Since is -measurable and is independent of , , so for any -net. Minimising then forces (the mean-matching condition) and the -net can only reduce the variance of the mismatch. So in the linear case Deep BSDE is variance-optimal hedging by variance reduction, and a solver that converges to the right price has proved almost nothing about the hedge. (For the driver term breaks the mean-decoupling and does depend on the strategy - another reason the entropic/quadratic case is genuinely more interesting than Black–Scholes.)
- Training the price and calling it a hedge. is one parameter; validate against a known hedge - Black–Scholes in the complete-market limit, the BSDE in an exactly-solvable case (page 03), or a finite-difference delta of an independently computed price. The price is not evidence about the strategy.
- Architecture mismatch between the -net and the true hedge. The hedge is a function of the state; a -net that does not see the state (e.g. a per-step constant) can never learn a delta that varies with moneyness. In the hub code the features are in - chosen because the Black–Scholes delta is a smooth sigmoid-like function of . A feature set that cannot represent the true produces a bias, not noise.
- Learning rate as a landmine. 05 · Failure Modes & Practice shows the identical loss and data converging at and exploding at ; the stability threshold scales with the largest eigenvalue of the Monte-Carlo design matrix, which grows with the number of paths and the magnitude of the -features. There is no “safe default” - the learning rate must be tuned per problem, and the loss curve must be watched.
- Ignoring the SGD noise floor. Full-batch SGD on a Monte-Carlo loss has gradient noise . Small learning rates stall above the true optimum; large rates bounce around it. The observable is the variance of the loss across the last iterations, not its mean.
- Using Deep Galerkin where Deep BSDE is appropriate (and vice versa). DGM needs : for a rough value function (digital payoffs at the money, barriers, early exercise) the second derivative is singular and the residual loss diverges. Deep BSDE integrates along paths and never differentiates the value - better for non-smooth payoffs. Conversely, DGM gives a function for all and handles free boundaries naturally, which is why it is the method of choice for American options and PDE formulations.
- Assuming dimension-freeness means accuracy-freeness. Monte Carlo error is dimension-free in rate, not in constant: for a -dimensional problem the variance of the terminal mismatch grows with (a basket option has more residual risk), so the path count needed for a fixed accuracy grows. The correct claim is ” in any dimension”, not “equally accurate in any dimension”.
- Forgetting the barrier/terminal treatments. Deep BSDE samples paths forward: a barrier or early-exercise feature must be encoded in the terminal condition or in the driver, and a naive implementation prices a different contract. DGM encodes it as a boundary penalty. In both cases the encoding error is silent.
5. References
- E, W., Han, J., Jentzen, A. (2017), Deep learning-based numerical methods for high-dimensional parabolic partial differential equations and backward stochastic differential equations, Communications in Mathematics and Statistics 5(4), 349–380
- Sirignano, J. & Spiliopoulos, K. (2018), DGM: a deep learning algorithm for solving partial differential equations, Journal of Computational Physics 375, 1339–1364
- Pham, H., Warin, X., Germain, M. (2020), Neural networks-based backward scheme for fully nonlinear PDEs, SN Partial Differential Equations and Applications 2(16)
- Longstaff, F. & Schwartz, E. (2001), Valuing American options by simulation: a simple least-squares approach, Review of Financial Studies 14(1), 113–147
- Buehler, H., Gonon, L., Teichmann, J., Wood, B. (2019), Deep Hedging, Quantitative Finance 19(8), 1271–1291
- Beck, C., Becker, S., Cheridito, P., Jentzen, A., Neufeld, A. (2019), Deep splitting method for parabolic PDEs; Beck, C., E, W., Jentzen, A. (2019), Machine learning approximation algorithms for high-dimensional fully nonlinear PDEs and second-order BSDEs
6. Connected Graph Bridges
- Back: 03 · BSDEs & Nonlinear Feynman–Kac · 02 · Convex Risk & the Objective
- Forward: 05 · Failure Modes & Practice · 06 · Advanced Extensions · Index Hub
- Numerics: Numerical Methods · NM · 03 Monte-Carlo Pricing · NM · 04 Variance Reduction · NM · 04 Numerical Optimization · C&O · 05 Gradient & Newton Methods
- PDE / boundary cases: American Options & Optimal Stopping · American · 04 Free Boundary & Complementarity · NM · 02 Finite-Difference Methods
- ML: Deep Learning for Sequences · Reinforcement Learning for Trading · RL · 04 Policy Gradient & Actor-Critic · Financial ML Pitfalls & Low SNR