TQBTHEQUANTBATEMAN
TQB/ learn/ volatility/ calibrationEN · DARK
Volatility · front-office

Volatility-model calibration

Turning quotes into parameters without mistaking fit for identification

BY THE END, YOU CAN

01Formulate premium- and volatility-space objectives.

02Choose weights consistent with liquidity and units.

03Diagnose identifiability and parameter instability.

04Build reproducible calibration governance.

01
INTUITION

Identify the state variables and the behavior they add.

Calibration chooses model parameters that reproduce selected market quotes under an objective function. A low scalar error can hide systematic residuals, unidentifiable parameters and unstable hedges.

01

The objective defines what good fit means.

02

Weights encode liquidity, units and desk priorities.

03

Stability through time is evidence alongside cross-sectional fit.

02
WHY MARKETS CARE

Ask which instruments can identify the dynamics.

Every surface model and stochastic process requires a repeatable path from cleaned quotes to parameters, diagnostics and fallback decisions.

INSTRUMENTS

vanilla calibration baskets

caps/floors

swaptions

exotic proxy instruments

QUOTE CONVENTION

State calibration instruments, timestamp, bid/offer, objective units, weights, parameter transforms and solver tolerances.

03
MATHEMATICS

Write the dynamics before interpreting parameters.

Formula · Full derivation

Weighted least squares

θ^=arg⁡min⁡θ∑iwi(mi(θ)−qi)2+λR(θ)\widehat\theta=\arg\min_\theta\sum_i w_i\left(m_i(\theta)-q_i\right)^2+\lambda R(\theta)

Fit and regularization are explicit modelling choices.

Open in Analytics
Formula · Full derivation

Gauss–Newton step

(JTWJ+λI)Δθ=−JTWr(J^TWJ+\lambda I)\Delta\theta=-J^TWr

The Jacobian reveals local parameter sensitivity and conditioning.

Open in Analytics
Full derivation
Full derivation

From quote residuals to a parameter update

Linearize model quotes around the current parameter vector.

  1. 01

    Define residuals

    Choose premium, implied-volatility or normalized residuals and preserve their units.

    ri(θ)=mi(θ)−qir_i(\theta)=m_i(\theta)-q_i
  2. 02

    Linearize the model

    Approximate residuals for a small parameter update using the Jacobian.

    r(θ+Δ)≈r(θ)+JΔr(\theta+\Delta)\approx r(\theta)+J\Delta
  3. 03

    Form the quadratic objective

    Insert the linearization into weighted least squares and add damping or regularization.

  4. 04

    Set the gradient to zero

    The normal equations produce a local Gauss–Newton step.

    (JTWJ+λI)Δ=−JTWr(J^TWJ+\lambda I)\Delta=-J^TWr
  5. 05

    Accept only validated steps

    Reprice, enforce domains, inspect residual shape and compare parameters with previous snapshots.

A calibration result is a parameter vector plus residuals, conditioning, constraints, lineage and a decision on whether it is safe to use.

Inputs
  • θ: parameter vector
  • q_i: market quote
  • m_i(θ): model quote
  • W: weight matrix
  • λR(θ): regularizer
Assumptions and limits
  • Non-convex objectives have local minima.
  • Sparse quotes weakly identify parameters.
  • Different units and weights produce different optima.
Formula · Short derivation

Conditioning

κ(JTWJ)=λmaxλmin\kappa(J^TWJ)=\frac{\lambda_{max}}{\lambda_{min}}

A large condition number signals weak local identification.

Open in Analytics
05
MODEL / PRICING

Calibrate, compute, and challenge the dynamics.

METHOD

Use bounded parameter transforms, deterministic multi-starts, analytical or validated sensitivities, and a documented fallback.

CALIBRATION

This lesson calibrates calibration itself: choose objective, weights, basket, regularization and stopping rules before fitting the production model.

Implementation with current QuantLib

Current QuantLib separates market structures, processes, instruments, engines and calibration helpers. Use those abstractions only after the lesson’s conventions, domains and numerical checks are explicit.

API authority: upstream QuantLib reference pinned in the source registry.
06PYTHON IMPLEMENTATIONOpen the implementation and checks.
ARCHITECTURE
  • Validate domains and units at the boundary.
  • Keep the numerical kernel framework-free and deterministic.
  • Return diagnostics with values.
  • Test analytical limits and failure states.
PYTHON 3 · NUMPY / SCIPY

Linear calibration diagnostic

Solve a weighted linearized fit and inspect conditioning.

REUSABLE EXAMPLE
01from __future__ import annotations
02
03import numpy as np
04
05def gauss_newton_step(jacobian: np.ndarray, residual: np.ndarray, damping: float = 1e-6) -> tuple[np.ndarray, float]:
06 if jacobian.shape[0] != residual.size or damping < 0:
07 raise ValueError("invalid calibration dimensions")
08 normal = jacobian.T @ jacobian + damping * np.eye(jacobian.shape[1])
09 step = np.linalg.solve(normal, -(jacobian.T @ residual))
10 return step, float(np.linalg.cond(normal))
11
12j = np.array([[1.0, 0.1], [1.0, 0.4], [1.0, 0.9]])
13r = np.array([0.01, -0.005, 0.002])
14step, condition = gauss_newton_step(j, r)
15assert np.isfinite(step).all() and np.isfinite(condition)
16assert np.linalg.norm(j @ step + r) < np.linalg.norm(r)
17print(np.round(step, 6), round(condition, 2))
EXPECTED OUTPUTA residual-reducing step and finite condition number.
SANITY CHECKS

✓ Dimensions are validated.

✓ Damping is non-negative.

✓ The linearized residual decreases.

07
INTERACTIVE LAB

Shock one parameter and trace the full response.

OPTIMIZER PATH AND RESIDUAL GEOMETRY

Calibration residual lab

Change weights, noise and initial parameters; watch optimizer path, residual heatmap and conditioning.

SYNTHETIC · CONTROLLED SCENARIOS
Final RMSE0.0016
Condition stateWell identified
Iterations30
Objective / condition (scaled) by Iteration

Well identified: Residuals decay with stable conditioning.

  • weighted RMSE
  • condition (scaled)
Iteration: 0. weighted RMSE: 0.1210. condition (scaled): 0.0150.

Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.

ACTIVE STATE

Well identified — Residuals decay with stable conditioning. Move the intensity control and inspect every series with pointer or touch.

08
FRONT OFFICE

Where the model meets the book.

ON THE DESK
“A perfect fit with unstable parameters is an expensive interpolation scheme.”
VISIBLE INPUTS

timestamped quotes

bid/offer

basket

weights

constraints

CALIBRATION

This lesson calibrates calibration itself: choose objective, weights, basket, regularization and stopping rules before fitting the production model.

RISK

parameter jump

basis residual

solver risk

model selection

DAILY WORKFLOW
  1. freeze snapshot
  2. clean basket
  3. multi-start fit
  4. inspect residuals
  5. approve/fallback
Production failure modes
  • unit mismatch
  • silent constraint binding
  • nondeterministic start
  • missing diagnostics
09MACRO CONNECTIONOpen the transmission channel.
MACRO CONNECTION

Regime shifts expose parameter identification

When the surface changes shape, parameters that were redundant in calm markets can move abruptly or hit bounds.

01Regime shifttransmits

changes quote geometry

02Calibration baskettransmits

exposes sensitivities

03Parameterstransmits

move or become unstable

04Model governanceoutput

accepts, regularizes or falls back

10COMMON PITFALLSOpen the failure checklist.
01

Reporting only RMSE.

02

Mixing premium and vol residuals without normalization.

03

Using one starting point.

04

Ignoring day-over-day parameter stability.

11SOURCES / FURTHER READINGOpen sources and continue the track.
research

Volatility, Monte Carlo and stochastic-volatility lectures

Research map for the mathematical progression and numerical experiments; prose, examples and code are original.

Source
Computational Finance Course
Author
L. A. Grzelak
Ref
main
OPEN ORIGINAL SOURCE ↗
implementation reference

Current volatility structures, processes, calibration helpers and tests

Implementation reference for production abstractions and validation patterns.

Source
QuantLib upstream
Author
QuantLib contributors
Ref
v1.42.1
OPEN ORIGINAL SOURCE ↗