QuantLib AAD QuantLib with AAD: every sensitivity in one adjoint pass.

QuantLibAAD builds QuantLib with XAD, so a pricing computes all its sensitivities in one adjoint pass: 4–29× faster than bumping on QuantLib's samples. QuantLib's library code is unchanged; a few lines of driver code register the inputs, record the pricing and run the adjoint. Open source under the AGPL, with a commercial licence for use in your organisation.

How it works

QuantLib's code unchanged; a few lines around the pricing.

QuantLib is built from its own source with XAD's active type in place of double, through QuantLib's own CMake options. Your code registers the market inputs, records one pricing and runs the adjoint: every sensitivity comes out of that one backward pass, exact rather than bumped.

QuantLibAAD holds the integration headers, the samples and the tests. It is not a fork of QuantLib and is not used on its own: it builds together with QuantLib and XAD. It shows XAD in production-quality use on a code base of several hundred thousand lines.

C++

Build QuantLib with XAD and compute AAD sensitivities, step by step.

QuantLib with AAD in C++

Python

Python bindings for QuantLib with AAD are available from the QuantLibAAD-Py repository.

QuantLibAAD-Py on GitHub
Measured

Risk costs little more than pricing, and far less than bumping.

The figures published with QuantLibAAD, each run on AMD EPYC (Zen 5), one core, Linux, GCC 15, XAD 2.2.0, release build; median of 3 runs.

All sensitivities against bump and revalue

All sensitivities in one adjoint pass, against one-sided bumping: one revaluation per input. A full set of sensitivities costs 2–3.5 valuations.

0× 10× 20× 30× European equity options29× Multi-curve bootstrapping27× Swap portfolio26× Barrier option replication4.4× faster than one-sided bumping 0× 10× 20× 30× European equity options29× Multi-curve bootstrapping27× Swap portfolio26× Barrier option replication4.4× faster than one-sided bumping
SampleInputsXAD, all sensitivitiesBumpingFaster
AdjointEuropeanEquityOption980.24 s6.90 s29×
AdjointMulticurveBootstrapping691.85 s50.5 s27×
AdjointSwap550.45 s11.5 s26×
AdjointReplication131.33 s5.81 s4.4×

Monte Carlo: tape, split mode and code generation

QuantLibAAD's benchmark_aad, 100,000 paths, against bumping. XAD's split mode records the curve once and each path on its own small tape, joined by the chain rule. XAD code generation compiles the recorded valuation to native code and evaluates it vectorised across paths: a commercial add-on, in XAD Enterprise subscriptions.

XADXAD code generation (commercial add-on)
Swaption, 45 inputs 1× 10× 100× XAD tape6.8× XAD split mode11× XAD code generation (commercial add-on)158× faster than bumping (1×), log scale Swaption, 45 inputs 1× 10× 100× XAD tape6.8× XAD split mode11× XAD code generation (commercial add-on)158× faster than bumping (1×), log scale CVA, 90 inputs 1× 10× 100× XAD tape13× XAD split mode22× XAD code generation (commercial add-on)270× faster than bumping (1×), log scale CVA, 90 inputs 1× 10× 100× XAD tape13× XAD split mode22× XAD code generation (commercial add-on)270× faster than bumping (1×), log scale
MethodSwaption (45 inputs)CVA (90 inputs)
Bumping24.5 s48.9 s
XAD tape6.8× faster · 3.62 s13× faster · 3.63 s
XAD split mode11× faster · 2.18 s22× faster · 2.21 s
XAD code generation (commercial add-on)158× faster · 0.15 s270× faster · 0.18 s

The cost of the AD type

10–20% on QuantLib's own examples and test suite: QuantLib built with XAD's active type, running without computing derivatives, against the same build with double.

0 0.5 1 double = 1 QuantLib test suite (1,714 cases)1.13× QuantLib benchmark1.21× QuantLib examples (20)1.10× run time, the build with double = 1 0 0.5 1 double = 1 QuantLib test suite (1,714 cases)1.13× QuantLib benchmark1.21× QuantLib examples (20)1.10× run time, the build with double = 1

Setup for every figure on this page: AMD EPYC (Zen 5), one core, Linux, GCC 15, XAD 2.2.0, release build; median of 3 runs. Published in the QuantLibAAD README, November 2026; reproducible from the samples and benchmark_aad in the repository.

QuantLib is open-source software from its maintainers; Xcelerit is not affiliated with them.

Tested every day

Built and tested every day against QuantLib's master branch.

QuantLibAAD's public pipeline takes QuantLib's master branch and XAD's main branch, builds QuantLib with XAD and runs the checks below: every day at 05:02 UTC, and on every change to QuantLibAAD. When QuantLib changes, a break shows up the next morning, not at the next release.

  • Linux, Windows and macOSQuantLib's own Linux development image, Visual Studio 2022 and macOS; C++17 and C++20, each with XAD's active type and with plain double, plus a build with the standard-library classes in place of Boost: 13 builds in every run.
  • QuantLib's own test suiteQuantLib's full test suite, run with XAD's active type in place of double.
  • Sensitivities checked against bumpingQuantLibAAD's tests compare XAD's sensitivities with bumping on European, American and barrier options, Bermudan swaptions, swaps, bonds, FRAs, credit default swaps and the Heston and Bates models.
  • Every sample, every dayAll ten samples build and run; four of them check their sensitivities against reference values.
  • Installed as a user installs itQuantLib with AAD is installed, and a sample is built against the installed package with CMake.
  • Upstream in QuantLibMore than 50 pull requests from XAD contributors merged into QuantLib since 2022, so QuantLib's own code builds with AD types.

QuantLib's own site lists XAD for AAD on its extensions page, with the daily checks against its master branch. The pipeline and its history are public: QuantLibAAD CI on GitHub.

Samples

Ten samples, from a swap book to a calibrated model.

Each sample prices with QuantLib and computes its sensitivities with XAD; built with plain double, most compute the same sensitivities by bumping, for comparison.

  • AdjointEuropeanEquityOptionA portfolio of European equity options on QuantLib's analytic engine: every sensitivity, timed against bumping.On GitHub
  • AdjointMulticurveBootstrappingSensitivities to the market quotes behind a multi-curve bootstrap.On GitHub
  • AdjointSwapA portfolio of swaps off a bootstrapped curve: sensitivities to every deposit, FRA and swap quote.On GitHub
  • AdjointReplicationQuantLib's Replication sample with AAD: a barrier option replicated with European options.On GitHub
  • AdjointBermudanSwaptionA Bermudan swaption under a Hull-White model calibrated to swaptions, priced on a finite-difference grid: vegas to the calibration volatilities.On GitHub
  • AdjointCDSA credit default swap: sensitivities to the discount curve, the hazard rates, recovery and the coupon.On GitHub
  • AdjointAmericanEquityOptionAn American option on a finite-difference engine, with its Greeks from XAD.On GitHub
  • AdjointHestonModelSensitivities through a calibrated Heston model by the implicit function theorem: 114 market inputs, without recalibrating or recording the optimiser.On GitHub
  • AdjointScalingThe cost of all sensitivities as the inputs grow from 29 to 509, AAD against bumping, on a book of 250 options.On GitHub
  • AdjointTradeRiskTrade-level risk: the sensitivity of each of 200 swaps to each of 45 curve quotes.On GitHub
Licence

Open source, with commercial terms when you need them.

QuantLibAAD's integration code is open source under the AGPL, and QuantLib's own code keeps its BSD licence. For use in your organisation, an annual XAD subscription gives you a commercial licence. XAD itself is open source under the AGPL too. In QuantLibAAD, the integration headers are under the AGPL, while the tests and samples, modified from QuantLib, keep QuantLib's licence.

XAD licensing in plain words

Work with us

On your own QuantLib code, or your own library.

AAD enablement

We put AAD into your library: extensions, custom products and in-house pricers, on QuantLib or your own code, in a short, fixed-scope build. The code is yours.

AAD enablement

XAD subscriptions

Commercial terms in place of the AGPL, support and the XAD validation pack; Enterprise adds XAD code generation.

XAD subscriptions

AAD training

The AAD course taken by quant teams at leading banks, taught by the team that built XAD, with a hands-on workshop on your own code.AAD training
Questions

QuantLib and AAD, in short.

Does QuantLibAAD change QuantLib's code?

No. QuantLib is built from its own source with XAD's active type in place of double, through QuantLib's own build options. Your code registers the inputs, records the pricing and runs the adjoint, as the samples show.

Which QuantLib version does it work with?

It is built and tested every day against QuantLib's master branch, from which QuantLib's releases are made, on Linux, Windows and macOS with C++17 and C++20.

What does AAD cost on top of a pricing?

On QuantLib's samples, a full set of sensitivities costs 2–3.5 valuations, against one valuation per input for bumping. The AD type itself adds 10–20% when no derivatives are computed.

Can we use it in our organisation?

QuantLibAAD's integration code and XAD are open source under the AGPL, which is not suitable for enterprise settings: for use in your organisation, an annual XAD subscription gives you a commercial licence, support and the XAD validation pack. XAD licensing in plain words.

Is there a Python version?

Yes: Python bindings for QuantLib with AAD are available from the QuantLibAAD-Py repository.

QuantLib

Talk to us about QuantLib with AAD

Commercial terms for QuantLibAAD and XAD, AAD for your own extensions and pricers, or code generation for your Monte Carlo.

QuantLib's code unchanged · Exact derivatives, checked against bumping · Tested daily against QuantLib's master

We use these details to reply to you and follow up on your enquiry. See our Privacy policy.