Pathwise Greeks and Adjoint Differentiation
Monte Carlo pricing is straightforward when a payoff is an average across simulated paths. Risk is harder: desks need sensitivities to hundreds or thousands of market inputs, and rerunning a bumped valuation for every input is slow and noisy. Pathwise differentiation and adjoint algorithmic differentiation (AAD) address that cost by differentiating the simulated computation.
They are not automatic replacements for bump-and-revalue. The pathwise estimator requires differentiability conditions that discontinuous payoffs violate, while AAD differentiates the implemented algorithm—not necessarily the intended mathematical model. A robust Greek library reports estimator error, discretization error, and model conventions alongside the number.
The pathwise identity
Suppose a price is V(theta)=E[D f(X(theta))], where theta is a model input. If differentiation can be exchanged with expectation, then:
dV/dtheta = E[D * grad_x f(X(theta)) * dX/dtheta]
For a Black-Scholes European call under ST=S0 exp((r-q-.5 sigma^2)T + sigma sqrt(T) Z), the pathwise delta is:
Delta = E[exp(-rT) 1_(S_T>K) S_T/S_0]
One simulated sample produces both payoff and delta contribution. Unlike independent finite-difference runs, their error is driven by a single coherent path sample.
| Estimator | Works well for | Main failure mode |
|---|---|---|
| Pathwise | smooth terminal payoffs | payoff discontinuity |
| Likelihood ratio | discontinuous payoff level | high variance |
| Finite difference | broad fallback | bump/noise trade-off |
| AAD | many smooth input Greeks | implementation complexity |
def call_price_delta_paths(s0, k, r, q, sigma, t, z):
st = s0 * np.exp((r-q-0.5*sigma**2)*t + sigma*np.sqrt(t)*z)
disc = np.exp(-r*t)
payoff = disc * np.maximum(st-k, 0.0)
delta = disc * (st > k) * st / s0
return payoff, delta
At exactly S_T=K, the call payoff is not differentiable, but that event has probability zero under a continuous distribution. For a digital payoff, the derivative is a Dirac mass at strike and the ordinary pathwise estimator is zero almost surely—wrong.
Tangent propagation through a simulation
For a time-stepping model, propagate a tangent alongside every state. If x{n+1}=gn(x_n,theta), then:
dx_(n+1)/dtheta =
g_x dx_n/dtheta + g_theta
This forward mode is attractive for a small number of inputs. It handles path-dependent but smooth claims, such as arithmetic Asian options, provided the step scheme is differentiated consistently. If the pricing code uses full truncation for a variance process or clamps a rate, the tangent must reflect that non-smooth operation and be tested around its boundary.
Why reverse mode changes scaling
AAD applies the chain rule backward. Store or reconstruct intermediate states during the forward valuation, seed the payoff adjoint at one, and accumulate adjoints:
bar_x_n += bar_x_(n+1) * partial g_n / partial x_n
bar_theta += bar_x_(n+1) * partial g_n / partial theta
One reverse sweep yields derivatives with respect to many scalar inputs at a cost commonly a small multiple of the original valuation. The trade-off is memory: storing every state for every path can exceed the cost of pricing. Checkpointing saves selected states and recomputes segments during the backward pass.
| Production choice | Benefit | Cost |
|---|---|---|
| Store all states | simplest reverse pass | high memory |
| Checkpointing | bounded memory | recomputation |
| Bin paths | lower memory | implementation complexity |
| Custom primitives | fast stable derivatives | maintenance burden |
Discontinuities and exercise
Barriers, digitals, autocall observations, and exercise decisions create discontinuities. Smoothing the payoff, conditioning on the last step, or using likelihood-ratio terms can provide usable Greeks, but each changes bias and variance. Never report an AAD Greek merely because the code returned a number: inspect bump-and-revalue ranges and explain the estimator.
American simulation has an extra issue. The exercise policy from a regression is itself parameter-sensitive. Differentiating only realized cash flows treats the stopping boundary as fixed. For risk, freeze-policy Greeks may be reasonable as a stated approximation, but are not full derivatives of the trained Longstaff-Schwartz estimator. See American options and early exercise.
Validation workflow
Use common random numbers for central bumps, then compare AAD or pathwise estimates over several bump sizes. The bump plateau should agree within confidence intervals; a slope indicates bias, an erratic series indicates sampling noise. Validate against analytic Greeks when possible and test homogeneity identities such as S*Delta + ... where applicable.
Pathwise and AAD estimates remain Monte Carlo quantities. Calculate standard errors from per-path derivative contributions, use randomized quasi-Monte Carlo replication when relevant, and separate them from time-grid convergence. Monte Carlo simulation for trading covers the broader sampling discipline.
Key takeaways
- Pathwise differentiation is efficient when the state and payoff are sufficiently smooth.
- Forward tangents scale with inputs; reverse-mode AAD scales with outputs.
- AAD differentiates code, so clamps, branches, and numerical schemes need explicit treatment.
- Digitals, barriers, and exercise boundaries require specialized or approximate estimators.
- Validate Greeks against common-random-number bumps, error bars, and grid refinements.
