Machine learningQuantitative FinanceComputational MethodsModel

Greeks via Automatic Differentiation

Also known as: AD Greeks, Algorithmic Differentiation, Autodiff

OriginatorMike Giles, Iman HomescuYear2008Sources2Related methods3

Automatic differentiation (AD) is a computational technique for computing derivatives (Greeks) by differentiating the computer code that computes the option price. AD avoids manual derivation of formulas and finite-difference approximations, yielding exact sensitivities with machine precision. It has become essential for real-time risk management in modern trading systems.

Key highlights

  • Exact computation: computes derivatives to machine precision, avoiding finite-difference rounding errors
  • Speed: typically only 2-5x slower than computing the price alone; much faster than bump-and-reprice
  • Generality: applies to any pricing algorithm (Monte Carlo, PDE, trees) without manual formula derivation
  • Automation: once you have pricing code, Greeks are automatic; no analytical work needed

Intuition

This section is available to Pro members. Upgrade to Pro

How it works

This section is available to Pro members. Upgrade to Pro

When to use it

Use AD for pricing exotic or complex derivatives where Greeks are hard to derive analytically. Essential for Monte Carlo pricing (finite-difference is slow and noisy). Use forward mode AD for few inputs (delta, vega); reverse mode for many inputs or when computing all Greeks simultaneously.

Strengths & limitations

Strengths
  • Exact computation: computes derivatives to machine precision, avoiding finite-difference rounding errors
  • Speed: typically only 2-5x slower than computing the price alone; much faster than bump-and-reprice
  • Generality: applies to any pricing algorithm (Monte Carlo, PDE, trees) without manual formula derivation
  • Automation: once you have pricing code, Greeks are automatic; no analytical work needed
Limitations
  • Implementation overhead: requires AD-capable automatic differentiation tools (TensorFlow, JAX, specialized libraries)
  • Code structure sensitivity: AD works best with clean, differentiable code; conditionals and loops require care
  • Memory overhead (reverse mode): storing intermediate values for backpropagation can exceed memory for large computations
  • Limited third derivatives: computing higher-order Greeks (speed, color) is more complex and slower

Common pitfalls

This section is available to Pro members. Upgrade to Pro

Applications

This section is available to Pro members. Upgrade to Pro

Frequently asked

What is the difference between forward and reverse mode AD?

Forward mode (direct) propagates derivatives forward through the computation graph. Reverse mode (adjoint) propagates backward. Forward mode is faster for few inputs; reverse mode is faster for many outputs. For Greeks, you typically compute many outputs (delta, vega, gamma) from few inputs (spot, vol, rate), so reverse mode is preferred.

How much slower is AD than the original pricing code?

Typically 2-5x slower for reverse-mode AD. You're computing derivatives alongside the price. Compare this to bump-and-reprice (finite difference), which is 100x-1000x slower because you must recompute the price for each input bump.

Can I use AD for Monte Carlo pricing?

Yes. AD differentiates each path's payoff, averaging the derivatives across paths to get the Greek. However, this is noisy (path-specific estimates have high variance). Combine AD with variance-reduction techniques (antithetic, control variates) to reduce variance.

What if my code has if-statements?

AD handles differentiable code best. For non-smooth branches (e.g., 'if spot > strike'), use smooth approximations (logistic function, softplus). Alternatively, separate the code into smooth regimes and differentiate each separately.

Sources

  1. 1.
    Giles, M. B. (2008). Adjoint code by automatic differentiation. Journal of Computational Finance, 12(1), 1-18.
  2. 2.
    Homescu, C. (2011). Adjoints and automatic differentiation in computational finance. arXiv:1107.1188.

You have read it. What now?

Cite this page

ScholarGate. (2026, June 3). Greeks via Automatic Differentiation. ScholarGate. https://scholargate.app/quantitative-finance/greeks-via-automatic-differentiation