MatLogica | AADC vs JAX, PyTorch, TensorFlow: 40x Faster Performance Benchmark

AADC vs JAX, PyTorch, TensorFlow: 40x Faster Performance Benchmark

Benchmark Results: AADC is 40x+ faster than JAX, PyTorch, and TensorFlow

A comprehensive benchmark comparing JAX, PyTorch and TensorFlow vs MatLogica AADC for Quantitative Finance Applications and Machine Learning use cases.

Request a demo

AADC vs JAX PyTorch TensorFlow Performance Benchmark

This benchmark compares MatLogica AADC (Automatic Adjoint Differentiation Compiler) against leading machine learning frameworks (JAX, PyTorch, TensorFlow) for quantitative finance workloads. The test uses a down-and-out European Call Option with 50,000 Monte Carlo paths and 500 time-steps on AMD Ryzen 5 7600X CPU with AVX512 vectorization. Key findings: AADC achieves 43x faster execution than JAX when including graph compilation time (0.166s vs 6.82s), and 64x faster when reusing compiled kernels. This performance advantage stems from AADC's optimization for quantitative finance workloads featuring 1,000+ nodes with scalar operations, versus ML frameworks optimized for fewer nodes with large tensor operations. The benchmark demonstrates AADC's superiority for financial applications including Monte Carlo simulations, derivatives pricing, XVA calculations, risk management, and stress testing. AADC also excels in specific machine learning applications: time series prediction, optimal control problems, and neural networks with up to 50,000 parameters. Research by Prof. Roland Olsson demonstrates AADC can evaluate 10 million candidate neurons for automatic programming tasks, significantly faster than JAX or PyTorch.

Performance Benchmark: AADC vs JAX, PyTorch, and TensorFlow for Quantitative Finance

In recent years, popular machine learning tools like JAX, TensorFlow and PyTorch have made significant strides in ML applications, particularly with small-scale computation graphs that feature large nodes. ML applications like Large Language Models (LLMs) or YOLO v8, optimized for real-time object detection, use large parameter matrices (tens of millions of parameters). They typically have fewer than 100 nodes in their computation graphs.

Quantitative finance models are fundamentally different: they often involve over 1,000 nodes in their computation graphs (and, in cases such as XVA calculations, millions of nodes), with each node performing scalar operations—such as discounting individual cashflows for specific derivatives trades. This means the valuation graph in quantitative finance applications is significantly larger and structurally different than a typical ML model computation graph.

Both the compilation time of the valuation graph and the performance of the resulting code (kernel) are integral parts of the execution process in computational finance. The graph compilation time is often neglected in academic benchmarks, resulting in promising results in a test environment, but when applied to real-world derivatives pricing problems it can render the whole approach unviable for production use.

MatLogica AADC is a pioneering framework initially designed for quantitative finance workloads which also excels for certain machine learning use cases, as discussed below. AADC leverages advanced graph compilation techniques and enables automatic differentiation (backpropagation) to achieve remarkable performance gains over JAX, PyTorch, and TensorFlow, as evidenced by the independent benchmark results presented here.

  • Code Generation approach for Automated Adjoint Differentiation (AAD) was first introduced by Dmitri Goloubentsev and Evgeny Lakshtanov in Wilmott magazine in 2019.

Benchmark Methodology and Test Configuration

In this benchmark, we evaluate the performance of a "down-and-out" European Call Option Monte Carlo simulation comprising 50,000 paths and 500 time-steps, using a 6-Core/12-Thread AMD Ryzen 5 7600X CPU with AVX512 vector extensions. This test case represents typical quantitative finance workloads requiring both speed and accuracy for derivatives pricing.

When graph compilation time is considered (critical for real-world scenarios where portfolios change), MatLogica AADC delivers total execution times of just 0.166 seconds, while the next best performer is JAX at 6.82 seconds—over 43x slower than AADC.

In quantitative finance applications, tasks such as derivatives pricing, live risk management, stress testing, Value at Risk (VaR), and XVA calculations allow the compiled graph to be reused, as the calculations remain the same and only input parameters (market data, portfolio positions) change between runs.

In scenarios where the valuation graph is reused across multiple pricing runs, MatLogica AADC outperforms its closest competitor, JAX, by 64x. This exceptional performance is particularly beneficial for financial simulations that involve many nodes with smaller scalar computations, in contrast to typical ML workloads comprising fewer, larger matrix nodes.

Below, we provide the results of this benchmark for 50,000 Monte Carlo paths, (1) including kernel generation time and (2) when reusing the kernels. All measurements are in seconds, and the full benchmark report is available for download here. Source code can be provided on demand for independent verification.

Performance benchmark chart comparing AADC vs JAX, PyTorch, TensorFlow showing 40-64x speed advantage
Figure 1: AADC Performance vs ML Frameworks (JAX, PyTorch, TensorFlow)
Benchmark results table showing execution times for AADC, JAX, PyTorch, and TensorFlow
Table 1: Detailed benchmark results in tabular format showing execution times

Applications in Machine Learning and Neural Networks

The differences between various types of neural networks (NNs) can be illustrated by examining their structure and application. For instance, GPT-3, a prominent large language model in the realm of natural language processing, contains approximately 175 billion parameters and approximately 128 self-attention layers.

In contrast, time series prediction or optimal control problems typically require far fewer parameters (possibly up to 50,000). AADC plays a crucial role in enhancing the performance of such neural networks, as it translates functional programs representing neurons into optimized machine code, significantly accelerating execution times compared to leading neural network frameworks such as JAX, PyTorch, and TensorFlow.

MatLogica AADC's superiority in this respect is well demonstrated in academic papers by Prof. Roland Olsson, where he shows how automatic programming can synthesize novel recurrent neurons designed for specific tasks such as time series analysis, oil well event prediction, and imitation learning for CNC machines. These peer-reviewed papers demonstrate AADC's primacy in evaluating numerous candidate neurons—typically around ten million for each dataset. This optimization capability allows researchers to automatically develop new neuron architectures delivering better accuracies than Transformers or LSTMs. Additionally, AADC provides very rapid screening of candidate neurons, which cannot be achieved using JAX or PyTorch due to their slower compilation and execution times.

Conclusions: Why AADC Outperforms JAX, PyTorch, and TensorFlow

As the demand for fast computations grows in quantitative finance and specialized ML applications, AADC provides a solution that outperforms the popular best-in-class ML frameworks (JAX, PyTorch, TensorFlow) by orders of magnitude (40-64x) without requiring learning new programming languages or extensive code refactoring.

This benchmark only scratches the surface for quantitative models! Where more advanced techniques such as stochastic local volatility models are used for exotic derivatives pricing, the difference between generic ML toolkits operating on large tensors and AADC—which optimizes workloads at the scalar operation level—becomes even more pronounced, potentially reaching 100x+ performance advantages.

AADC fully exploits AVX512 hardware capabilities and enables safe multi-threading, making it a robust solution for the unique challenges presented by the quantitative finance sector. It supports well-known NumPy ufuncs and functions, allowing for seamless integration with existing Python libraries, and it can compile computation graphs written in a mix of C++ and Python. This combination of speed, flexibility, and ease of integration makes AADC a game-changer for executing large-scale computational graphs in financial analysis, ensuring that performance is no longer a hindrance to innovation in derivatives pricing, risk management, and XVA calculations.

AADC both enhances the speed and efficiency of quantitative workloads by 40-64x over alternatives and enables the design of new neural network architectures through rapid candidate evaluation, making it an excellent tool for both financial analysts and machine learning practitioners working with time series data and optimal control problems.

Please contact dmitri@matlogica.com if you require more information about the benchmark methodology, source code, or would like to discuss your specific quantitative finance or machine learning use case.