Feynman–Kac Formula

A popular tool in finance and stochastic optimal control

Feynman–Kac formula creates an intrinsic connection between PDE and SDE, making it a popular tool in finance, stochastic optimal control (SOC), and mathematical physics. This blog presents a few applications of the Feynman–Kac formula in different areas.

Assume a stochastic variable $\mathrm{X_t}$ follows a forward SDE (FSDE)

\[\left\{ \begin{array}{l} \mathrm{d X_t = \mu(t, X_t)dt + \Sigma(t, X_t)dW_t} \\ \ \ \mathrm{X_0=x.} \end{array} \right.\]

Additionally, we have a backward SDE (BSDE) that satisfies a terminal condition

\[\left\{ \begin{array}{l} \mathrm{d Y_t = h(t, X_t, Y_t)dt + \Sigma(t, X_t) dW_t} \\ \ \ \mathrm{Y_T=g(X_T).} \end{array} \right.\]

Denote $\mathrm{u(t, X_t)\equiv Y_t^{x}}$. The terminal value admits a solution \(\mathrm{u(t, x)\equiv E[Y_t\\|\mathcal{F}_t]}\) if we back-propagate the conditional expectation. Given the smoothness and linear growth condition, applying Ito’s formula:

\[\begin{align} &\mathrm{d u=\bigg[u_t +\nabla_x u^\intercal \mu + \frac{1}{2} Tr(u_{xx} \Sigma \Sigma^\intercal)\bigg] dt + \nabla_x u^\intercal \Sigma d W_t}\notag \\ &\quad\ =\mathrm{h(t, X_t, Y_t)dt + \Sigma(t, X_t) dW_t}, \notag \\ \end{align}\]

which leads to the nonlinear Feynman-Kac formula (Exarchos & Theodorou, 2018) builds a connection between the solution of PDEs and probabilistic representations of SDEs

\[\left\{ \begin{array}{l} \mathrm{u_t+\nabla_x u^\intercal \mu +\frac{1}{2} Tr(u_{xx} \Sigma \Sigma^\intercal) -h(t, x, u)=0} \\ \ \ \mathrm{u(T, x)=g(x).} \end{array} \right.\]

Feynman-Kac in Finance

To protect stocks from unexpected losses, we consider e.g. a European call option with a stike price $\mathrm{K}$ at time $\mathrm{T}$, i.e. the terminal payoff function follows $\mathrm{g(x)=(x-K)^+}$. We denote the stock price by $\mathrm{X_t}$ and the option price at time $t$ with stock price $\mathrm{X_t}$ by $\mathrm{u(t, X_t)}$.

Consider a univariate linear case with $\mathrm{h\equiv r u}$, where $\mathrm{r_t}$ denotes the risk-free interest rate, the above PDE becomes:

\[\left\{ \begin{array}{l} \mathrm{u_t+u_x \mu +\frac{1}{2}\Sigma^2 u_{xx}-r u=0} \\ \ \ \mathrm{u(T, x)=(x-K)^+.} \end{array} \right.\]

Then $\mathrm{u(t, x)}$ approximates the current price of the future protection, which yields a stochastic solution

\[\begin{align} \mathrm{u(t, x)=E\bigg[(X_T-K)^+ exp\bigg\{-\int_t^T r_s ds\bigg\} \bigg]}.\notag \\ \end{align}\]

The proof is an application of Itô’s lemma to show the process \(\mathrm{u(t, X_t) exp\{-\int_{t_0}^t r_s ds \}}\) is a martingale subject to a stopping time (Karatzas & Shreve, 2019).

To approximate the expectation, we can simulate sufficiently many stock price paths following the forward SDE $\mathrm{X_t}$ and compute the option price in the backward direction.

Feynman-Kac in Schrödinger Bridge Diffusion

Schrödinger bridge diffusion (De Bortoli et al., 2021) is a transport-optimized diffusion model for the forward-backward SDE (FBSDE) (Chen et al., 2022) (Pardoux & Peng, 1992)

\[\left\{ \begin{array}{l} \mathrm{d X_t = f + g^2 \nabla_x \log \Psi(t, X_t) dt + g dW_t, \ \ \ X_0 \sim p_{\text{data}}} \\ \mathrm{d X_t = f - g^2 \nabla_x \log \widehat \Psi(t, X_t) dt + g dW_t. \ \ \ X_T \sim p_{\text{prior}}} \end{array} \right.\]

We observe that when $\mathrm{\nabla_x \log \Psi(t, X_t)}=0$, the equation simplifies to the standard diffusion model. The additional forward score function $\mathrm{\nabla_x \log \Psi(t, X_t)}$ is introduced to minimize a stochastic optimal control problem (Chen et al., 2021), subject to the forward diffusion and marginal constraints.

Notably, the Hamilton–Jacobi–Bellman (HJB) PDE arises in the derivation of the SOC problems

\[\begin{align} \mathrm{\frac{\partial \phi}{\partial t}+\frac{1}{2} g^2\Delta\phi + \langle \nabla \phi, f \rangle=-\frac{1}{2}\|g(t)\nabla\phi(x, t)\|^2_2}, \notag \end{align}\]

where $\mathrm{\phi=\log \Psi}$. It serves as a continuous-time extension of the Bellman equation, which forms the foundation of reinforcement learning.

Applying the Feynman-Kac formula via Ito’s formula to the FBSDE (Chen et al., 2022), we obtain the likelihood estimator (instead of the stock price in the first example) for the training of score functions $\mathrm{\nabla_x \log \Psi(t, X_t)}$ and $\mathrm{\nabla_x \log \widehat \Psi(t, X_t)}$

\[\begin{align} \mathrm{\log p_0(x_0)=E[\log p_T(X_T)]-\int_0^T E\bigg[\frac{1}{2} \|Z_t\|^2 + \frac{1}{2} \|\widehat Z_t\|^2 + \nabla_x \cdot (g \widehat Z_t -f ) + \widehat Z_t^\intercal Z_t\bigg]dt},\notag \end{align}\]

where $\mathrm{Z_t=g\nabla_x \log \Psi(t, X_t)}$ and $\mathrm{\widehat Z_t=g\nabla_x \log \widehat \Psi(t, X_t)}$.

Feynman-Kac in Other Domains

The Feynman-Kac representation involves a forward simulation followed by a backward derivation process, conceptually akin to the backpropagation training of deep neural networks. This principle also aligns in spirit with the continuous-time policy gradient (Williams, 1992) and controlled sequential Monte Carlo (Heng et al., 2020).

  1. Exarchos, I., & Theodorou, E. A. (2018). Stochastic optimal control via forward and backward stochastic differential equations and importance sampling. Automatica, 87, 159–165.
  2. Karatzas, I., & Shreve, S. E. (2019). Brownian Motion and Stochastic Calculus. Springer.
  3. De Bortoli, V., Thornton, J., Heng, J., & Doucet, A. (2021). Diffusion Schrödinger Bridge with Applications to Score-Based Generative Modeling. NeurIPS.
  4. Chen, T., Liu, G.-H., & Theodorou, E. A. (2022). Likelihood Training of Schrödinger Bridge using Forward-Backward SDEs Theory. ICLR.
  5. Pardoux, E., & Peng, S. (1992). Backward Stochastic Differential Equations and Quasilinear Parabolic Partial Differential Equations. In Stochastic Partial Differential Equations and Their Applications (pp. 200–217).
  6. Chen, Y., Georgiou, T. T., & Pavon, M. (2021). Stochastic Control Liaisons: Richard Sinkhorn Meets Gaspard Monge on a Schrödinger Bridge. SIAM Review, 63(2), 249–313.
  7. Williams, R. J. (1992). Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8, 229–256.
  8. Heng, J., Bishop, A. N., Deligiannidis, G., & Doucet, A. (2020). Controlled Sequential Monte Carlo. The Annals of Statistics, 48(5), 2904–2929.
  9. Zhao, S., Brekelmans, R., Makhzani, A., & Grosse, R. (2024). Probabilistic Inference in Language Models via Twisted Sequential Monte Carlo. ICML.