Calibrating a two-factor Hull-White model using Neural Networks

So I have the following short-rate model $$dX_t = a_1X_tdt + \sigma_1dW_t$$ $$dY_t = a_2Y_tdt + \sigma_2dB_t$$ $$r_t = X_t + Y_t + f(t)$$ with $X_0 = Y_0 = 0$ where $W$ and $B$ are Brownian motions with correlation $\rho$ and $f(t)$ is some deterministic function chosen to match the current term structure.

I want to calibrate this model by matching the observed caplet prices to a parameter vector $(a_1,a_2,\sigma_1,\sigma_2,\rho)$. My approach is as follows. I first generate a random parameter vector and I compute the corresponding caplet prices for different expiries, strikes and tenor dates. Then I train a neural network (in Matlab, if that matters) that takes this vector of prices as input and outputs the corresponding parameter vector. I expect the function from the price vector to the parameter vector to be smooth so a single-layer neural network with a sufficient number of neurons should be able to approximate this function.

But this method does not seem to work. The fitted values of $a_1$ and $a_2$ match their real values (the ones I gave to the neural network) reasonably well but $\sigma_1,\sigma_2,\rho$ are all over the place. If I fix $\sigma_2$ and $\rho$, then the fitted values of $a_1,a_2$ and $\sigma_1$ are quite good. On the other hand if I fix $a_1$ and $a_2$, then the fitted values of $\rho$ are good whereas the fitted values of $\sigma_1$ and $\sigma_2$ are just terrible. If I fix $a_1,a_2$ and $\rho$, then the fitted values of $\sigma_1$ and $\sigma_2$ are almost perfect. Is there some kind of identifiability issue inherent in this model?

I generate about $10000$ samples. My input vector is 280-dimensional with expiry ranging from 1 week to 10 years, strike ranging from $-2\%$ to $1\%$ and tenor ranging from 3 months to 3 years. I went as high as 100 neurons with no visible improvement. I tried Matlab's different neural network optimization algorithms but again no improvement. It deteriorated in fact. I would appreciate it if someone could give some feedback on this approach.

• Try to find an analytical bond pricing formula, and you may then have an analytical caplet value. – Gordon Feb 2 '17 at 20:03
• @Gordon I do have an analytical caplet price formula. What I am aiming to find with a NN is the inverse of that function. I generate prices using my formula and train the network by giving it the prices as inputs and the parameters as outputs. – Calculon Feb 2 '17 at 20:08
• @Calculon I'm curious, why do you need NN for this? – Helin Feb 2 '17 at 23:45
• using only caplets you don't actually get much information about process correlation, and I suspect your model has far too many free (and collinear) variables. try adding in some swaptions and light exotics, like barrier options, CMS spread options etc, to constrain the optimization better. – experquisite Feb 3 '17 at 1:12
• @HelinGai The only other alternative that I know is to use least squares (find the parameters that match the prices the best). That is time consuming as you can imagine and local optima cause issues. With NN you train the network once and you are set for life :) – Calculon Feb 3 '17 at 1:27

I find your approach to calibration (training an ANN to learn the inverse function f-1 from a training set of 'market_prices = f(model_parameters)' interesting, novel (at least this is the first time I am hearing about it) and definitely worth investigating further. If you make it work, you have almost instantaneous calibration and a methodology applicable to many models. If it doesn't work, to understand exactly why is valuable experience.

One apparent flaw is that the model prices of caps and swaptions (obviously) also depend on the initial curve so the inverse function you learn today becomes irrelevant when rates change. To mitigate this, I would use Black-Scholes implied vols (or Bachelier implied vols to deal with negative rates) instead of market prices, that is a model of the type 'implied_vols = f(model_parameters)'.

Strike information is redundant for the calibration of Hull and White's model. This is a Gaussian model, its skew is always Gaussian and does not depend on parameters. For this reason, you would better calibrate to ATM instruments only and leave the problem of the strike structure for later, when you generalize to local/stochastic volatility extensions of HW a la Cheyette.

On the contrary, I would recommend calibrating to swaptions as well as caplets, especially in the multi-factor case, because the market values (or implied vols) of swaptions relative to caplets reflects a correlation information (basket effect).

To summarize, I would try calibrate 2FHW to a matrix (by expiry and underlying) of ATM Bachelier implied vols. Exact analytic formulas were derived in the 1990s, use them when you generate your training set for accuracy.

This being said, I would start with a one-factor model and move on to the two-factor extension once I made that work. It is always best starting with the simplest example when trying new things.

When you generate your training set, make sure that the model parameters correctly sample the parameter space. I would recommend Sobol's sequence, ideally suited for this purpose.

Regarding the ANN architecture, I would not use a shallow network, as you may need an insane number of units to correctly represent the inverse function. I would expect better results with a small number of RELU activated hidden layers, each with a small number of units, followed by a sigmoidal output layer with as many units as you have parameters.

Finally, and perhaps more importantly to answer your question, it looks like you may have a severe overfitting problem: with 280 inputs and 100 neurons in your hidden layer, you have 28,000 parameters to learn for this weight matrix alone, with only 10,000 training examples. To confirm overfitting, compare the loss on your training set and your test set. An overfitted ANN does well on the training set but generalizes poorly.

To summarize (on the ANN end) I would try training a reasonably deep ANN with a small number of units, with a (much) larger training set, where the parameter space is sampled with Sobol, and the corresponding implied vols are computed with HW analytics. At first, respect the 'rule of 10' (10 times as much examples as you have weights in the ANN) and then, perhaps, try to relax and apply some regularization instead.

I wish you success. Please don't give up unless you find a good reason why it shouldn't work, and please let me know how it goes.