Most banks and asset managers run quantitative models built on existing libraries: QuantLib, ORE, in-house C++ frameworks, or vendor platforms. Rewriting these libraries for performance is impractical: they contain years of accumulated business logic, regulatory compliance, and edge-case handling. The question is how to accelerate them without rewriting.
The Black-Box Pattern
AADC’s integration pattern treats the existing library as a black box. You do not need to understand, modify, or even have access to the library’s internal source code. The pattern has three steps:
- Hook inputs: Replace market data entry points (yield curves, FX spots, volatility surfaces) with AADC’s active type (
idoublein C++,aadc.idoublein Python) - Hook outputs: Capture the pricing results (NPV, cashflows) as active outputs
- Record and compile: Run the library’s pricing path once. AADC records every mathematical operation performed internally, compiles the graph, and produces a native kernel
ORE as Reference Example
Open Risk Engine (ORE) is an ideal reference because it is open-source, widely used, and built on QuantLib’s complex C++ architecture. The integration requires changes only at the boundary, where market data enters and where NPV exits. ORE’s internal curve construction, interpolation, and instrument pricing are recorded automatically.
The compiled kernel reproduces ORE’s exact numerical results at native machine code speed. All of ORE’s carefully validated pricing logic is preserved; only the execution mechanism changes.
Applicable to Any Library
The same pattern works on any library that performs double-precision arithmetic: in-house C++ pricing engines, vendor libraries (with source access), legacy Fortran code (via C wrappers), and Python/NumPy models. If the library uses standard floating-point operations, AADC can record and compile it.
Published by MatLogica. Implemented using AADC, a commercial adjoint AD compiler (matlogica.com).