Deep backward stochastic differential equation method



Deep backward stochastic differential equation method is a numerical method that combines deep learning with Backward stochastic differential equation (BSDE). This method is particularly useful for solving high-dimensional problems in financial derivatives pricing and risk management. By leveraging the powerful function approximation capabilities of deep neural networks, deep BSDE addresses the computational challenges faced by traditional numerical methods in high-dimensional settings.

Backwards stochastic differential equations
BSDEs were first introduced by Pardoux and Peng in 1990 and have since become essential tools in stochastic control and financial mathematics. In the 1990s, Étienne Pardoux and Shige Peng established the existence and uniqueness theory for BSDE solutions, applying BSDEs to financial mathematics and control theory. For instance, BSDEs have been widely used in option pricing, risk measurement, and dynamic hedging.

Deep learning
Deep Learning is a machine learning method based on multilayer neural networks. Its core concept can be traced back to the neural computing models of the 1940s. In the 1980s, the proposal of the backpropagation algorithm made the training of multilayer neural networks possible. In 2006, the Deep Belief Networks proposed by Geoffrey Hinton and others rekindled interest in deep learning. Since then, deep learning has made groundbreaking advancements in image processing, speech recognition, natural language processing, and other fields.

Limitations of Traditional Numerical Methods
Tranditional numerical methods for solving stochastic differential equations include the Euler–Maruyama method, Milstein method, Runge–Kutta method (SDE) and methods based on different representations of iterated stochastic integrals.

But as financial problems become more complex, traditional numerical methods for BSDEs (such as the Monte Carlo method, finite difference method, etc.) have shown limitations such as high computational complexity and the curse of dimensionality.
 * 1) In high-dimensional scenarios, the Monte Carlo method requires numerous simulation paths to ensure accuracy, resulting in lengthy computation times. In particular, for nonlinear BSDEs, the convergence rate is slow, making it challenging to handle complex financial derivative pricing problems. Pi monte carlo all.gif
 * 2) The finite difference method, on the other hand, experiences exponential growth in the number of computation grids with increasing dimensions, leading to significant computational and storage demands. This method is generally suitable for simple boundary conditions and low-dimensional BSDEs, but it is less effective in complex situations.

Deep BSDE method
The combination of deep learning with BSDEs, known as deep BSDE, was proposed by Han, Jentzen, and E in 2018 as a solution to the high-dimensional challenges faced by traditional numerical methods. The Deep BSDE approach leverages the powerful nonlinear fitting capabilities of deep learning, approximating the solution of BSDEs by constructing neural networks. The specific idea is to represent the solution of a BSDE as the output of a neural network and train the network to approximate the solution.

Mathematical method
Backward Stochastic Differential Equations (BSDEs) represent a powerful mathematical tool extensively applied in fields such as stochastic control, financial mathematics, and beyond. Unlike traditional Stochastic differential equations (SDEs), which are solved forward in time, BSDEs are solved backward, starting from a future time and moving backwards to the present. This unique characteristic makes BSDEs particularly suitable for problems involving terminal conditions and uncertainties.

A backward stochastic differential equation (BSDE) can be formulated as:
 * $$ Y_t = \xi + \int_t^T f(s, Y_s, Z_s) \, ds - \int_t^T Z_s \, dW_s, \quad t \in [0, T] $$

In this equation:
 * $$ \xi $$ is the terminal condition specified at time $$ T $$.
 * $$f:[0,T]\times\mathbb{R}\times\mathbb{R}\to\mathbb{R}$$ is called the generator of the BSDE
 * $$(Y_t,Z_t)_{t\in[0,T]}$$ is the solution consists of stochastic processes $$(Y_t)_{t\in[0,T]}$$ and $$(Z_t)_{t\in[0,T]}$$ which are adapted to the filtration $$(\mathcal{F}_t)_{t\in [0,T]}$$
 * $$ W_s $$ is a standard Brownian motion.

The goal is to find adapted processes $$ Y_t $$ and $$ Z_t $$ that satisfy this equation. Traditional numerical methods struggle with BSDEs due to the curse of dimensionality, which makes computations in high-dimensional spaces extremely challenging.

===Methodology overview ===

1. Semilinear parabolic PDEs
We consider a general class of PDEs represented by $$ \frac{\partial u}{\partial t}(t,x) + \frac{1}{2} \text{Tr}\left(\sigma\sigma^T(t,x)\left(\text{Hess}_x u(t,x)\right)\right) + \nabla u(t,x) \cdot \mu(t,x) + f\left(t,x,u(t,x),\sigma^T(t,x)\nabla u(t,x)\right) = 0 $$

In this equation:
 * $$ u(T,x) = g(x) $$ is the terminal condition specified at time $$ T $$.
 * $$ t $$ and $$ x $$ represent the time and $$ d $$-dimensional space variable, respectively.
 * $$ \sigma $$ is a known vector-valued function, $$ \sigma^T $$ denotes the transpose associated to $$ \sigma $$, and $$ \text{Hess}_x u $$ denotes the Hessian of function $$ u $$ with respect to $$ x $$.
 * $$ \mu $$ is a known vector-valued function, and $$ f $$ is a known nonlinear function.

2. Stochastic process representation
Let $$ \{W_t\}_{t \geq 0} $$ be a $$ d $$-dimensional Brownian motion and $$ \{X_t\}_{t \geq 0} $$ be a $$ d $$-dimensional stochastic process which satisfies

$$ X_t = \xi + \int_0^t \mu(s, X_s) \, ds + \int_0^t \sigma(s, X_s) \, dW_s $$

3. Backward stochastic differential equation(BSDE)
Then the solution of the PDE satisfies the following BSDE:

$$ u(t, X_t) - u(0, X_0) $$


 * $$= - \int_0^t f\left(s, X_s, u(s, X_s), \sigma^T(s, X_s)\nabla u(s, X_s)\right) \, ds + \int_0^t \nabla u(s, X_s) \cdot \sigma(s, X_s) \, dW_s

$$

4. Temporal discretization
Discretize the time interval $$ [0, T] $$ into steps $$ 0 = t_0 < t_1 < \cdots < t_N = T $$:

$$ X_{t_{n+1}} - X_{t_n} \approx \mu(t_n, X_{t_n}) \Delta t_n + \sigma(t_n, X_{t_n}) \Delta W_n $$

$$ u(t_n, X_{t_{n+1}}) - u(t_n, X_{t_n}) $$
 * $$\approx - f\left(t_n, X_{t_n}, u(t_n, X_{t_n}), \sigma^T(t_n, X_{t_n}) \nabla u(t_n, X_{t_n})\right) \Delta t_n + \left[\nabla u(t_n, X_{t_n}) \sigma(t_n, X_{t_n})\right] \Delta W_n

$$

where $$ \Delta t_n = t_{n+1} - t_n $$ and $$ \Delta W_n = W_{t_{n+1}} - W_n $$.

5. Neural network approximation
Use a multilayer feedforward neural network to approximate:

$$ \sigma^T(t_n, X_n) \nabla u(t_n, X_n) \approx (\sigma^T \nabla u)(t_n, X_n; \theta_n) $$

for $$ n = 1, \ldots, N $$, where $$ \theta_n $$ are parameters of the neural network approximating $$ x \mapsto \sigma^T(t, x) \nabla u(t, x) $$ at $$ t = t_n $$.

6. Training the neural network
Stack all sub-networks in the approximation step to form a deep neural network. Train the network using paths $$ \{X_{t_n}\}_{0 \leq n \leq N} $$ and $$ \{W_{t_n}\}_{0 \leq n \leq N} $$ as input data, minimizing the loss function:

$$ l(\theta) = \mathbb{E} \left| g(X_{t_N}) - \hat{u}\left(\{X_{t_n}\}_{0 \leq n \leq N}, \{W_{t_n}\}_{0 \leq n \leq N}; \theta \right) \right|^2 $$

where $$ \hat{u} $$ is the approximation of $$ u(t, X_t) $$.

Neural network architecture
Deep learning encompass a class of machine learning techniques that have transformed numerous fields by enabling the modeling and interpretation of intricate data structures. These methods, often referred to as deep learning, are distinguished by their hierarchical architecture comprising multiple layers of interconnected nodes, or neurons. This architecture allows deep neural networks to autonomously learn abstract representations of data, making them particularly effective in tasks such as image recognition, natural language processing, and financial modeling. The core of this method lies in designing an appropriate neural network structure (such as fully connected networks or recurrent neural networks) and selecting effective optimization algorithms.

The choice of deep BSDE network architecture, the number of layers, and the number of neurons per layer are crucial hyperparameters that significantly impact the performance of the deep BSDE method. The deep BSDE method constructs neural networks to approximate the solutions for $$ Y $$ and $$ Z $$, and utilizes stochastic gradient descent and other optimization algorithms for training.

The fig illustrates the network architecture for the deep BSDE method. Note that $$ \nabla u(t_n, X_{t_n}) $$ denotes the variable approximated directly by subnetworks, and $$ u(t_n, X_{t_n}) $$ denotes the variable computed iteratively in the network. There are three types of connections in this network:

i) $$ X_{t_n} \rightarrow h_1^n \rightarrow h_2^n \rightarrow \ldots \rightarrow h_H^n \rightarrow \nabla u(t_n, X_{t_n}) $$ is the multilayer feedforward neural network approximating the spatial gradients at time $$ t = t_n $$. The weights $$ \theta_n $$ of this subnetwork are the parameters optimized.

ii) $$ (u(t_n, X_{t_n}), \nabla u(t_n, X_{t_n}), W_{t_n+1} - W_{t_n}) \rightarrow u(t_{n+1}, X_{t_{n+1}}) $$ is the forward iteration providing the final output of the network as an approximation of $$ u(t_N, X_{t_N}) $$, characterized by Eqs. 5 and 6. There are no parameters optimized in this type of connection.

iii) $$ (X_{t_n}, W_{t_n+1} - W_{t_n}) \rightarrow X_{t_{n+1}} $$ is the shortcut connecting blocks at different times, characterized by Eqs. 4 and 6. There are also no parameters optimized in this type of connection.

Algorithms
===Adam (short for Adaptive Moment Estimation) algorithm=== This function implements the Adam optimization algorithm for minimizing the target function $$\mathcal{G}(\theta)$$.
 * First, we present the pseudocode for the ADAM algorithm as follows:

Function: ADAM($$\alpha$$, $$\beta_1$$, $$\beta_2$$, $$\epsilon$$, $$\mathcal{G}(\theta)$$, $$\theta_0$$) is $$m_0 := 0$$ // Initialize the first moment vector $$v_0 := 0$$ // Initialize the second moment vector $$t := 0$$  // Initialize timestep // Step 1: Initialize parameters $$\theta_t := \theta_0$$ // Step 2: Optimization loop while $$\theta_t$$ has not converged do $$t := t + 1$$ $$g_t := \nabla_\theta \mathcal{G}_t(\theta_{t-1})$$ // Compute gradient of $$\mathcal{G}$$ at timestep $$t$$ $$m_t := \beta_1 \cdot m_{t-1} + (1 - \beta_1) \cdot g_t$$ // Update biased first moment estimate $$v_t := \beta_2 \cdot v_{t-1} + (1 - \beta_2) \cdot g_t^2$$ // Update biased second raw moment estimate $$\widehat{m}_t := \frac{m_t}{(1 - \beta_1^t)}$$ // Compute bias-corrected first moment estimate $$\widehat{v}_t := \frac{v_t}{(1 - \beta_2^t)}$$ // Compute bias-corrected second moment estimate $$\theta_t := \theta_{t-1} - \frac{\alpha \cdot \widehat{m}_t}{(\sqrt{\widehat{v}_t} + \epsilon)}$$ // Update parameters return $$\theta_t$$

===Backpropagation algorithm for multilayer feedforward neural networks=== This function implements the backpropagation algorithm for training a multi-layer feedforward neural network.
 * With the ADAM algorithm described above, we now present the pseudocode corresponding to a multilayer feedforward neural network:

Function: BackPropagation(set $$D=\left\{(\mathbf{x}_k,\mathbf{y}_k)\right\}_{k=1}^{m}$$) is // Step 1: Random initialization // Step 2: Optimization loop repeat until termination condition is met: for each $$(\mathbf{x}_k,\mathbf{y}_k) \in D$$: $$\hat{\mathbf{y}}_k := f(\beta_j - \theta_j)$$ // Compute output // Compute gradients for each output neuron $$j$$: $$g_j := \hat{y}_{j}^{k} (1 - \hat{y}_{j}^{k}) (\hat{y}_{j}^{k} - y_{j}^{k})$$ // Gradient of output neuron for each hidden neuron $$h$$: $$e_h := b_h (1 - b_h) \sum_{j=1}^{\ell} w_{hj} g_{j}$$ // Gradient of hidden neuron // Update weights for each weight $$w_{hj}$$: $$\Delta w_{hj} := \eta g_j b_h$$ // Update rule for weight for each weight $$v_{ih}$$: $$\Delta v_{ih} := \eta e_h x_i$$ // Update rule for weight // Update parameters for each parameter $$\theta_j$$: $$\Delta \theta_j := -\eta g_j$$ // Update rule for parameter for each parameter $$\gamma_{h}$$: $$\Delta \gamma_{h} := -\eta e_h$$ // Update rule for parameter // Step 3: Construct the trained multi-layer feedforward neural network return trained neural network
 * Combining the ADAM algorithm and a multilayer feedforward neural network, we provide the following pseudocode for solving the optimal investment portfolio:

Numerical solution for optimal investment portfolio
This function calculates the optimal investment portfolio using the specified parameters and stochastic processes.

function OptimalInvestment($$W_{t_{i+1}} - W_{t_i}$$, $$x$$, $$\theta=(X_{0}, H_{0}, \theta_{1}, \theta_{2}, \dots, \theta_{N-1})$$) is // Step 1: Initialization for $$k := 0$$ to maxstep do $$M_0^{k, m} := 0$$, $$X_0^{k, m} := X_0^k$$ // Parameter initialization for $$i := 0$$ to $$N-1$$ do $$H_{t_i}^{k, m} := \mathcal{NN}(M_{t_i}^{k, m}; \theta_i^k)$$ // Update feedforward neural network unit $$M_{t_{i+1}}^{k, m} := M_{t_{i}}^{k, m} + \big((1 - \phi)(\mu_{t_{i}} - M_{t_{i}}^{k, m})\big)(t_{i+1} - t_{i}) + \sigma_{t_{i}}(W_{t_{i+1}} - W_{t_{i}})$$ $$X_{t_{i+1}}^{k, m} := X_{t_{i}}^{k, m} + \big[H_{t_{i}}^{k, m}(\phi (M_{t_{i}}^{k, m} - \mu_{t_{i}}) + \mu_{t_{i}})\big](t_{i+1} - t_{i}) + H_{t_{i}}^{k, m} (W_{t_{i+1}} - W_{t_{i}})$$ // Step 2: Compute loss function $$\mathcal{L}(t) := \frac{1}{M} \sum_{m=1}^M \left| X_{t_N}^{k, m} - g(M_{t_N}^{k, m}) \right|^2$$ // Step 3: Update parameters using ADAM optimization $$\theta^{k+1} := \operatorname{ADAM}(\theta^k, \nabla \mathcal{L}(t))$$ $$X_0^{k+1} := \operatorname{ADAM}(X_0^k, \nabla \mathcal{L}(t))$$ // Step 4: Return terminal state return $$(M_{t_N}, X_{t_N})$$

Application
Deep BSDE is widely used in the fields of financial derivatives pricing, risk management, and asset allocation. It is particularly suitable for:


 * High-Dimensional Option Pricing: Pricing complex derivatives like basket options and Asian options, which involve multiple underlying assets. Traditional methods such as finite difference methods and Monte Carlo simulations struggle with these high-dimensional problems due to the curse of dimensionality, where the computational cost increases exponentially with the number of dimensions. Deep BSDE methods utilize the function approximation capabilities of deep neural networks to manage this complexity and provide accurate pricing solutions. The deep BSDE approach is particularly beneficial in scenarios where traditional numerical methods fall short. For instance, in high-dimensional option pricing, methods like finite difference or Monte Carlo simulations face significant challenges due to the exponential increase in computational requirements with the number of dimensions. Deep BSDE methods overcome this by leveraging deep learning to approximate solutions to high-dimensional PDEs efficiently.


 * Risk Measurement: Calculating risk measures such as Conditional Value-at-Risk (CVaR) and Expected shortfall (ES). These risk measures are crucial for financial institutions to assess potential losses in their portfolios. Deep BSDE methods enable efficient computation of these risk metrics even in high-dimensional settings, thereby improving the accuracy and robustness of risk assessments. In risk management, deep BSDE methods enhance the computation of advanced risk measures like CVaR and ES, which are essential for capturing tail risk in portfolios. These measures provide a more comprehensive understanding of potential losses compared to simpler metrics like Value-at-Risk (VaR). The use of deep neural networks enables these computations to be feasible even in high-dimensional contexts, ensuring accurate and reliable risk assessments.


 * Dynamic Asset Allocation: Determining optimal strategies for asset allocation over time in a stochastic environment. This involves creating investment strategies that adapt to changing market conditions and asset price dynamics. By modeling the stochastic behavior of asset returns and incorporating it into the allocation decisions, deep BSDE methods allow investors to dynamically adjust their portfolios, maximizing expected returns while managing risk effectively. For dynamic asset allocation, deep BSDE methods offer significant advantages by optimizing investment strategies in response to market changes. This dynamic approach is critical for managing portfolios in a stochastic financial environment, where asset prices are subject to random fluctuations. Deep BSDE methods provide a framework for developing and executing strategies that adapt to these fluctuations, leading to more resilient and effective asset management.

Advantages

 * 1) High-Dimensional Capability: Compared to traditional numerical methods, deep BSDE performs exceptionally well in high-dimensional problems.
 * 2) Flexibility: The incorporation of deep neural networks allows this method to adapt to various types of BSDEs and financial models.
 * 3) Parallel Computing: Deep learning frameworks support GPU acceleration, significantly improving computational efficiency.

Disadvantages

 * 1) Training Time: Training deep neural networks typically requires substantial data and computational resources.
 * 2) Parameter Sensitivity: The choice of neural network architecture and hyperparameters greatly impacts the results, often requiring experience and trial-and-error.