Levenberg-Marquardt for Model Calibration

Hard·25 min read
CalibrationNumerical OptimisationHeston ModelImplied Volatility

Setup

The Calibration Problem

Model calibration is the process of finding parameter values θRp\theta \in \mathbb{R}^p such that a pricing model reproduces observed market prices. In quantitative finance, this typically means:

  • Given: market-implied vols σ^i\hat{\sigma}_i for instruments i=1,,Ni = 1, \ldots, N (strikes KiK_i, maturities TiT_i, put/call flags).
  • Find: model parameters θ=(θ1,,θp)\theta = (\theta_1, \ldots, \theta_p) minimising the weighted sum of squared residuals.

For the Heston model, θ=(κ,νˉ,ξ,ρ,ν0)\theta = (\kappa, \bar{\nu}, \xi, \rho, \nu_0) (mean-reversion speed, long-run variance, vol-of-vol, correlation, initial variance). For SABR, θ=(α,β,ρ,ν)\theta = (\alpha, \beta, \rho, \nu).

Why implied vols, not prices? Fitting prices across different maturities and strikes without normalisation gives excessive weight to long-dated options (higher absolute prices). Fitting implied vols gives roughly equal weight across the surface and aligns with how traders think about calibration quality.

Assumptions

  1. The pricing function σmodel(K,T;θ)\sigma_{\mathrm{model}}(K, T; \theta) is differentiable in θ\theta (needed for the Jacobian).
  2. NpN \geq p: at least as many market instruments as model parameters (identified system). For Heston, N=30100N = 30\text{–}100 instruments is typical.
  3. The loss surface has a local minimum near the initial guess θ0\theta_0. For most models, multiple local minima exist — global optimisation or multi-start is needed in production.

The Nonlinear Least-Squares Objective

Define residuals r:RpRNr: \mathbb{R}^p \to \mathbb{R}^N:

ri(θ)=wi(σmodel(Ki,Ti;θ)σ^i),i=1,,N,r_i(\theta) = w_i \bigl(\sigma_{\mathrm{model}}(K_i, T_i; \theta) - \hat{\sigma}_i\bigr), \qquad i = 1, \ldots, N,

where wi>0w_i > 0 are weights (typically proportional to the liquidity or inverse bid-ask spread of instrument ii). The objective is:

F(θ)=12r(θ)2=12i=1Nri(θ)2.F(\theta) = \frac{1}{2}\|r(\theta)\|^2 = \frac{1}{2}\sum_{i=1}^N r_i(\theta)^2.

The factor 1/21/2 is conventional and simplifies gradient expressions. The calibration seeks:

θ=argminθΘF(θ),\theta^* = \arg\min_{\theta \in \Theta} F(\theta),

subject to box constraints Θ={θ:θu}\Theta = \{\theta : \ell \leq \theta \leq u\} (e.g., κ>0\kappa > 0, ρ(1,1)\rho \in (-1, 1)).


Theory: Levenberg-Marquardt

Gauss-Newton as the Foundation

The gradient and Hessian of FF are:

F(θ)=J(θ)r(θ),2F(θ)=J(θ)J(θ)+i=1Nri(θ)2ri(θ),\nabla F(\theta) = J(\theta)^\top r(\theta), \qquad \nabla^2 F(\theta) = J(\theta)^\top J(\theta) + \sum_{i=1}^N r_i(\theta) \nabla^2 r_i(\theta),

where JRN×pJ \in \mathbb{R}^{N \times p} is the Jacobian matrix with Jij=ri/θjJ_{ij} = \partial r_i / \partial \theta_j.

The Gauss-Newton (GN) approximation drops the second-order term (the sum of ri2rir_i \nabla^2 r_i), giving:

2F(θ)JJ.\nabla^2 F(\theta) \approx J^\top J.

This is exact when the residuals rir_i are small (near the solution). The GN update solves:

(JJ)δθ=Jr,θθ+δθ.(J^\top J)\, \delta\theta = -J^\top r, \qquad \theta \leftarrow \theta + \delta\theta.

GN converges quadratically when the residuals are small and the problem is well-conditioned, but fails when JJJ^\top J is singular or ill-conditioned (degenerate directions in parameter space).

The LM Damping Term

Levenberg-Marquardt adds a damping term λD\lambda D to JJJ^\top J:

(JJ+λD)δθ=Jr,(J^\top J + \lambda D)\, \delta\theta = -J^\top r,

where λ>0\lambda > 0 is the damping parameter and DD is a diagonal matrix.

Two standard choices for DD:

  • Levenberg (1944): D=ID = I (identity). Moves in the steepest-descent direction when λ\lambda is large.
  • Marquardt (1963): D=diag(JJ)D = \mathrm{diag}(J^\top J). Scales each parameter direction by its gradient curvature, making the step invariant to parameter rescaling. This is the standard choice.

Interpolation between GN and gradient descent. When λ0\lambda \to 0: the equation becomes JJδθ=JrJ^\top J\, \delta\theta = -J^\top r, i.e., Gauss-Newton. When λ\lambda \to \infty: the update becomes δθ(λD)1Jr\delta\theta \approx -(\lambda D)^{-1} J^\top r, a scaled steepest-descent step. LM adaptively chooses between these extremes.

Geometric Interpretation

The LM step minimises a quadratic approximation to FF within a trust region:

δθLM=argminδθ{12Jδθ+r2}subject toδθΔ,\delta\theta_{\mathrm{LM}} = \arg\min_{\delta\theta} \left\{\tfrac{1}{2}\|J\delta\theta + r\|^2\right\} \quad \text{subject to} \quad \|\delta\theta\| \leq \Delta,

for some trust-region radius Δ\Delta. The damping λ\lambda is the Lagrange multiplier for the constraint. Large λ\lambda corresponds to a small trust region (conservative step); small λ\lambda allows a large step.

Damping Parameter Update Rule

A standard update rule (Marquardt 1963, as refined by Moré 1978):

  1. Evaluate proposed step: δθLM=(JJ+λD)1Jr\delta\theta_{\mathrm{LM}} = -(J^\top J + \lambda D)^{-1} J^\top r.
  2. Compute gain ratio: ρ=F(θ)F(θ+δθ)L(θ)L(θ+δθ),\rho = \frac{F(\theta) - F(\theta + \delta\theta)}{\mathcal{L}(\theta) - \mathcal{L}(\theta + \delta\theta)}, where L\mathcal{L} is the quadratic model: L(θ+δ)=F(θ)+δJr+12δJJδ\mathcal{L}(\theta + \delta) = F(\theta) + \delta^\top J^\top r + \tfrac{1}{2}\delta^\top J^\top J \delta.
  3. Accept the step if ρ>ρmin\rho > \rho_{\min} (e.g., ρmin=0.25\rho_{\min} = 0.25): set θθ+δθ\theta \leftarrow \theta + \delta\theta and decrease λ\lambda (e.g., λλ/3\lambda \leftarrow \lambda/3).
  4. Reject the step if ρρmin\rho \leq \rho_{\min}: increase λ\lambda (e.g., λλ×3\lambda \leftarrow \lambda \times 3) and retry.

This self-tuning makes LM robust: it contracts to gradient descent near bad regions and expands to GN near the solution.


Jacobian Computation

The Jacobian Jij=ri/θj=wiσmodel(Ki,Ti;θ)/θjJ_{ij} = \partial r_i / \partial \theta_j = w_i \, \partial \sigma_{\mathrm{model}}(K_i, T_i; \theta) / \partial \theta_j is the most expensive part of LM calibration.

Finite Differences (FD)

Forward differences (first-order accurate, order O(h)O(h)):

Jijri(θ+hej)ri(θ)h.J_{ij} \approx \frac{r_i(\theta + h e_j) - r_i(\theta)}{h}.

Requires pp extra model evaluations per iteration (one per parameter direction). For Heston with p=5p = 5 parameters and N=50N = 50 instruments, this is 5×50=2505 \times 50 = 250 Fourier integrals per LM step.

Central differences (second-order accurate, order O(h2)O(h^2)):

Jijri(θ+hej)ri(θhej)2h.J_{ij} \approx \frac{r_i(\theta + h e_j) - r_i(\theta - h e_j)}{2h}.

Twice the cost, but significantly more accurate for the same step size hh. Step size selection: hεmach107h \approx \sqrt{\varepsilon_{\mathrm{mach}}} \approx 10^{-7} for forward, hεmach1/3105h \approx \varepsilon_{\mathrm{mach}}^{1/3} \approx 10^{-5} for central.

Analytic Jacobian for Affine Models

For models with a closed-form characteristic function φT(u;θ)\varphi_T(u; \theta) (e.g., Heston, Bates), the sensitivity of the model price to each parameter can be computed by differentiating under the Fourier integral:

This topic requires Premium

Only today's featured topic is free. Unlock the full Today's Focus archive with Premium.

Read the theory? Run the code.

View Notebook