← Back to Blog
How-To

Using Claude AI to Accelerate Python Models 345× with AADC

A step-by-step guide showing how an AI coding assistant integrated AADC into a Monte Carlo option pricer, achieving a 345× speedup with minimal manual intervention.

Natalija Karpichina
Natalija Karpichina
· 1 min read
AI Claude AADC Python Monte Carlo option pricing acceleration
345x Performance: AI-Assisted AADC Integration

The barrier to adopting new tools is often not the tool itself but the integration effort. We tested whether an AI coding assistant (Claude) could take an existing Python Monte Carlo option pricer and integrate AADC to achieve production-grade performance, with minimal human guidance.

The Experiment

Starting with a standard GBM Asian option pricer in Python/NumPy, we asked Claude to integrate AADC step by step: replace scalar inputs with active types, record the computation graph, compile the kernel, and evaluate with vectorized inputs. The AI handled the type replacements, the recording pattern, the batch evaluation loop, and the Greek extraction, all following AADC’s documented patterns.

The Result: 345× Speedup

The AADC-integrated version ran 345× faster than the original NumPy implementation on the same workload (50,000 scenarios, 252 timesteps, full Greeks). The AI correctly applied the right optimizations: scalar recording with vector evaluation, single evaluate() call for scenario batches, and separate kernels for price-only versus Greeks modes.

Why This Matters

AADC integration follows a mechanical pattern: identify inputs, record, compile, evaluate. This makes it well-suited for AI-assisted coding. The AI does not need to understand the financial mathematics. It needs to understand the AADC API and apply the recording pattern correctly. This lowers the integration barrier significantly: a quant who has never used AADC can get a working, optimized implementation by describing their model to an AI assistant.

The guide demonstrates that AI-assisted AADC integration is not just feasible but practical, producing code that matches hand-written implementations in both correctness and performance.


Published by MatLogica. Implemented using AADC, a commercial adjoint AD compiler (matlogica.com).

Want to see these results on your own portfolio?

Get in Touch

Interested in these opportunities?

Let's arrange a free demo for you and your team.

Book a Demo