← All Projects

Quantum-Classical PINNs for Derivatives Pricing

Quantitative FinancePINNsMachine LearningPDEsQuantum ComputingPyTorch

Status: Complete

GitHub: github.com/rylanmalarchick/quantum-derivatives-trader

Overview

This project uses physics-informed neural networks (PINNs) to solve partial differential equations in derivatives pricing. PINNs embed the governing PDE directly into the neural network loss function, enabling mesh-free solutions that scale to high dimensions where traditional finite difference methods fail.

Key insight: For a 5-asset basket option, finite difference requires ~10^12 grid points (infeasible). PINNs solve the same 6D PDE with 15,000 collocation points.

Key Results

Problem Dimension Method Result
Basket option 6D (5 assets + time) PINN 3.9% error vs MC, exact Greeks via autodiff
Volatility calibration Inverse problem PINN 4.5% vol surface recovery under no-arbitrage constraints
Merton jump-diffusion 2D PIDE PINN Gauss-Hermite quadrature for jump integral
Heston stochastic vol 3D PDE PINN Correlation, mean reversion, vol-of-vol
American options Free boundary PINN Penalty method for early exercise
Barrier options Path-dependent PINN Down-and-out calls with analytical validation

High-Dimensional Pricing (5-Asset Basket)

The multi-asset Black-Scholes PDE solved in 6 dimensions (5 assets + time):

Aspect Finite Difference PINN
Grid points (5 assets) ~10^12 15,000
Memory Infeasible ~3 GB
Greeks Numerical noise Exact (autodiff)
Cross-gammas Expensive Free

Result: Final training loss 1.40, 3.9% error vs Monte Carlo at S0.

Volatility Surface Calibration (Inverse Problem)

Given market prices C(K,T), recover local volatility via Dupire's equation:

Metric Value
Price fit 2.22% mean relative error
Vol surface recovery 4.51% error
Constraints Smoothness + no-arbitrage (convexity, calendar)
Training ~2 min (3000 epochs)

Advanced Models

Merton Jump-Diffusion (PIDE): Partial integro-differential equation with Gauss-Hermite quadrature for the jump integral (log-normal jump distribution).

Heston Stochastic Volatility (3D PDE): 3D coupled PDE with correlation, mean reversion, and vol-of-vol. Feller condition enforced to ensure variance stays positive.

American Options (Free Boundary): Early exercise via penalty method. The PINN learns both the option value and the optimal exercise boundary.

Barrier Options (Path-Dependent): Down-and-out call options with analytical formula validation. Most recent addition with comprehensive test coverage.

Architecture

Directory Description
src/pde/ PDE definitions (7 models)
src/pde/black_scholes.py 1D European
src/pde/basket.py N-asset basket (6D)
src/pde/dupire.py Local vol calibration
src/pde/merton.py Jump-diffusion (PIDE)
src/pde/heston.py Stochastic vol (3D)
src/pde/american.py Free boundary
src/pde/barrier.py Path-dependent (NEW)
src/classical/ PINN architectures
src/classical/pinn.py Standard MLP PINN
src/classical/pinn_basket.py High-dimensional with LHS
src/classical/pinn_calibration.py Inverse problem
src/quantum/ VQC integration (experimental)
src/quantum/variational.py Hardware-efficient ansatz
src/quantum/hybrid_pinn.py Quantum-classical hybrid
src/quantum/hybrid_basket.py High-dim hybrid
src/pricing/ Reference implementations
src/pricing/analytical.py Black-Scholes closed-form
src/pricing/monte_carlo.py MC with antithetic/control variates
src/pricing/finite_difference.py Crank-Nicolson
src/validation/ Greeks validation
tests/ 306 comprehensive tests
docs/theory.md 944 lines of mathematical derivations
notebooks/ 7 analysis notebooks

Testing Philosophy

"Tests are the specification. Write them first, write them thoroughly."

pytest tests/ -v  # 306 tests passing
Category Tests Coverage
PDE residuals 45 Physics constraints, boundary conditions
PINN models 68 Forward pass, gradients, training
Quantum circuits 32 Output ranges, parameter updates
Greeks validation 33 Analytical vs autodiff
Basket/calibration 89 MC validation, vol recovery
Advanced models 55 Merton, Heston, American, Barrier

Quantum-Hybrid (Experimental)

The project includes experimental integration of variational quantum circuits (VQCs) as function approximators within the PINN architecture:

Component Status
VQC trains and produces gradients Working
Hardware-efficient ansatz Implemented
Data re-uploading circuit Implemented
Practical pricing accuracy (<1% error) Not yet achieved

Honest assessment: The quantum component shows promise on simple problems but doesn't yet outperform well-tuned classical PINNs on production pricing tasks. Current results: ~22% relative error (market tolerance is <1%). This is research exploring when/why quantum expressivity might help.

Technology Stack

  • Deep Learning: PyTorch 2.10, PennyLane 0.44
  • HPC: JAX (JIT, vmap), GPU acceleration
  • Quantum: PennyLane (adjoint differentiation), hardware-efficient ansatz
  • Scientific: NumPy, SciPy (Gauss-Hermite, numerical integration)
  • Sampling: Latin Hypercube Sampling for high-dimensional collocation
  • Testing: pytest, 306 tests

Why This Matters

For Quantitative Finance

  1. High-dimensional pricing: Basket options, rainbow options require methods that scale beyond 3D
  2. Model calibration: Every trading desk calibrates daily; PINNs give smooth, arbitrage-free surfaces
  3. Greeks computation: Autodiff gives exact Δ, Γ, Θ, ν, cross-gammas—no numerical noise

For Research

  1. Honest quantum exploration: Testing VQC expressivity on real problems, not toy examples
  2. Reproducible benchmarks: 306 tests, documented theory (944 lines), readable code
  3. Production patterns: Clean architecture, comprehensive testing, mathematical documentation

Links


"The goal is not to prove quantum advantage, but to rigorously investigate when it might exist—while solving real problems with classical methods that work today."