Quantum topological crash detection

Abstract

Persistent homology can read structural change in a financial time series that a price chart alone does not show. We embed market data into point clouds, estimate Betti numbers with classical solvers and with quantum phase estimation, and show that spikes in β₀ line up with crash regimes — then train a simple LSTM on those topological features.

Published
Reading time
6 min

Level

Advanced

Share article

A crash is easy to see after the fact: prices fall, volatility jumps, headlines follow. The harder question is whether the shape of the market — how the recent past sits relative to itself — changes before or during that collapse in a way a single price series does not make obvious.

This note is a walkthrough of a pipeline from collaborative work with Saleh Naghdi, Lukas Rapp, Steven Su, and Helena Brittain (2024). The idea is classical topological data analysis (TDA) on time-delay embeddings of the S&P 500 around 2008, with a quantum phase-estimation (QPE) route for estimating Betti numbers, and a small LSTM that classifies crash severity from topological features.[1][2]

Markets are paths. Topology asks what those paths look like as clouds — and when the cloud’s connectivity breaks.

From a price series to a point cloud

Start with a scalar series X={x0,x1,,xL1}X = \{x_0, x_1, \ldots, x_{L-1}\}. Takens’ embedding theorem says that, under mild conditions, the dynamics can be reconstructed in an NN-dimensional space by stacking delayed samples:

zt=(xt,xt+d,,xt+(N1)d).z_t = (x_t,\, x_{t+d},\, \ldots,\, x_{t+(N-1)d}).

A sliding window of length ww then turns the long trajectory into a sequence of local point clouds

Zt={zt,zt+1,,zt+w1},Z^t = \{z_t,\, z_{t+1},\, \ldots,\, z_{t+w-1}\},

with roughly K=Lw(N1)dK = L - w - (N-1)d windows. We used N=4N=4, d=5d=5, w=5w=5 on crisis-era S&P data: small enough to run, large enough that each window still carries a short dynamical fingerprint.

Two nearby embedded points are connected when their Euclidean distance is below a resolution ϵ\epsilon. That rule builds a Vietoris–Rips complex — the combinatorial object whose holes and components we will count.[3]

Betti numbers as market descriptors

On a simplicial complex K\mathcal{K}, the kk-th Betti number βk\beta_k counts independent kk-dimensional holes: β0\beta_0 is the number of connected components, β1\beta_1 the number of independent loops, and so on. Equivalently, if Δk\Delta_k is the combinatorial Laplacian at dimension kk,

βk=dim(kerΔk).\beta_k = \dim(\ker \Delta_k).

As ϵ\epsilon grows, components merge and β0\beta_0 falls; loops can appear and disappear. Plotting βk(ϵ)\beta_k(\epsilon) gives a Betti curve. Doing the same for every time window gives a Betti time series — a topological movie of the market.

Classically, persistence packages (for example Ripser / GUDHI) compute these numbers directly from the complex.[3] In our runs at fixed ϵ0.08\epsilon \approx 0.08, β0\beta_0 rose sharply in windows that overlapped fragmented, crisis-like regimes, while β1\beta_1 and β2\beta_2 moved more modestly. That is the empirical hook: connected-component count tracks market fragmentation.

Where the quantum step enters

Betti estimation reduces to counting zero eigenvalues of Δk\Delta_k. Quantum phase estimation can probe that spectrum when the Laplacian is packaged as a unitary.[4]

The practical pipeline is:

  1. Build the Rips complex at a chosen ϵ\epsilon and extract boundary operators BkB_k.
  2. Form Δk=BkBk+Bk+1Bk+1\Delta_k = B_k^\dagger B_k + B_{k+1} B_{k+1}^\dagger.
  3. Pad and rescale to a Hermitian HH whose dimension is a power of two (needed for a clean qubit register).
  4. Implement U=eiHU = e^{iH} (or a closely related phase convention) and run QPE on a maximally mixed state over the target register.
  5. The probability of measuring phase 00 estimates the fraction of zero eigenvalues:
β~k2qp(0),\tilde{\beta}_k \approx 2^q \, p(0),

where qq is the number of qubits in the padded space.

On the problem sizes we could simulate, QPE tracked the classical Betti estimates within sampling error. That does not mean “quantum advantage for crash detection” today — the complexes are still tiny by market-data standards — but it does mean the topological observable is the same object on both sides of the classical/quantum cut.

Precision qubits qq in the embedding stage also matter: continuous distances must be discretized before state preparation, so quantum granularity and classical ϵ\epsilon are coupled design choices, not independent knobs.

From Betti curves to crash spikes

A single Betti curve is a shape. Crash detection needs a change of shape. We compare successive curves with an LpL^p distance — for a difference vector dd,

dp=(idip)1/p,\|d\|_p = \Bigl(\sum_i |d_i|^p\Bigr)^{1/p},

and plot that scalar over time. Spikes mark windows where the topology jumped. Empirically, large L2L^2 jumps aligned with known stress periods in the 2008 sample; β0\beta_0 alone already carried most of the signal.

A complementary scalar is relative deviation from a moving average of price,

Pdev(t)=PtPMA(t)PMA(t)×100,P_{\mathrm{dev}}(t) = \frac{|P_t - P_{\mathrm{MA}}(t)|}{P_{\mathrm{MA}}(t)}\times 100,

which we used both as a sanity check against the topological spikes and as a label source for supervised learning.

LSTMTopology: classifying severity

Topology gives features; we still wanted a classifier. LSTMTopology is a small PyTorch Lightning module: a multi-layer LSTM over topological (and deviation) features, a linear head, dropout, and weighted multiclass precision. Labels come from deviation thresholds at three horizons (ww, 3w3w, 6w6w), producing small / medium / large crash tags when successive thresholds are crossed.

This is deliberately boring ML on purpose. The claim is not that LSTMs invent crashes; it is that Betti-derived features are informative enough for a standard sequence model to separate regimes that price-only baselines treat as generic volatility.

What we actually saw

On October 2008 S&P windows, price chopped between roughly the high 800s and high 900s with the usual crisis whiplash. Against that backdrop:

  • β0(ϵ)\beta_0(\epsilon) falls as ϵ\epsilon grows — components merge — with the steepest drops marking the scales where the cloud’s connectivity reorganizes.
  • Error bars on β0\beta_0 across samples are largest in the transitional ϵ\epsilon band (around 0.050.050.10.1 in our units), exactly where merges happen.
  • In time, β0\beta_0 shows isolated spikes (one clear example near t40t \approx 40 in a short exploratory run) that coincide with structural breaks rather than every noisy tick.
  • Classical persistence and QPE estimates agree closely enough that disagreements look like finite-shot noise, not a different topological theory.

None of this replaces econometrics. It adds a geometric vocabulary: crashes as changes in connectivity of the reconstructed state space.

Limits, honestly

The present pipeline is a research sketch, not a trading system. Window parameters (N,d,w,ϵ)(N,d,w,\epsilon) are hand-chosen; QPE is simulated on padded Laplacians that fit in classical linear algebra; transaction costs, microstructure, and look-ahead in label design are out of scope. Higher Betti numbers (β1\beta_1, β2\beta_2) were weaker signals here — useful context, not the main alarm.

Still, the through-line is clean enough to state in one sentence: embed the market, read its holes, watch when the hole-count jumps — and optionally estimate that count with the same linear-algebra story quantum phase estimation already knows how to tell.

Takeaway

Topological crash detection is not mysticism about “quantum finance.” It is persistent homology on Takens embeddings, with β0\beta_0 as an early structural indicator, QPE as an alternate estimator of kerΔk\ker\Delta_k, and a lightweight LSTM as a sanity check that the features carry label information. If the price series is the score, the Betti curve is a reading of the harmony changes — and crashes are among the loudest key changes the market plays.

References

  1. [1]F. Takens. Detecting strange attractors in turbulence. Lecture Notes in Mathematics 898, Springer, 1981.
  2. [2]H. Edelsbrunner, D. Letscher, and A. Zomorodian. Topological persistence and simplification. Discrete Comput. Geom. 28, 511, 2002.
  3. [3]The GUDHI Project. GUDHI User and Reference Manual. https://gudhi.inria.fr/doc/latest/, 2024.
  4. [4]M. A. Nielsen and I. L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, 10th anniversary ed., 2010.

Field notes

New research, without the noise.

Occasional essays from this section. No digest churn, no third-party tracking.