We built an interactive quantum risk model to make one abstract claim concrete: that the tail of a business-risk distribution — the number a risk manager actually reports — can be estimated on a quantum computer with provably fewer model evaluations than Monte Carlo needs. You draw a small network of risk events, press a button, and the tool compiles it to a quantum circuit, runs it on an in-browser simulator, and prints the tail probability next to the exact answer and a classical baseline given equal work. This note opens the hood. Every stage of that pipeline is a short, well-understood piece of quantum machinery, and the point of the demo is not the toy number it prints — it is the scaling law underneath it.
If you have not tried it yet, do that first — the rest of this piece is a guided tour of what you will see.
What the tool asks, and what it answers
The left side of the demo is a small enterprise risk model with three ingredients. Risk items — here R1 market shock, R2 counterparty default, R3 liquidity squeeze — each with an intrinsic probability and a financial impact in euros. Conditional triggers — the arrows in the graph — capture contagion: if the market shocks, the chance of a counterparty default rises, which in turn raises the chance of a liquidity squeeze. And two estimation controls: a loss threshold, and a QAE accuracy given as a number of evaluation qubits. Press Run on simulator and the panel fills in.
For the default network — a €50M threshold and 5 evaluation qubits — the run reports something like this:
jos@quantum:~$ risk-qae --threshold 50 --eval-qubits 5 model 3 risk items · 3 conditional triggers loss threshold ≥ €50M good scenarios 4 of 8 (loss ≥ threshold) QAE estimate â = 0.146 P(loss ≥ €50M) exact (enum.) a = 0.119 QAE error |â − a| = 0.028 monte carlo 0.125 ± 0.057 (N = 32, equal work) state qubits 3 eval qubits 5 total qubits 8 Grover iters 31 (2⁵ − 1) ▶ resolution π/2⁵ ≈ 0.098 · scales as 1/N, not 1/√N
Two probabilities and a pile of resource counts. The estimate â = 0.146 is the quantum computer’s reading of the tail; the exact value a = 0.119 is the ground truth from enumerating all eight scenarios. To see where those numbers come from — and why the quantum one is worth the trouble at scale — we walk down the pipeline the demo runs top to bottom.
- Risk network → quantum state. One qubit per risk; rotations encode probabilities and triggers.
- Mark the loss event. Flag every scenario whose loss breaches the threshold — the tail becomes an amplitude.
- Amplitude estimation. Read that amplitude with a quadratic speedup over Monte Carlo.
- Read the answer. Convert the measured register back into a probability.
- Sensitivity analysis. Search for which risk drives the tail — Grover over QAE, a quartic speedup.
Step 1 · The risk network becomes a quantum state
Each risk item gets one qubit. A single-qubit rotation Ry(θ) tilts that qubit out of |0〉 so that the weight it places on |1〉 — “this risk occurred” — is exactly the risk’s intrinsic probability:
A conditional trigger — an arrow from one risk to another — is a controlled rotation. When the source qubit is |1〉, it adds rotation angle to the target, nudging its probability up; when the source is |0〉, it does nothing. Chain the three intrinsic rotations and the three controlled ones and the whole network collapses into a single state-preparation operator A acting on the all-zeros register:
The beauty of this encoding is that A prepares every scenario at once, each basis state |x〉 weighted by the square root of that scenario’s probability. Because the triggers are genuine controlled gates, the resulting distribution is correlated exactly the way the network says it should be — a market shock and a liquidity squeeze co-occur more often than their standalone probabilities would suggest. That is superposition doing the job a Monte Carlo engine would otherwise do one sampled scenario at a time.
Step 2 · Marking the loss turns the tail into an amplitude
Each of the eight basis states is one scenario, and its total loss is just the sum of the impacts of the risks that fired. With the default impacts (€40M, €30M, €20M) and a €50M threshold, four of the eight scenarios breach it:
We mark those «good» scenarios with a reflection Sχ that flips the sign of their amplitudes — the quantum equivalent of an indicator function. The quantity we care about is the total probability sitting on the marked states:
This a is the tail probability — and it is now encoded as the squared amplitude of the “marked” subspace inside the state A prepared. The whole problem has been rephrased into one question: what fraction of this quantum state’s weight lies on the marked states? That question has a famously efficient quantum answer.
Step 3 · Amplitude estimation, and the quadratic speedup
Classically you would estimate a by Monte Carlo: draw N random scenarios from the model, count how many breach the threshold, divide. The catch is the error bar. Sampling error shrinks like 1/√N, so halving the error costs four times the samples. Chasing a 0.1% figure the way regulators sometimes demand means millions to billions of model evaluations.
Quantum amplitude estimation (QAE) attacks the same number differently. Define the Grover-style operator
which rotates the state within the plane spanned by the “good” and “bad” subspaces by a fixed angle 2θ, where a = sin²θ. Estimating a is now the same as measuring that rotation angle — and measuring the eigen-angle of a unitary is exactly what quantum phase estimation does. The demo appends an evaluation register of m qubits, applies the controlled powers Q, Q², Q⁴, …, Q2^(m−1), and runs an inverse quantum Fourier transform. Each doubling of the power packs twice the “interferometric” information into the phase, and the punchline is the scaling:
Same budget of model evaluations, quadratically smaller error — or equivalently, a target accuracy reached with the square root of the evaluations. That is the quadratic speedup, and it is the whole reason to reach for a quantum computer here.
Step 4 · Reading the answer off the register
Measuring the evaluation register returns an integer y between 0 and 2m−1. The estimated tail probability is recovered by undoing the a = sin²θ relationship:
With five evaluation qubits the register can only land on 2⁵ = 32 grid points, so â is quantised. The true angle for a = 0.119 sits between grid points y = 3 and y = 4; the register concentrates on the nearer one, y = 4, giving
— the 0.146 the terminal printed, off by 0.028. That residual is not noise; it is resolution. Add a sixth evaluation qubit and the grid doubles to 64 points, halving the resolution floor to π/64; a seventh halves it again. The demo compares this quantum estimate against the exact enumeration and against a Monte Carlo run given the same number of model evaluations, so you can watch all three move as you turn the accuracy dial.
Why the toy doesn’t beat Monte Carlo — and why that’s fine
Look closely at the default run and you will notice the quantum estimate is actually further from the truth than a lucky Monte Carlo draw could be: the QAE resolution at five qubits is π/32 ≈ 0.098, while Monte Carlo with the same 32 evaluations carries a standard error near ±0.057. The quadratic speedup has not kicked in. That is expected, and it is worth being honest about.
Power laws only separate once N is large. At N = 32 the constants hidden in each «~» dominate and the two methods are within a factor of two of each other — look again at Figure 1 and note the lines are still close on the left. The crossover, and then the runaway, happens as you march right toward the accuracy a real risk report demands. A browser simulator caps out at a handful of qubits; the asymptotic regime where 1/N buries 1/√N is exactly where the hardware would earn its keep. The demo exists to show the shape of the curve, not to win a race at eight qubits.
The estimate is exact quantum mechanics with no hardware noise. What the toy demonstrates is the scaling of accuracy with evaluation qubits — not a benchmark you should read as a stopwatch.
The headline: sensitivity analysis and the quartic speedup
A tail probability is one number. The question a risk manager actually acts on is which input drives it: of all the intrinsic probabilities and trigger strengths, which one — when it moves — moves the tail the most? That is the sensitivity analysis, and it is the headline result of our 2021 paper, the algorithm its title actually names. The tail estimate above is only its inner loop.
Classically, sensitivity is a search wrapped around an estimation: perturb each parameter, re-run the entire Monte Carlo estimate, and hunt for the largest response. The quantum version stacks two quadratic speedups, one on each layer:
- Inner loop — amplitude estimation. Evaluating the tail for one parameter setting is the QAE of Steps 3–4: a quadratic speedup over Monte Carlo.
- Outer loop — Grover search. Finding the most sensitive parameter is a maximum-finding search over parameter space, and Grover search delivers a second quadratic speedup over scanning candidates one at a time.
The subtlety — and the technical contribution of the paper — is that the inner QAE is an imperfect oracle: it returns an estimate with bounded error, not a crisp yes/no bit, and textbook Grover assumes a perfect oracle. The construction uses a noise-robust amplitude-amplification variant that tolerates that inner uncertainty, so the two layers compose. Multiplying two quadratic speedups gives an overall quartic one:
| Task | Method | Cost vs. accuracy |
|---|---|---|
| Estimate the tail | Classical Monte Carlo | ~ 1/√N |
| Estimate the tail | Amplitude estimation | ~ 1/N (quadratic) |
| Rank the drivers | Monte Carlo + scan | ~ 1/√N |
| Rank the drivers | Grover × QAE | ~ 1/N² effective (quartic) |
The demo runs the inner estimate only — the single tail probability. The outer Grover search over parameters, the part that earns the quartic and that the paper is built around, is described here but not executed in the browser. It is the reason the whole construction is more than “Monte Carlo, but quantum.”
What this needs at production scale
The toy above runs on eight qubits in a browser. The real question is how big the honest version gets — and the answer is strikingly modest. Our 2021 analysis of a business-risk model used at Deutsche Börse Group showed the full construction would run on fewer than 200 error-corrected qubits, with a provable quadratic speedup over the Monte Carlo it would replace — and the quartic speedup for the sensitivity ranking on top of that.
Two hundred logical qubits is squarely inside the envelope of the fault-tolerant machines now on vendor roadmaps. The catch is the same one that governs the Shor estimate: those are logical qubits, and the number of physical qubits behind each depends entirely on the error-correction code — the multiplier we unpack in why quantum error correction, not qubit count, decides when RSA and ECC fall. Business risk is the near-term target precisely because its model is compact: a handful of parameters, not the thousands that a faithful credit- or liquidity-risk book would demand. Credit and liquidity risk are the natural next applications of the very same construction — the algorithm does not change, only the number of data points it must ingest.
Honest caveats
The same disclaimers the demo carries apply to every number above:
- Additive trigger model. Conditional triggers add rotation angle on the target qubit — a faithful, compact encoding of a probabilistic risk network. The published model handles richer dependency structures.
- Grover operator as one block. The amplitude operator
Qis computed as a unitary and applied as a single labelled block, its controlled powers built by matrix squaring. A gate-level decomposition exists but would bury the structure at this scale. - State-vector simulation. The estimate is exact quantum mechanics with no hardware noise; it shows the scaling of accuracy with evaluation qubits, not a hardware benchmark.
- Inner estimate only. The browser runs the single tail-probability estimate. The outer Grover search over parameters — the source of the quartic speedup — is explained but not executed.
- Best-case readout. The reported estimate is the most likely evaluation-register outcome — the nearest grid point — not a sampled shot. On hardware the per-shot estimate would scatter around it; here we report the noiseless centre.
References & sources behind the demo
- M. C. Braun, T. Decker, N. Hegemann, S. F. Kerstan, C. Schäfer, A Quantum Algorithm for the Sensitivity Analysis of Business Risks, arXiv:2103.05475 (2021). — the state-preparation encoding, the QAE inner loop, and the Grover-over-QAE sensitivity analysis behind the quartic speedup; the <200 error-corrected-qubit estimate for the Deutsche Börse Group model.
- G. Brassard, P. Høyer, M. Mosca, A. Tapp, Quantum Amplitude Amplification and Estimation, arXiv:quant-ph/0005055 (2000). — the original 1/N amplitude-estimation result.
- S. Woerner, D. J. Egger, Quantum Risk Analysis, npj Quantum Information 5, 15 (2019). — amplitude estimation applied to financial tail-risk measures.
- D. S. Abrams, C. P. Williams, and the maximum-finding line of work (Dürr & Høyer, arXiv:quant-ph/9607014) behind Grover-based search over a parameter space.
All figures are illustrative order-of-magnitude estimates from an idealised, noiseless simulation — not engineering specifications. The browser demo runs the inner tail estimate on a state-vector simulator; the speedups quoted are asymptotic scaling laws that separate at accuracies well beyond what an eight-qubit toy reaches. See the demo for the full caveats.
