# Could machine learning improve CVA and IM calculations?

## Banks have built ways to calculate CVA more quickly, but neural networks could offer more accurate method

Credit valuation adjustments (CVA) and initial margin (IM) requirements aren’t the easiest measures to compute, especially for a large portfolio of assets.

Both require users to calculate the future exposure of the portfolio in question, which means the path of each individual asset needs to be simulated. All might have non-linear features such as embedded optionality and exercise rights, making it impossible to use simple partial differential equations (PDEs) – which become very difficult to solve at higher dimensions – to price them accurately.

Over the past decade, numerous researchers have attempted to improve the speed and accuracy of CVA calculations. More recently, banks have also had to calculate initial margin requirements – arguably even more complex than CVA – thanks to the phase-in of non-cleared margin rules from 2016. A new paper from a quant at Societe Generale attempts to reduce the complexity of both calculations, using machine learning techniques.

In this month’s first technical, *CVA and IM: welcome to the machine,* Pierre Henry-Labordère, a member of the global markets quantitative research team at Societe Generale Corporate & Investment Banking in Paris, proposes a new technique that combines a backward stochastic differential equation (BSDE) – which can capture non-linearity – with the use of machine learning to find a less complex way to calculate CVA and initial margin.

Many large dealers are able to calculate CVA and its Greeks within a reasonable amount of time now. But that is mainly due to heavy investment in technologies such as graphics processing units (GPUs), which can run thousands of calculations in parallel. Others have combined mathematical tricks such as adjoint algorithmic differentiation to speed up the calculation.

The research was driven by the challenges of familiar, less-than-perfect approaches, says Henry-Labordère. Take CVA calculations for starters, where it is not possible to use something such as a partial differential equation (PDE) solver for portfolios approaching any reasonable size.

“By way of example, if we have one option depending on one underlying, for this one you can use a Monte Carlo algorithm or a PDE solver. Now for the CVA, say the number of underlyings is very large – say, 10 assets – it is not possible to use deterministic methods. Therefore we need to rely on a probabilistic algorithm,” he says.

## Pierre Henry-Labordère’s solution uses neural networks to find the upper and lower bounds of the CVA and IM one wants to calculate on a portfolio, enabling one to quickly optimise the simulated path of the asset by focusing on that range

Another issue is that CVA is non-linear. This means it is not possible to simply sum the CVA of a given portfolio with one kind of asset and the CVA of a portfolio of a different underlying asset to arrive at the CVA of a portfolio containing both assets, as there will be interactions between the two.

What quants typically then do is run a nested Monte Carlo simulation, or run a non-linear PDE – but both are very computationally intensive. In the case of the former, one needs to calculate not only the expected loss on a given portfolio, but also the individual exposures at each future point in time based on the movement and exercise of underlying assets. Non-linear PDEs, on the other hand, need numerical methods to solve.

“We don’t have perfect tools for solving this non-linearity problem,” adds Henry-Labordère. “You introduce some time steps between zero and the maturity of, let’s say, 10 years, and each time step will represent a probability of default of the counterparty. On each path and at each time step, you need to compute the positive part of the mark-to-market, and you do that for each Monte Carlo path. So, at the end, what you need to do is a Monte Carlo of a Monte Carlo.”

### Neural network solution

Henry-Labordère’s solution is to use a machine learning approach called neural networks to eliminate an additional Monte Carlo step in the calculation. Neural networks – which function in a similar way to biological neurons – are typically used as an unsupervised learning method to learn patterns from large datasets and make predictions or decisions.

His solution uses neural networks to find the upper and lower bounds of the CVA and IM one wants to calculate on a portfolio. This gives a tight range within which the values would fall, and enables one to more quickly optimise the simulated path of the asset by focusing on that range.

“If you try to minimise a function that depends on 200 parameters or 1,000 parameters, you will find the minimisation algorithm is not working properly, because you have a huge number of valleys or mountains. So when you are doing the optimisation, sometimes you converge not towards the true minimiser, but a local minimiser,” says Henry-Labordère.

This is analogous to pricing an American option based on an optimal stopping time – a time at which one could exercise the option to maximise gains. The optimal stopping time gives a rule based on the upper and lower bounds of the underlying to determine the optimal course of action given a particular time step. If this function is already available, one does not need a separate Monte Carlo to simulate the path of the payoff or exposure at each time step.

For CVA or IM calculations, this works in a similar way: the neural network algorithm creates a rule to find the upper and lower bounds, which is then fed into the BSDE algorithm. This eliminates the need to run a nested Monte Carlo.

Henry-Labordère says the CVA and IM calculations derived using this technique match those of a single-asset portfolio priced using a PDE, which gives the true price.

*Editing by Tom Osborn*

Only users who have a paid subscription or are part of a corporate subscription are able to print or copy content.

To access these options, along with all other subscription benefits, please contact info@risk.net or view our subscription options here: http://subscriptions.risk.net/subscribe

You are currently unable to print this content. Please contact info@risk.net to find out more.

You are currently unable to copy this content. Please contact info@risk.net to find out more.

Copyright Infopro Digital Limited. All rights reserved.

You may share this content using our article tools. Printing this content is for the sole use of the Authorised User (named subscriber), as outlined in our terms and conditions - https://www.infopro-insight.com/terms-conditions/insight-subscriptions/

If you would like to purchase additional rights please email info@risk.net

Copyright Infopro Digital Limited. All rights reserved.

You may share this content using our article tools. Copying this content is for the sole use of the Authorised User (named subscriber), as outlined in our terms and conditions - https://www.infopro-insight.com/terms-conditions/insight-subscriptions/

If you would like to purchase additional rights please email info@risk.net

####
More on Our take

##### Degree of influence 2023: Quants thrive on volatility

Climate, crypto and market impact also featured among the top research topics in 2023

##### Korea’s ‘worst-of’ times are here to stay

Chinese houses’ success in Korean autocalls could stymie hopes of diversifying the product mix

##### Could intraday FX swaps help reduce settlement risk?

New swap platform hopes to ease funding pains, but can it promote more use of PvP?

##### Talking Heads 2023: A turf war in credit markets

Banks are looking to reclaim territory they previously ceded to market-makers and private funds

##### FX-style crypto platforms could bridge gap with TradFi

Emergence of execution-only ECNs, prime brokers and clearing houses brings new confidence in crypto

##### Skew this: taking the computational burden off basket options

Dan Pirjol presents a snap formula for estimating implied volatility skew in an instant

##### Shhh, don’t tell: the struggle to keep skew under wraps

Liquidity recycling by clients has made it more difficult for banks to keep skews quiet

##### How a machine learning model closed a hidden FX arbitrage gap

MUFG Securities quant uses variational inference to control the mid volatility of options