Computing is an essential tool for the modern financial services industry. Profits are won and lost based on the speed and accuracy of algorithms guiding financial decision making.
Accelerated quantum computing has the potential to impact the financial services industry with new algorithms able to speed-up or enhance existing tools, such as portfolio optimization techniques. This blog post explores a new technique developed by NVIDIA partner Infleqtion, a global quantum technology company, which uses the NVIDIA CUDA-Q platform to build a hybrid quantum-classical algorithm for portfolio optimization.
Creating the perfect portfolio
The goal of portfolio optimization is straightforward: Select a portfolio of stocks that maximizes the returns for an investor, while minimizing the volatility (risk) that they are exposed to (Figure 1).

One of the keys to finding an optimal portfolio is making sure it is diversified, meaning that it includes a broad range of stocks that are more robust to changing market conditions.
The Sharpe ratio quantifies the return given the level of risk, with high ratios equating to better portfolios. A Sharpe ratio can be calculated for an individual stock too. It can exclude information about covariances between stocks — which is the primary source of risk in a portfolio as accounted for in the objective formula shown in Figure 1. Searching a large number of potential portfolios for ones with high Sharpe ratios is where quantum computing could be a powerful tool.
In discrete portfolio optimization, a portfolio is constructed as an equal weighting of M stocks selected from N possible stocks. The number of possible portfolios grows combinatorially large as M and N increase.
With a modest problem size of M=25 and N=50, there are over 126 trillion potential portfolios. This means that an exhaustive search through all the possible combinations quickly becomes unmanageable for any conventional algorithm. Quantum algorithms offer a potential speed-up.
Another major challenge for portfolio optimization is ensuring models trained using historical data with known returns can select portfolios that’ll perform equally well in the future. Infleqtion is developing and testing new quantum algorithms that could, when run on future quantum hardware, produce more prescient portfolios by drawing from a larger possible number of potential combinations.
Generating a quantum portfolio
For a quantum computer to help optimize a portfolio, the problem first needs to be reformulated as a Quadratic Unconstrained Binary Optimization (QUBO). Once a problem is formulated as a QUBO, it is well understood how it can be run efficiently on a quantum computer. In this case, by mapping each of the N stocks to an optimization variable (zi) corresponding to the ith qubit.

Boosting optimal portfolios with Q-CHOP
One quantum algorithm well-suited for this task is the Quantum Constrained Hamiltonian Optimization algorithm, commonly known as Q-CHOP. Developed by Infleqtion and JPMorganChase, Q-CHOP is a special case of the more general quantum adiabatic evolution algorithm, which finds the ground states of Hamiltonians.
The trick is to prepare a set of qubits in the ground state of an easy-to-solve Hamiltonian (Hinit) and then slowly evolve the Hamiltonian into (Hobj) which encodes the portfolio optimization problem.
The clever part of adiabatic evolution algorithms is that by making these changes slowly enough, the qubits will stay in the ground state throughout the evolution and thus end up in the ground state of Hobj, corresponding to the solution to the optimization problem. For constrained optimization problems often found in portfolio optimization, this procedure can be modified to enforce said constraints by introducing a constraint Hamiltonian (Hcon). In this case, the constraint term ensures the output portfolio includes a requested number of stocks M.

For some problems, while difficult to find the best solution, it’s actually easy to find the worst solution. Q-CHOP is great for such problems as it sets its initial Hamiltonian Hinit to be the inverse of the problem Hamiltonian: –Hobj. Q-CHOP then “flips” –Hobj back into Hobj while staying within the constrained subspace (i.e. only considering the correct number of stocks). This subtle difference improves the performance of the evolution and allows the procedure to converge to an optimal portfolio much faster.The constraint term for the Q-CHOP approach is also slightly modified such that the procedure finds the best portfolio of size M or M+1, allowing Q-CHOP’s evolution to search the subspace of feasible solutions.
Astute readers might note that for our portfolio optimization problem, it’s just as hard to produce the worst solution as it’s the optimal solution. To circumvent this, one can execute an initial modified Q-CHOP run in which one starts in any feasible state (whose energy we denote Einit) and evolves under a modified objective Hamiltonian (Hobj – Einit)2, ending in either the best or worst state. In the former case, the problem is solved; in the latter, the worst state is used as the initial state for a second Q-CHOP evolution which then evolves to the best state.

It turns out that this two-Q-CHOP evolution approach is still faster and more reliable than the standard adiabatic evolution (Figure 4). Given preliminary evidence that the two-Q-CHOP evolution approach works for large portfolio optimization (N=15 with 98% optimality), the financial benchmarking in the following section initializes the Q-CHOP algorithm by starting in the worst-feasible state for each run, thereby allowing Q-CHOP optimization of a much larger number of portfolio instances.
Evolving Q-CHOP on with CUDA-Q
Testing whether the Q-CHOP algorithm can deliver on its promise for discrete portfolio optimization means simulating its results on problem sizes larger than what can be run on today’s quantum hardware. To reach the scales needed in their simulations, the team at Infleqtion used CUDA-Q, NVIDIA’s platform for accelerated quantum supercomputing.
Specifically, the team utilized CUDA-Q’s `evolve` function from its new dynamics feature set. This function simulates time evolution under Q-CHOP via numerical integration on multiple GPUs. Using the `evolve` function avoided a major time bottleneck and accelerated simulations by up to 42x over Infleqtion’s previous CPU implementation (Figure 5) for an 18 qubit case using an NVIDIA RTX 6000 Ada GPU.

To test financial performance, Infleqtion used CUDA-Q to simulate Q-CHOP’s construction of a portfolio of 7 to 8 stocks from a possible 15 top performers in the S&P 500. 15-qubit Q-CHOP simulations were performed 56 times, each corresponding to a new portfolio built every quarter over a 14 year timeframe beginning in 2010.
The financial inputs necessary to setup the optimization problem (returns, volatilities, and covariances) were obtained using S&P 500 data for the five years preceding each of the 56 time points.The finance mantra “past performance does not guarantee future results” applies, but for this analysis, historical price data is the best source of information.The n=15 candidate stocks for each Q-CHOP run were selected by taking the S&P 500 stocks with the top 15 individual Sharpe ratios at that time period. Q-CHOP then factors in covariances between stocks and seeks to identify the 7 stock combination which has the highest Sharpe ratio.

Annualized over all 56 portfolio constructions, Q-CHOP produces a portfolio with a Sharpe ratio of 0.99 (Figure 6). This is an improvement over the ratio of 0.88 that results from equally weighting the top 7 individual Sharpe ratio stocks. This demonstrates that Q-CHOP is able to find improved portfolios because the algorithm has more to select from and accounts for covariances among the n=15 candidate stocks.
On average, sampling the final state of all 56 Q-CHOP runs on average just 70 times allowed a portfolio within 99.5% of the optimal solution to be found. This means 3 orders of magnitude fewer samples were required to search the 12,870 possible portfolios composed of 7 or 8 stocks compared to random sampling.
The Q-CHOP results obtained using CUDA-Q for this 15 qubit case paint an optimistic picture for future runs of Q-CHOP on physical QPUs. The fact that Q-CHOP is able to improve portfolio quality and do so with such high sampling efficiency suggests it could be applied to other financial applications beyond the traditional ones considered here – such as direct indexing.
Get started with CUDA-Q
NVIDIA is building a suite of tools to accelerate both financial simulation and quantum computing. You can download the CUDA-Q platform today to start developing hybrid quantum-classical applications and run them on Infleqtion’s QPU. To learn more about NVIDIA Quantum and how you can request NVIDIA Quantum Cloud access, visit the NVIDIA Quantum webpage.