Application

Quantum portfolio optimization: the three routes, what each has shown, and what to run instead

Quantum portfolio optimization means one of three things: selecting a discrete portfolio written as a QUBO for QAOA or an annealer, solving the continuous mean-variance problem with quantum linear algebra, or running quantum-inspired tensor networks on a classical computer. We tested the first route: QAOA on a noiseless simulator, picking 7 of 14 synthetic assets, against exact classical solvers on the same instance. The exact methods found the optimum in milliseconds; QAOA, with a penalty a real run could use, picked the optimum about as often as a random valid portfolio would. No route has yet beaten classical solvers on a real portfolio, and the most detailed estimate for the linear-algebra route needs millions of logical qubits at 100 assets.

Updated

At a glance

The problem
Choose weights or a subset of assets that trade expected return against risk, measured as the variance x⊤Σxx^\top \Sigma x, under budget, cardinality or lot-size constraints
Discrete route
Asset selection as a QUBO, one qubit per asset, solved by QAOA, a quantum annealer or a quantum-inspired Ising machine
Linear-algebra route
A quantum interior point method at 100 assets needs about 8×1068 \times 10^{6} logical qubits[1] and 7×10297 \times 10^{29} T gates[1]
The same problem classically
Solved in a matter of seconds on a laptop[1] at 100 assets
Our 14-asset selection run
Exact enumeration of all valid portfolios in 0.012 s; QAOA at p=5p = 5 in 48 s, with a chance of the optimum per shot of 0.030%, about that of a random valid portfolio
In eigenkit
QUBO, exact brute_force() and QAOA with the X mixer; HHL for small linear systems. No annealer, no MILP, no tensor-network optimiser, no portfolio helper.

Three routes, and which constraint sends you down which

The classic mean-variance problem, with continuous weights and linear constraints, is a convex program, and classical interior point methods are the standard way to solve it[1]. The quantum proposal aimed at it keeps the method and replaces its linear-algebra core: a quantum interior point method built on a quantum linear-system solver, the family that HHL started.

Constraints that make the problem discrete change the picture. Holding exactly K assets, buying in round lots or paying a fixed cost per trade turns the problem into a mixed-integer one. Written with binary variables and penalties, a selection problem becomes a QUBO, the input of QAOA, of quantum annealers and of quantum-inspired machines such as simulated bifurcation. How to write one is in the QUBO and Ising guide.

Rebalancing over many periods multiplies the variables by the number of periods, and the QUBO grows past what any quantum device holds. That is where the third route, tensor networks, has been tried: a classical method borrowed from quantum physics, which runs on ordinary hardware.

A cardinality-constrained selection as a QUBO in eigenkit

import numpy as np
from eigenkit.optimization import QUBO

rng = np.random.default_rng(108)                  # 8 assets, one-factor model
beta = rng.uniform(0.5, 1.5, 8)
sigma = 0.18**2 * np.outer(beta, beta) + np.diag(rng.uniform(0.10, 0.30, 8) ** 2)
mu = 0.02 + 0.06 * beta + rng.normal(0.0, 0.02, 8)
q, k = 0.5, 4                                     # risk aversion, pick exactly 4


def portfolio_qubo(a):
    # q x'Sigma x - mu'x + a (sum(x) - k)^2, with x_i^2 = x_i
    n = len(mu)
    Q = q * sigma - np.diag(mu) + a * (np.ones((n, n)) - 2 * k * np.eye(n))
    return QUBO(Q, constant=a * k * k)


off = np.abs(sigma).sum(axis=1) - np.diag(sigma)
bound = np.max(np.abs(mu) + q * (np.diag(sigma) + 2 * off))
print(round(bound, 3))                           # 0.456  the provable penalty weight

x, energy = portfolio_qubo(bound).brute_force()
print(x, sum(x), round(energy, 4))                # (1, 0, 0, 0, 1, 1, 1, 0) 4 -0.0328

x, energy = portfolio_qubo(0.001).brute_force()
print(x, sum(x), round(energy, 4))                # (1, 0, 0, 0, 0, 0, 1, 0) 2 -0.0994  too weak: two assets

Pick exactly 4 of 8 assets to minimise half the variance minus the expected return, on synthetic data. The provable penalty weight makes the QUBO's exact minimum the best 4-asset portfolio; a weight that is too small lets a 2-asset portfolio undercut it. Checking this by brute force before choosing a solver costs nothing at this size.

Our run: 7 of 14 assets, every solver on the same instance

Synthetic one-factor returns and covariances, mean of five seeds. QAOA ran on eigenkit's noiseless simulator; simulated annealing is the classical dwave-samplers code on a CPU. The provable penalty is what a real run would use; the tuned one needed the brute-force answer to set.

SolverP(optimum) per sampleWall-clock per solve
Enumeration of the 3,432 valid portfoliosalways, exact0.012 s
eigenkit QUBO.brute_force()always, exact0.039 s
Mixed-integer solver (HiGHS), no penaltyalways, proven0.066 s
Simulated annealing, tuned penalty, 100 reads18.6%0.016 s
Simulated annealing, provable penalty, 100 reads0.2%0.014 s
QAOA p = 5, tuned penalty0.101%63 s
QAOA p = 5, provable penalty0.030%48 s

Run qaoa-portfolio-selection of 2026-11-03, mean and spread over 5 seeds, on Synthetic one-factor model of annualised returns and covariances, one instance per size (seed 100 + n). A uniformly random valid portfolio is optimal with a chance of 1 in 3,432. QAOA with the provable penalty matches that, and forward greedy selection was optimal on 80% of the five instances. No hardware ran, the data are synthetic, and nothing here is a backtest.

What the run means if you are deciding what to buy or build

At 14 assets the problem is small enough to enumerate, so the exact answer is free. A real selection problem has hundreds or thousands of assets, where enumeration stops and a mixed-integer solver takes over; it returns a proven optimum or a gap to it, and handles cardinality and lot sizes as constraints rather than penalties. The QAOA vs MILP comparison goes through that decision.

The penalty is what held QAOA back here. To keep the optimum valid without knowing it, the penalty has to be large, and after scaling it drowns the return and risk differences between valid portfolios. QAOA then learns to hold seven assets, but not which seven are best; simulated annealing with the same penalty also stalled. A mixer that keeps the asset count fixed avoids the penalty altogether[4], but eigenkit does not have one, and we did not test it. A published benchmark of QAOA variants for this problem, with shot noise and hardware errors, is the place to start if you want to go further[3].

So the honest answer to a vendor offering quantum portfolio optimization today is a question: which classical solver did you compare against, on how many assets, and was the quantum result read from shots or from a simulator's exact state?

The linear-algebra route: quantum interior point methods

Dalzell and colleagues compiled a quantum interior point method for portfolio optimisation from input to output and counted its cost, including constant factors[1]. The method solves a linear system at every step with a quantum linear-system solver and reads the result back by tomography. Its cost depends on a condition number and a tomography precision, and in their simulations of portfolios up to 120 stocks both got worse as the number of assets grew.

Their estimate for 100 assets at a precision of 10−710^{-7} is 8×1068 \times 10^{6} logical qubits[1] and 7×10297 \times 10^{29} T gates[1] spread over 2×10242 \times 10^{24} layers[1]. At the gigahertz clock speeds of classical chips, that many layers would take millions of years[1]; a laptop solves the same problem in seconds. The authors conclude that fundamental improvements to the method are needed before it can give a practical advantage. Why linear-system solvers struggle with dense, ill-conditioned matrices such as covariances is on the HHL page.

Tensor networks: the quantum-inspired route

Mugel and colleagues set up a dynamic portfolio problem on 8 years of daily prices for 52 assets[2], with decisions over several periods, and compared exact classical solvers and exhaustive search, D-Wave's hybrid quantum-classical annealing service, two variational quantum eigensolver approaches on IBM-Q, and a tensor-network optimiser running classically. The largest problems had up to 1,272 fully connected qubits[2], and only the hybrid annealing service and the tensor networks handled the largest systems.

The lesson for a buyer: of the two methods that handled the largest instances in that study, one ran entirely on classical hardware. The tensor networks page explains how they compress a large state and where they are used. eigenkit has no tensor-network optimiser.

Which route for which portfolio problem

ProblemRun this todayQuantum route and its status
Mean-variance with continuous weights and linear constraintsA convex quadratic or conic solverQuantum interior point methods: millions of logical qubits at 100 assets
Selection with a fixed number of assets, round lots or fixed costsA mixed-integer solver; greedy or local search for a quick boundQUBO with QAOA or annealing: no advantage shown; see quantum annealing vs QAOA
Rebalancing over many periods with transaction costsMixed-integer or dynamic programming, or a heuristicTensor networks, which are classical, and hybrid annealing in one published study

What would change this result

For the discrete route, the first thing to change is the formulation, not the hardware. In our run the safe penalty made the valid portfolios look almost alike to QAOA; with a tuned penalty the same circuit did better on the objective, but that penalty needed the answer to set. A mixer that only moves between portfolios of the right size keeps the constraint without any penalty[4]. We did not test it, because eigenkit does not have one. The test is simple to state: on the same instance, does QAOA's chance of the optimum per shot rise clearly above one over the number of valid portfolios?

The second is size. At 14 assets enumeration is free, so nothing a heuristic does can pay off. A quantum method could only matter on selection problems where a mixed-integer solver's gap stays open, which means many more qubits than a simulator holds and a device whose noise does not wash out the signal. A published study of QAOA variants for this problem, with shot noise and hardware errors, is the reference for how the variants behave as they move off the simulator[3].

For the linear-algebra route the condition is fault tolerance and a better method together: the estimate above assumes millions of error-corrected logical qubits, and its authors conclude that the method itself needs fundamental improvements before it could be practical[1]. Until then the useful check is the one on this page: write your selection problem as a QUBO, solve it exactly, and set any quantum run against that answer on the same instance.

Run it on a real QPU with EigenOrbit RouterThe QAOA circuit of a small asset-selection QUBO on a real QPU, to see what noise does to the shot distribution.In eigenkit: pip install "eigenkit[router]", then provider=RouterConfig(device=...) (docs).

Questions

Is quantum portfolio optimization better than classical?

Not on the evidence so far. No quantum method has been shown to beat classical solvers on a real portfolio problem. In our own 14-asset run on a simulator, exact classical methods found the optimum in milliseconds, while QAOA with a safe penalty found it about as often as a random valid pick. A constraint-preserving mixer, larger problems and better hardware are what could change that, and each can be tested. The most detailed estimate for the quantum linear-algebra route needs millions of logical qubits for 100 assets.

How does quantum portfolio optimization work?

Most proposals write asset selection as a QUBO: one binary variable per asset, the risk and return as quadratic and linear terms, and constraints such as the number of assets as penalty terms. QAOA on a gate-based computer or a quantum annealer then searches for a low-cost bitstring. A second family speeds up the linear algebra inside classical optimisation methods, and a third uses tensor networks on classical hardware.

How many qubits does portfolio optimization need?

For asset selection as a QUBO, one qubit per asset, plus slack qubits if there are inequality constraints such as a budget cap. For the quantum interior point method on 100 assets, one estimate gives about eight million logical qubits, which means far more physical qubits after error correction.

Can QAOA solve the Markowitz portfolio problem?

Only a discrete version of it. QAOA works on binary variables, so it selects which assets to hold, not continuous weights, and constraints become penalties. In our runs the penalty needed to keep answers valid left QAOA with no measurable preference among the valid portfolios. The continuous Markowitz problem is a convex quadratic program that classical solvers handle exactly.

Does quantum annealing work for portfolio optimization?

It takes the same QUBO as QAOA and has been tested on portfolio problems, including with D-Wave's hybrid service; in the study cited on this page a classical tensor-network method handled the same largest problems. Our run used classical simulated annealing, not a quantum annealer, so it says nothing about annealing hardware.

Can I try quantum portfolio optimization in Python?

Yes. eigenkit can build the asset-selection QUBO, check it by brute force and solve it with QAOA on a simulator, as the example on this page does. Run an exact classical solver on the same instance next to it, and report the share of sampled shots that are optimal rather than the best bitstring the simulator decodes.

Sources

  1. A. M. Dalzell, B. D. Clader, G. Salton, M. Berta, C. Y.-Y. Lin, D. A. Bader, N. Stamatopoulos, M. J. A. Schuetz, F. G. S. L. Brandão, H. G. Katzgraber, W. J. Zeng. End-to-end resource analysis for quantum interior point methods and portfolio optimization. PRX Quantum 4, 040325, 2023. arXiv:2211.12489.
  2. S. Mugel, C. Kuchkovsky, E. Sánchez, S. Fernández-Lorenzo, J. Luis-Hita, E. Lizaso, R. Orús. Dynamic portfolio optimization with real datasets using quantum processors and quantum-inspired tensor networks. Physical Review Research 4, 013006, 2022. arXiv:2007.00017.
  3. S. Brandhofer, D. Braun, V. Dehn, G. Hellstern, M. Hüls, Y. Ji, I. Polian, A. S. Bhatia, T. Wellens. Benchmarking the performance of portfolio optimization with QAOA. Quantum Information Processing 22, 25, 2023. arXiv:2207.10555.
  4. S. Hadfield, Z. Wang, B. O'Gorman, E. G. Rieffel, D. Venturelli, R. Biswas. From the quantum approximate optimization algorithm to a quantum alternating operator ansatz. Algorithms 12, 34, 2019. arXiv:1709.03489.

Run it yourself with eigenkit

eigenkit is EigenOrbit's open-source Python library: write a circuit once, run it on any simulator or QPU, and test it against a classical baseline on your own data before you invest in it or rule it out.

$ pip install eigenkit