Independent Student Research Quantum Computing × Portfolio Theory Aditya Mishra · July 2026

When does a quantum algorithm actually find the best portfolio?

I built a quantum portfolio optimizer end to end: real market data, Markowitz risk-return math, a quantum circuit. Then I ran 10,080 experiments to map exactly where the algorithm succeeds, where it fails, and why. Every single trial was checked against the provably correct answer.

The headline finding, drawn like the market data it came from

How often QAOA recovers the exact optimal portfolio, as the number of candidate assets grows

100% 80% 60% 40% 50% floor, never crossed 97.4% 51.5% 4 assets 6 8 10 12 assets
10,080
Trials run
51
Problem instances
4–12
Qubits
100%
Checked vs. ground truth
72.4%
Overall success rate

If you read nothing else

The 60-second version

  1. I built the whole pipeline myself. Stock price data becomes a risk-vs-return optimization problem (the same Markowitz framework used on Wall Street), which I translated into the physics language a quantum computer understands, solved with the QAOA quantum algorithm, and verified, on every run, against a brute-force enumeration of every possible portfolio.
  2. The finding: the algorithm wears down predictably as problems grow. Success falls smoothly from 97% on 4-asset problems to 51% on 12-asset problems, and the "obvious fix" of using a deeper quantum circuit doesn't help. At a fixed training budget it often makes things worse. I traced the failure to its mechanism: the algorithm's confidence in the right answer gets diluted across an exponentially growing space.
  3. The part I'm proudest of: I reported the result I didn't want. My small pilot study suggested deeper circuits rescue large problems, which was the exciting story. The full, properly powered study showed the opposite. I published the reversal, not the pilot.

What was built

From stock prices to a quantum circuit

A portfolio here is a yes/no decision on each stock: hold it or don't. That makes it a string of bits, and picking the best portfolio becomes a search over all 2n bitstrings for the one with the best risk-adjusted return. I encoded that objective as an energy landscape (an Ising Hamiltonian) where the best portfolio is literally the lowest-energy state, then used QAOA, a hybrid quantum-classical algorithm, to steer a quantum state toward it. Each stage is a separate, tested module:

Market datareturns μ, risk Σ Markowitz objectivereturn − risk − budget QUBO → Isingphysics encoding QAOA circuitPennyLane, p layers Brute-force checkall 2ⁿ portfolios

A built-in self-check asserts the three mathematical forms (direct objective, QUBO matrix, Ising Hamiltonian) agree on every bitstring, so when quantum and classical answers are compared, they are provably scoring the same function.

Proof it works

A worked example: six real stocks, exact answer recovered

On a six-stock universe (AAPL, MSFT, NVDA, GOOGL, AMZN, JPM; pick exactly 3), the quantum optimizer found NVDA + GOOGL + JPM, and the brute-force enumeration of all 64 portfolios confirms that is the optimum, rank 1 of 64. The choice is economically sensible: the two strongest growers plus the lowest-volatility bank.

MethodObjective valuePortfolio foundVerdict
QAOA (quantum)−0.6658NVDA · GOOGL · JPMoptimal
Brute force (ground truth)−0.6658NVDA · GOOGL · JPMreference
Classical greedy baseline−0.6658NVDA · GOOGL · JPMtied
Optimization convergence: three restarts all descend to the true optimum energy
All 3 optimizer restarts descend onto the true optimum energy.
Measured probabilities of the top bitstrings; the optimum leads only marginally
The optimum (green) leads, but barely. That thin lead is the whole story below.

Interactive · a real quantum simulation, running in this page

Solve it yourself: a live quantum optimizer

This panel is not a recording. It simulates the same six-qubit QAOA circuit as the Python study — 64 complex amplitudes, alternating cost and mixer layers, Adam training the angles — in JavaScript, on the same six stocks and the identical objective H(x). Set the risk-aversion q, the budget B, and the circuit depth p, then run it. Because the problem is small, every run also brute-forces all 64 portfolios, so the verdict below is checked against ground truth, not asserted. When the algorithm misses, the badge says so.

press run — the verdict (rank, approximation ratio, P(optimum)) appears here, checked against a brute-force enumeration of all 64 portfolios

Training the circuit

⟨H⟩ per optimizer step, 3 restarts · dashed line = true optimum

Where the probability goes

all 64 portfolios, best → worst · green bar = the true optimum

Honesty check, automated: on load the page recomputes H(x) for all 64 portfolios in JavaScript and asserts the values match the Python pipeline's (baked in at build time) to 10⁻⁶ — open the browser console to see it. Rank and approximation ratio are computed exactly as validate.py computes them.

Interactive · you vs. the algorithm

Beat the algorithm

Think you can eyeball a better portfolio? Pick exactly 3 stocks (the budget B set above). Your pick, QAOA's pick, and the brute-force optimum are all scored with the same H(x), and the strip shows where each lands among all 64 possible portfolios — every tick is one portfolio, best on the left.

pick 3 stocks to reveal the comparison

The study · 10,080 trials · 51 instances · every one verified

Six findings

The sweep varied problem size (4–12 assets), circuit depth, penalty strength, and four market correlation structures, with 10 seeded trials per configuration. Findings are numbered as in the full paper.

Finding 4.1

Success degrades smoothly with problem size, with no cliff 97% → 51%

As the universe grows from 4 to 12 assets, exact-optimum recovery falls 97% → 68% → 62% → 58% → 51%. The decline is monotonic and gradual: the algorithm doesn't shatter at some critical size, it wears down predictably. It never fell below the 50% line at any size tested.

risk aversion q
penalty scale
0%100% success hover a cell for trial counts
Success rate by problem size (rows) and circuit depth (columns), computed live from all 10,080 trials in benchmark/results.csv. Penalty scale 1.0 is the headline setting; the right-hand column pools all depths — the hero chart's 97% → 51% line.
Finding 4.2

Deeper circuits don't pay, and often hurt 3× cost, 0 gain

The natural fix for a struggling quantum circuit is more layers. The data says otherwise: at every size above 4 assets, the shallowest circuit won, and adding layers made success strictly worse at n=8 and n=10. At n=12, extra depth tripled compute time for no gain. The mechanism: each layer adds parameters to train, and at a fixed training budget, harder-to-train beats more-expressive.

Depth tradeoff at n=12: flat success while wall time triples
At n=12: success flat across depth while wall-clock time triples.
Finding 4.3

The failure mechanism: the signal dilutes, it doesn't vanish 19% → 0.1%

Why does size hurt? The probability the algorithm assigns to the single best portfolio collapses from ≈19% at n=4 to ≈0.1% at n=12, always above the random-guessing floor, but by an ever-thinner margin. The algorithm still points at the right answer; the right answer just stops standing out from the crowd. This is the study's mechanistic core: not "it fails," but why it fails.

Probability mass on the optimal bitstring vs problem size, tracking just above the uniform floor
Probability placed on the optimum vs. the uniform 1/2ⁿ floor (dashed).
Finding 4.4

Even the misses are near-misses quality ≥ 99.9%

When the algorithm fails to find the exact best portfolio, it almost always returns one that is nearly as good: median solution quality stays at or above 99.9% of optimal at every size. In investing terms, the downside of a miss is measured in basis points, not blowups. The rare true failures are budget-violating portfolios, exactly the failure mode the penalty term exists to suppress.

Normalized solution quality by problem size, tightly clustered near 1.0
Solution quality (1.0 = exact optimum) stays tightly clustered near 1.0.
Finding 4.5

Penalty tuning: a weak lever in the tested range 74% vs 72%

The budget constraint ("hold exactly B stocks") is enforced by a penalty term. Halving it barely moved success (74% vs 72%), a difference within run-to-run noise. I flag honestly what this can't say: the over-penalized 2× setting was cut by the time budget and remains untested, so the claim is scoped strictly to the range studied.

Success rate by penalty scale, nearly identical bars
Success by penalty scale: a difference within noise.
Finding 4.6

A trap in the data, and catching it confound removed

At face value, portfolios built from real market data look easiest (81% success). That's a statistical trap: real-data instances only exist at the smallest sizes, so their bar is really a size effect in disguise. Comparing only the correlation regimes that span all sizes (69–73%), the differences dissolve. Conclusion: market correlation structure barely matters, and only a size-controlled comparison can show it.

Success by covariance regime; the real-data bar is a size artifact
Success by correlation regime. The tall "real" bar is a size artifact, not a regime effect.
Disclosures: in the spirit of an honest research note

The pilot study said the opposite, and I reported the reversal. An early, under-powered pilot (fewer steps, one restart, fewer trials) suggested deeper circuits rescue large problems, which was the more exciting story. The full study, with 10× the statistical power, reversed it. This page reports what the evidence supports, not what the pilot promised. It is also a concrete lesson I now carry: under-powered sweeps mislead.

No quantum advantage is claimed. At these sizes a classical computer finds the exact answer instantly; that is precisely what makes honest measurement possible. All runs used a noise-free classical simulator of a quantum computer, and real hardware would do worse. The contribution is a ground-truth-validated map of where and why a quantum heuristic succeeds and fails, failure modes included.

Why the numbers can be trusted

Rigor, by construction

Where this goes next

Future work

Repeat the sweep under a realistic noise model, then on real quantum hardware; test whether smarter initialization (warm-starting from classical solutions) removes the depth penalty; and push past the brute-force limit with tensor-network simulators, where verification itself becomes the research problem. Neutral-atom machines are a natural target: their native physics is already Ising-shaped, the same form this portfolio problem takes.