MatLogica | AADC Integration Guide - MatLogica Implementation in Weeks

AADC Integration Guide - MatLogica Implementation in Weeks

Integration Approach: Deploy AADC in Weeks, Not Months

Learn how MatLogica AADC integrates seamlessly into your existing codebase to transform object-oriented code into data-oriented performance, achieving 6-100x speed-ups for derivatives pricing analytics and ultra-fast AAD sensitivities computation

MatLogica AADC Integration Process

MatLogica AADC integration is designed for rapid deployment in quantitative finance environments, taking weeks instead of the months or years required by competitors. The process involves three main steps: (1) automated drop-in replacement of double with idouble type, (2) recording Monte Carlo functions with marked inputs/outputs for kernel generation, and (3) executing optimized kernels for 6-100x performance gains. The integration requires minimal code changes and can be performed by experienced quant developers with little to no additional training. MatLogica provides comprehensive tooling including automated integration scripts, debugging toolkit for numerical difference detection, and diagnostics toolkit for branch handling verification. Unlike traditional operator overloading AAD libraries that slow code by ~2x, AADC maintains full performance during development through its no-trade-off integration approach. The semi-automated process works with legacy codebases (10+ years old, 10M+ lines of code) in C++, C#, and Python. Integration scripts can be incorporated into CI/CD pipelines, enabling teams to maintain a single code branch during integration while gradually transitioning to production with full confidence. Organizations can choose to perform integration internally, work with MatLogica experts, or engage certified third-party vendors.
Integration consulting available

MatLogica uses an unorthodox integration approach that delivers 6-100x performance results in a few weeks, while our competitors can take months or even years to implement. The required code changes are minimal and can be performed by an experienced quant developer or software engineer with little to no additional training in automatic differentiation or AAD concepts.

You can perform the AADC integration yourself using our comprehensive toolkit, invite our integration expert for hands-on assistance, or work with a certified third-party vendor to supercharge your quantitative finance systems with automatic adjoint differentiation capabilities.

What Does it Take to Integrate MatLogica AADC?

Integrating AADC into Existing Quantitative Finance Libraries

For well-established quant libraries (10+ years old, 10 million+ lines of code), performance optimization, numerical stability, and minimal refactoring effort are critical factors when considering any technology upgrade. Incorporating MatLogica AADC is a semi-automated process powered by a rich set of integration tools and methodologies to assist the initial integration and debugging processes for derivatives pricing and risk management systems.

An automated replacement of double with idouble (MatLogica's active type) is required as a first step, resulting in the same numerical and performance results as the original code. The next step is to identify the main Monte Carlo simulation loop, mark the inputs and outputs, and indicate the recording of the parameters for a single path to obtain the optimized kernel for use in subsequent iterations. While this process demands a nuanced understanding of the library's intricacies, the integration process is straightforward and its benefits are profound—transforming legacy financial code into a high-performance powerhouse with automatic differentiation capabilities.

Using MatLogica AADC for a New Quantitative Finance Project

By leveraging AADC's capabilities from the outset and architecting quant libraries from the ground up, developers are liberated from the time-consuming challenge of retrofitting an existing codebase. There are three main benefits to this greenfield approach: (1) clean up-front design optimized for performance, (2) minimal wasteful development efforts on manual optimizations, and (3) a guilt-free path to harnessing the full potential of modern hardware (AVX512, multi-threading). Starting afresh with AADC is therefore an opportunity to craft a derivatives pricing library with baked-in efficiency, enabling a seamless process for subsequent iterations and model additions.

A Step-by-Step Approach to Integrating MatLogica AADC

Step 1: Drop-in Replacement with Active Type

As a first step, the MatLogica active type (idouble) must be introduced into the quantitative library. This active type enables MatLogica AADC to extract the valuation graph from your derivatives pricing or risk calculation functions.

This transformation can be performed by running a suite of automated integration scripts that safely and efficiently transform an existing codebase into a robust framework, ready to harness the benefits of MatLogica AADC for automatic differentiation and performance optimization.

AADC Integration Step 1: Automated drop-in replacement of double with idouble type throughout codebase
AADC Integration: Step 1 - Drop-in Replacement of double with idouble

An automated replacement of double with idouble is required as a first step, resulting in the same numerical and performance results as the original financial models. The next step is to identify the main Monte Carlo loop in your derivatives pricing code, mark the inputs and outputs, and indicate the recording of the parameters for a single simulation path to obtain the kernel for use in subsequent iterations. While this process demands a nuanced understanding of the library's intricacies, the integration process is straightforward and its benefits are profound—transforming legacy code into a high-performance powerhouse.

Step 2: Record the Pricing Function for Kernel Generation

Next, we identify the function that is executed in Monte Carlo simulations and/or needs to have sensitivities (Greeks) computed using automatic adjoint differentiation. We instruct AADC to record the function and specify the inputs (market data, trade parameters) and outputs (valuations, cashflows) of the function.

AADC Integration Step 2: Recording Monte Carlo function with marked inputs and outputs for kernel generation
AADC Integration: Step 2 - Recording Function for Kernel Generation

Once this step is complete, AADC will record the optimized kernels that represent this pricing function with automatic differentiation capabilities.

Step 3: Execute the Optimized Function

Once we have the recording (optimized kernel), it is used instead of the original function to compute the derivatives valuation itself and its sensitivities (Greeks) where needed using ultra-fast automatic adjoint differentiation.

All done! Your quantitative finance code now runs 6-100x faster with full AAD capabilities.

AADC Integration Step 3: Execute optimized kernel for 6-100x faster performance with automatic differentiation
AADC Integration: Step 3 - Execute the Optimized Function with AAD

Integration complete! Your derivatives pricing and risk systems now benefit from 6-100x performance gains.

What if Something Goes Wrong During Integration?

Debugging Toolkit for Numerical Verification

In most cases, the results produced by AADC are identical to the numbers produced by the original derivatives pricing program. In some instances, numerical differences can be observed due to optimizations performed by AADC's JIT compiler. Consider an expression (a+b+c): mathematically, the order of operations doesn't matter, but in computer arithmetic, it may be impactful due to compounded floating-point rounding differences in financial calculations.

AADC comes with a comprehensive debugging toolkit that targets such corner cases. It will point exactly to the line of code where numerical differences arise, allowing confident resolution of any mismatches between original and optimized code.

Diagnostics Toolkit for Branch Handling

Also important is the correct handling of branches and if-statements in stochastic models. When the pricing function depends on stochastic conditions (e.g., barrier options, path-dependent payoffs), both branches must be recorded for accurate kernel generation. MatLogica's Diagnostics toolkit is designed for this purpose and will flag any part of the code where branches are not handled correctly, ensuring robust automatic differentiation across all code paths.

No-Trade-off Integration Explained

Introducing a traditional operator overloading AAD library will slow down the codebase by a factor of approximately 2x during development. MatLogica has developed a unique approach that avoids this undesired performance penalty, and the code will not slow down once AADC is introduced—maintaining full speed throughout the integration and testing phases.

Our semi-automated integration approach enables you to maintain a single branch of code during the integration and development processes. MatLogica integration scripts can be part of your CI/CD pipeline, meaning that team members will not be impacted by the changes introduced during gradual rollout. You can then transition to production once you have full confidence in the results from comprehensive testing and validation!