Quant techniques · computational finance

Adjoint algorithmic differentiation: many Greeks in one reverse pass

A portfolio price may depend on thousands of curves, volatilities, correlations, and market quotes. Bump-and-revalue computes one sensitivity at a time, so a complete risk vector can require thousands of repricings. Adjoint algorithmic differentiation (AAD) applies reverse-mode automatic differentiation to the pricing computation: after one forward valuation, a reverse sweep propagates the price sensitivity back to all inputs.

Greeks from one reverse pass

Model evaluations
Two-sided finite differences
Model evaluationsTwo-sided finite differences

Illustrative reverse-mode cost: about one forward and one reverse evaluation.

The chain rule on a computation graph

Suppose a program maps inputs x∈Rnx\in\mathbb R^n to a scalar price V(x)V(x). The calculation consists of elementary operations such as additions, products, exponentials, and conditional branches. For a simple chain

y=f(x),z=g(y),V=h(z),y=f(x),\qquad z=g(y),\qquad V=h(z),

the forward pass stores intermediate values. The reverse pass starts with the output adjoint Vˉ=∂V/∂V=1\bar V=\partial V/\partial V=1 and applies the chain rule backward:

zˉ=Vˉ∂h∂z,yˉ=zˉ∂g∂y,xˉ=yˉ∂f∂x.\bar z=\bar V\frac{\partial h}{\partial z},\qquad \bar y=\bar z\frac{\partial g}{\partial y},\qquad \bar x=\bar y\frac{\partial f}{\partial x}.

For a scalar output and nn inputs, reverse mode computes the full gradient ∇xV\nabla_xV with work proportional to the computation graph, largely independent of nn. Forward-mode differentiation is more efficient when there are few inputs and many outputs; reverse mode is especially useful for one or a few prices with many risk factors.

A portfolio illustration

Suppose a price is

V(x1,x2)=x12x2+ex2.V(x_1,x_2)=x_1^2x_2+e^{x_2}.

Let u=x12x2u=x_1^2x_2 and v=ex2v=e^{x_2}, so V=u+vV=u+v. The reverse sweep gives

∂V∂x1=2x1x2,∂V∂x2=x12+ex2.\frac{\partial V}{\partial x_1}=2x_1x_2,\qquad \frac{\partial V}{\partial x_2}=x_1^2+e^{x_2}.

The same principle applies to a much larger numerical pricing graph. Every market quote is an input node; the output price’s adjoint is propagated through calibration, curve construction, simulation, discounting, and payoff aggregation. This can give deltas to all quotes in one pass, provided the whole calculation is differentiated consistently.

AAD versus Monte Carlo pathwise Greeks

AAD is a way to differentiate a numerical program. Pathwise differentiation is a way to differentiate an expectation under suitable conditions. AAD can automate the chain rule needed for pathwise sensitivities through a simulator, but it does not remove the mathematical limitations of differentiating discontinuous payoffs or the sampling noise of Monte Carlo.

Why the reverse pass is not free

Reverse mode needs intermediate values from the forward pass. Storing every state can consume substantial memory, especially for long simulations with many time steps and risk factors. Checkpointing addresses this by saving selected states and recomputing parts of the forward path during the reverse sweep, trading extra computation for lower memory.

The method also depends on a differentiable implementation. Hard exercise decisions, barriers, clipping, and branch-dependent logic create kinks or discontinuities. AD returns derivatives of the implemented computational graph under its local rules; at nonsmooth points, that derivative may not represent the desired financial sensitivity. Smoothing, conditional expectation, likelihood-ratio methods, or carefully defined subgradients may be more appropriate.

If the price includes Monte Carlo randomness, keep random numbers fixed when differentiating a pathwise estimator. The resulting gradient is a sample estimate with Monte Carlo error, not an exact model Greek. Validate selected sensitivities against common-random-number bump-and-revalue, analytic benchmarks, or independent simulations.

A practical workflow

  1. Define the market inputs and scalar outputs whose sensitivities are needed.
  2. Build a computational graph with consistent units, conventions, and explicit calibration dependencies.
  3. Run a forward valuation while storing or checkpointing required intermediate states.
  4. Seed the output adjoint with one and execute the reverse sweep.
  5. Validate representative deltas and cross-check high-impact risks with independent methods.
  6. Report Monte Carlo error and investigate instability near exercise boundaries, barriers, or calibration degeneracies.

Common mistakes

  • Claiming AAD makes sensitivity computation independent of portfolio complexity. It can greatly reduce the incremental cost, but the forward valuation and reverse sweep still have costs.
  • Treating algorithmic derivatives as model-free risk. AAD differentiates the implemented model and calibration assumptions.
  • Ignoring memory use in a long path simulation; checkpointing or recomputation may be required.
  • Expecting stable Greeks through a discontinuous exercise rule without smoothing or specialised treatment.
  • Comparing AAD and finite differences with independent random paths, letting Monte Carlo noise swamp the comparison.

Practice

ModeA scalar portfolio price depends on 5,000 market quotes. Which AD mode is usually attractive for computing all first-order sensitivities, and why?
Show answer

Reverse mode. One reverse sweep computes the gradient of a scalar output with respect to many inputs, with work roughly proportional to the pricing graph rather than requiring a full revaluation per quote.

AdjointFor V = x²y + exp(y), what are ∂V/∂x and ∂V/∂y?
Show answer

∂V/∂x=2xy\partial V/\partial x=2xy and ∂V/∂y=x2+ey\partial V/\partial y=x^2+e^y.

Monte CarloDoes differentiating a Monte Carlo pricer with AAD eliminate sampling error in the Greek?
Show answer

No. It differentiates the simulated computation. The resulting sensitivity remains a Monte Carlo estimator and should be accompanied by an error estimate and validation.

Further reading: Capriotti and Giles (2024), “15 Years of Adjoint Algorithmic Differentiation in Finance,” Quantitative Finance 24(9), 1353–1379. Author-hosted review.