Optimizing QAOA for Portfolio Selection
A real-world application of the Quantum Approximate Optimization Algorithm to combinatorial finance problems
Introduction
Portfolio selection — choosing which assets to hold and in what proportions to maximize return for a given risk level — sounds like a classical optimization problem. And for small portfolios, it is. The Markowitz mean-variance framework [Markowitz, 1952] solves it exactly in polynomial time for continuous allocations.
But real institutional portfolio management adds constraints that break convexity: cardinality constraints (hold exactly of assets), integer lot sizes, transaction cost penalties, and sector exposure limits. With these constraints, portfolio optimization becomes an NP-hard combinatorial problem [Bienstock, 1996].
This makes it a natural target for quantum optimization algorithms. In this article we derive the full QAOA formulation for the cardinality-constrained portfolio problem — from financial model to quantum circuit — and assess where the approach currently stands.
1. The Portfolio Optimization Problem
1.1 Markowitz Framework
Let be the number of candidate assets. Define:
- : vector of expected returns,
- : covariance matrix of returns,
- : portfolio weight vector, ,
The mean-variance optimization problem is:
subject to , , where is a risk-aversion parameter.
This is a quadratic program — convex, solvable in polynomial time.
1.2 Cardinality-Constrained Version
Add the constraint: select exactly assets from candidates with equal weight . Introduce binary decision variables where means asset is selected.
The portfolio return and risk become:
The optimization problem:
This is an NP-hard binary quadratic program. For assets and , the search space is — already beyond brute-force enumeration.
2. QUBO Formulation
QAOA requires the problem to be expressed as a Quadratic Unconstrained Binary Optimization (QUBO) problem. We must incorporate the cardinality constraint via a penalty term.
2.1 Penalty Encoding
The constraint is enforced by adding a squared penalty:
where is a penalty coefficient chosen large enough that any feasible solution (satisfying the constraint) is better than any infeasible one. A sufficient condition: over infeasible solutions.
The full QUBO objective (to minimize) is:
Expanding the penalty:
where the QUBO matrix entries are:
2.2 Ising Hamiltonian
QAOA works with Ising spin variables rather than binary variables. The substitution converts the QUBO to an Ising model. After substitution and simplification, the problem Hamiltonian acting on qubits is:
where is the Pauli-Z operator on qubit , and the coupling and field coefficients , are functions of and (explicit expressions omitted but straightforwardly derived from the substitution).
The portfolio optimization problem is now equivalent to finding the ground state of — the eigenstate with the minimum eigenvalue.
3. The QAOA Circuit
3.1 Algorithm Overview
QAOA [Farhi, Goldstone, & Gutmann, 2014] is a variational algorithm that prepares an approximation to the ground state of using a circuit of depth (not to be confused with the number of assets ).
The QAOA circuit alternates two types of unitaries:
where:
- is the uniform superposition over all bitstrings
- is the phase separation unitary — encodes the cost function
- is the mixing unitary — enables quantum tunneling between states
3.2 Phase Separation Unitary
Since is diagonal in the computational basis (it’s a sum of and terms):
Each factor is implementable directly:
- : single-qubit rotation on qubit
- : two-qubit gate implemented as CNOT––CNOT sequence
For assets with all pairwise couplings, requires two-qubit gates per layer.
3.3 Mixing Unitary
The standard mixer is:
where is the Pauli-X operator on qubit . This is a product of single-qubit -rotations — single-qubit gates, no entanglement.
Note on feasibility-preserving mixers: The standard mixer does not preserve the constraint . Hadfield et al. [2019] introduced XY mixers that only mix between states with the same Hamming weight (same number of 1s), preserving the cardinality constraint and potentially improving performance:
3.4 The Optimization Loop
The QAOA parameters and are optimized classically to minimize:
This is the expected portfolio cost under the QAOA quantum state. A classical optimizer (COBYLA, Nelder-Mead, or gradient-based methods via parameter shift) minimizes over real parameters.
4. Approximation Ratio Analysis
4.1 Theoretical Guarantees
For QAOA on a specific class of 3-regular MaxCut graphs, Farhi et al. proved an approximation ratio of at least [Farhi et al., 2014]. For general problems, the approximation ratio of depth- QAOA approaches the true optimum as :
This follows from the connection between QAOA and adiabatic quantum computing: at large , the QAOA circuit approximates adiabatic evolution from to .
4.2 Portfolio-Specific Results
For the portfolio problem, the approximation ratio depends on the spectral gap of and the problem structure. In numerical simulations on small instances ( assets), QAOA with – layers achieves approximation ratios of – against exact optimization [Hodson et al., 2019, arXiv:1908.08943].
However, these are simulated results on noiseless simulators. On current hardware, noise limits effective QAOA depth to approximately for most platforms.
5. Hardware Reality Check (2025)
Let’s be honest about where things stand.
5.1 Qubit Requirements
For assets: 50 qubits needed. Current hardware has enough qubits (IBM has 127-qubit and 433-qubit processors). But qubit count is not the bottleneck.
5.2 Circuit Depth and Coherence
One QAOA layer for 50 assets requires two-qubit gates. With typical two-qubit gate fidelity of on IBM hardware, the fidelity of 2500 sequential gates is approximately:
The circuit is essentially decoherent before completing a single layer. This is the fundamental barrier at present.
5.3 What Can Be Run Today
Realistically, on current hardware:
- – assets with – layers on superconducting hardware
- assets with – layers using trapped-ion hardware (higher fidelity, slower gates)
- Results are noisy and require significant error mitigation
This does not constitute a demonstration of quantum advantage over classical optimization — classical branch-and-bound solvers handle cardinality-constrained portfolio problems routinely [Beasley, 1990].
5.4 The Path Forward
Quantum advantage for portfolio optimization is plausible in the fault-tolerant era (perhaps 2030s) when deep, error-corrected QAOA circuits become feasible. The theoretical foundations are solid. The hardware is not yet there.
6. Classical Benchmarks
For context, here are the leading classical approaches and their scaling:
| Method | Instances handled | Time complexity |
|---|---|---|
| Branch-and-bound | , exact | Exponential worst-case, polynomial typical |
| Simulated annealing | Heuristic, no guarantee | |
| Genetic algorithms | Heuristic | |
| QAOA (, noisy) | gates per layer |
Any claimed quantum advantage must beat simulated annealing on the same hardware budget, which is a non-trivial bar that QAOA has not yet cleared for portfolio problems on real hardware.
Conclusion
The QAOA formulation for portfolio optimization is mathematically clean and theoretically motivated. The derivation from financial model to quantum circuit is rigorous, and the algorithm has provable convergence properties in the large- limit.
The engineering reality is that current hardware is 1–2 orders of magnitude away from running meaningful instances. The value of this work now is: (1) establishing the formulation for when hardware improves, (2) identifying algorithmic improvements like feasibility-preserving mixers, and (3) running small validation experiments to verify the approach scales as theorized.
Quantum portfolio optimization is a serious research direction. Claiming it provides a practical advantage today would be dishonest. That is where this field stands.
References
-
Farhi, E., Goldstone, J., & Gutmann, S. (2014). A quantum approximate optimization algorithm. arXiv preprint arXiv:1411.4028. https://arxiv.org/abs/1411.4028
-
Markowitz, H. (1952). Portfolio selection. The Journal of Finance, 7(1), 77–91. https://doi.org/10.1111/j.1540-6261.1952.tb01525.x
-
Bienstock, D. (1996). Computational study of a family of mixed-integer quadratic programming problems. Mathematical Programming, 74(2), 121–140. https://doi.org/10.1007/BF02592208
-
Hadfield, S., Wang, Z., O’Gorman, B., Rieffel, E. G., Venturelli, D., & Biswas, R. (2019). From the quantum approximate optimization algorithm to a quantum alternating operator ansatz. Algorithms, 12(2), 34. https://doi.org/10.3390/a12020034
-
Hodson, M., Ruck, B., Ong, H., Garvin, D., & Dulman, S. (2019). Portfolio rebalancing experiments using the quantum alternating operator ansatz. arXiv preprint arXiv:1911.05296. https://arxiv.org/abs/1911.05296
-
Egger, D. J., Marecek, J., & Woerner, S. (2021). Warm-starting quantum optimization. Quantum, 5, 479. https://doi.org/10.22331/q-2021-06-17-479
-
Beasley, J. E. (1990). OR-Library: distributing test problems by electronic mail. Journal of the Operational Research Society, 41(11), 1069–1072. https://doi.org/10.1057/jors.1990.166
Rashan is a Data Science Professional and Quantum AI Researcher, and the Founder & CEO of Intellit — an AI automation agency building intelligent systems across fintech, banking, and enterprise sectors.
The Quantum Intelligence Digest
Join researchers and engineers who read Quaniq.