This repository accompany our master thesis "Your Neural Network is Your Net Worth - Valuation and Hedging of Interest Rate Derivatives with Automatic Adjoint Differentiation and Differential Machine Learning" to finalize our education as MSc. in Mathematics-Economics at University of Copenhagen. The thesis was written during fall 2023 and presented in January 2024.
In this thesis, we have succesfully implemented a flexible and scalable setup for performing efficient valuation and accurate hedging of interest rate derivatives by Monte Carlo simulation instrumented with Automatic Adjoint Differentiation. Our main contribution demonstrates effective training of Differential Machine Learning models for a variety of interest rate products, including linear, European, path-dependent, and callable contracts. This is carried out within the classic Vasicek model, and the General Multi-Factor Stochastic Volatility Model by Trolle and Schwartz.
Our findings reveal:
- Smoothing techniques can help produce better quality training samples.
- Differential Regression is fast and best applicable for nice payoff functions.
- Differential Neural Networks is generally more accurate and capable of fitting nastier functions.
- In a stochastic volatility market, Differential Neural Network seems (much more) stable for Greek estimations.
Differential Machine Learning in financial applications is a concept first mentioned by Savine and Huge in Diff ML repository. The idea is to combine classical supervised Machine Learning algorithms, where learning is based on inputs and outputs only, together with differential labels, what have the unique feature they are exactly the derivative of the output with respect to the input.
Say that we have a dataset with
Thus we need a dataset suitable for differential learning where each sample
Take this example, of a European payer swaption that has 1 year to expiry to enter into a 5Y3M swap. The underlying swap is our market observable
The right pane is purely how training data look like (more on how to generate that below) and the left pane is the learned price and risk curve across the different values of the underlying.
The backbone of our data generation procedure is classical Monte Carlo simulations, but instrumented with Automatic Adjoint Differentiation (AAD). It is thus essential that this is flexible and scalable to handle not only different products but also different models. The key to achieve this, is to segregate the responsibilities between what a model should do and provide, and what a product should do and provide.
Product: Determines payoff function and definition of market samples.
Model: Determines the probability distribution of the market samples.
Averaging over
High level implementation details of our engine:
- Product provides the timeline and definition line.
- Model instructs Random Number Generator (RNG) how many discretizations is needed.
- Number of paths to sample.
- RNG samples and passes back to the model.
- Product determines payoff for scenarios.