asp53826 / aad-greeks

One reverse sweep,
every Greek.

Adjoint automatic differentiation costs a constant multiple of the price no matter how many inputs you have. This page lets you check that — and the case where it returns a derivative of exactly zero and is wrong.

19 tests accuracy 5.6e-16 cost 1.7–2.4× price vs bumping 49× at n=50 source

The cost claim

Central differences need 2n+1 pricings for n parameters. A reverse sweep needs one forward pass and one backward pass, whatever n is. Drag the basket size and watch which line bends.

10
inputs (n spots + K r σ T)
14
AAD, multiple of price
2.0×
bumping, multiple of price
29×
AAD speedup
14.4×

Points are measured at n = 1, 2, 5, 10, 25, 50 (40,000 paths, Apple M-series, best of five). Wall-clock timings move about 10% between runs, so the claim is the shape — flat against linear — not the exact multiple. Beyond those the bumping line follows the 2n+1 model it has already been shown to obey; the AAD line is held at its measured mean multiple. Hover any measured point for its timings.

The accuracy claim

A bumped derivative trades truncation error against cancellation error, and the crossover moves with the problem. This chart is computed live in your browser from a double-precision Black–Scholes — drag the bump and watch the error find its floor and climb back out.

1e-3
analytic delta
0.5987063256829237
central difference
FD relative error
AAD relative error
5.6e-16

AAD does not appear on this axis as a curve because it has no bump to tune. It differentiates the program rather than the function, so neither error term exists.

Where it is simply wrong

A cash-or-nothing digital pays 1 if the spot finishes above the strike. The payoff is a step, its derivative is zero almost everywhere, and the reverse sweep propagates that faithfully. No error, no NaN, no warning — just a delta of zero.

0.00
true delta
0.019333
pathwise AAD delta
0.000000
relative error
100.0%

The payoff is flat everywhere except one point of measure zero. Every path contributes a derivative of 0, so the sum is 0. This is the correct answer to the wrong question.

methoddeltarelative error
pathwise AAD, sharp payoff0.000000100.0%
central difference, h = 0.50.0193170.1%
AAD, call-spread smoothing h = 2.00.0193250.0%
AAD, call-spread smoothing h = 1.00.0193410.0%
AAD, call-spread smoothing h = 0.250.0193560.1%

Measured, 400,000 paths, common random numbers. The crude method this repository argues against wins outright in this regime, which is why it is on the page rather than in a footnote.

Against the oracle

The analytic Greeks are the textbook formulas written by hand. They share no code with the AD engine, which is the only reason agreement means anything.

greekAADanalyticrelative error

S = 100, K = 100, r = 3%, σ = 20%, T = 1. The whole closed form is 27 tape nodes. Second-order Greeks are deliberately absent: a Hessian costs one reverse sweep per row, so the flat-cost property above does not extend to them.