- Introduced by
- Edward Farhi
- Year
- 2014
- Type
- Hybrid quantum-classical algorithm
- Family
- Variational Algorithm
What does it do?
The Quantum Approximate Optimization Algorithm (QAOA) is a hybrid quantum-classical algorithm for approximately solving combinatorial optimization problems.
Introduced by Farhi, Goldstone, and Gutmann in 2014, it encodes a cost function into a parameterized quantum circuit and uses a classical optimizer to tune the circuit parameters. It is a quantum algorithm rather than a machine-learning model, and it is aimed at near-term quantum devices. Its usefulness on practical problems is still being evaluated.
The intuition behind the method
QAOA prepares an equal superposition over all bitstrings and then applies two alternating layers: one derived from the cost function and one mixing layer that moves amplitude between bitstrings. Each layer has a tunable parameter. A classical optimizer adjusts these parameters so that the measured expected value of the cost improves. The number of alternating layers, p, sets how many parameter pairs are available, and the approximation quality is stated to improve as p increases. Whether this quantum process gives an advantage over classical search depends on the problem and is not settled.
History
Farhi, Goldstone, and Gutmann introduced QAOA in 2014 as a quantum algorithm for approximate combinatorial optimization, and studied it for MaxCut on regular graphs. Zhou et al. (2020) later examined performance beyond the lowest depth, developed a parameter-optimization procedure, compared QAOA with quantum annealing, and provided a resource analysis for experimental implementation.
When to use it
Choose QAOA for combinatorial optimization problems that can be written as a cost function over bitstrings, such as MaxCut and other graph-partitioning problems, and for which exact classical solution is expensive and a good approximate solution is acceptable. It is designed for the hybrid workflow of near-term quantum hardware, where circuits must stay shallow. Do not choose it when a strong classical heuristic or exact solver already solves the instances of interest, because the cited sources do not establish a general advantage over classical methods. It is also a poor fit when hardware noise is too high for the circuit depth needed to reach useful solution quality.
Limitations and considerations
- The cited performance results concern mainly MaxCut; they do not establish QAOA's behaviour on other problem classes.
- Zhou et al. report that random initialization of the parameters needs a number of optimization runs that grows exponentially with p, so the outer classical loop can dominate the total cost at larger depths.
- Gate errors and decoherence reduce solution quality on current devices, and their effect accumulates with circuit depth.
- Whether QAOA outperforms the best classical algorithms is not established. The guaranteed bound in Farhi et al. applies only to p = 1 on 3-regular MaxCut graphs.
- The parameter landscape may contain barren plateaus, which can make optimization difficult for large systems.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The circuit depth grows linearly with p (and, in the worst case, with the number of constraints), so circuit length can be controlled directly through the choice of p.
- The approximation quality is stated to improve as p increases, giving an explicit trade-off between circuit cost and solution quality.
- The gates have locality no greater than that of the objective function, so the circuit structure follows the structure of the problem.
- Zhou et al. report that QAOA can learn to use nonadiabatic operations to handle MaxCut instances where adiabatic quantum annealing struggles because of small spectral gaps.
- The cost function can be changed to encode different combinatorial problems, although the cited performance studies focus on MaxCut.
Applications
- MaxCut on graphs, the problem studied in the cited performance analyses; it is relevant to graph partitioning.
- Other combinatorial optimization problems that can be written as a cost function over bitstrings. Farhi et al. state the approach for combinatorial optimization in general, but the cited performance studies cover MaxCut only.
How it works
How it works
Prepare an equal superposition of all computational basis states by applying a Hadamard gate to every qubit.
Apply the unitary generated by the cost function (the problem Hamiltonian), for a time set by the first variational parameter of the layer.
Apply the mixing unitary, typically generated by the transverse-field (transverse Ising) Hamiltonian, for a time set by the second variational parameter of the layer.
Measure all qubits in the computational basis and evaluate the cost function on each sampled bitstring. The expected cost is estimated as the average over repeated measurements (shots). Because it is an average over the sampled distribution, the best bitstring observed can differ from the expected cost, so both should be recorded.
Use a classical optimizer, such as COBYLA, to adjust the variational parameters so that the expected cost improves. The sign convention (maximizing or minimizing the cost) must be fixed by the chosen formulation.
Common pitfalls
- Assuming QAOA will outperform classical heuristics without benchmarking against strong classical baselines on the same instances.
- Using a very shallow circuit without checking whether solution quality improves with p for the problem at hand.
- Treating the Farhi et al. bound for p = 1 on 3-regular MaxCut graphs as a general approximation guarantee.
- Ignoring the cost of classically optimizing many parameters, which grows with p.
- Choosing poor initial parameter values; Zhou et al. propose initialization strategies based on patterns in optimal parameters, and warm-starting from lower-depth solutions is a commonly used alternative.
- Ignoring noise effects, since gate errors accumulate with circuit depth.
Frequently asked questions
What is the difference between QAOA and classical simulated annealing?
Simulated annealing escapes local optima through thermal fluctuations that are controlled by a cooling schedule. QAOA instead prepares a superposition of bitstrings and tunes parameters so that the expected cost, an average over sampled bitstrings, improves. Zhou et al. report that QAOA can exploit nonadiabatic mechanisms on instances where adiabatic quantum annealing struggles. Whether this gives a practical advantage depends on the problem and on circuit depth, and the cited sources do not establish a general advantage.
How do I choose the circuit depth (p) for my problem?
The circuit depth grows linearly with p, and the approximation quality is stated to improve as p increases. In practice, begin with a small p and increase it while checking whether the solution quality improves. On noisy hardware, the gain from larger p must be weighed against the accumulation of gate errors.
Can QAOA solve problems larger than what a classical computer can handle?
Not yet in the sense of demonstrated advantage. Zhou et al. find that parameter optimization matters only for problem sizes beyond those that can be simulated numerically but are still accessible on near-term devices. They propose a feasible implementation for MaxCut instances with a few hundred vertices on 2D neutral atoms, as part of a resource analysis. This is a proposal, not an experimental demonstration, and whether such an implementation would challenge the best classical algorithms remains an open question.
How sensitive is QAOA to noise and errors?
QAOA is sensitive to gate errors and decoherence, and these effects accumulate with circuit depth. A larger p must therefore be weighed against the noise level of the target hardware. Zhou et al. include a resource analysis of experimental implementation that accounts for quantum fluctuations in measurements.
What approximation ratio can QAOA achieve?
The approximation ratio is the expected cost divided by the optimal cost. The one guaranteed value in the cited sources is from Farhi et al.: for p = 1 on 3-regular MaxCut graphs, the quantum algorithm always finds a cut at least 0.6924 times the size of the optimal cut. Ratios for other graph classes or depths should be checked against the original studies before being used.
How should I read the output of a QAOA run?
A run returns a distribution of sampled bitstrings rather than a single answer. Report three quantities: the estimated expected cost, the best bitstring observed among the samples, and the approximation ratio (the expected cost divided by the optimal cost). The expected cost is an average over samples, so the best bitstring can differ from it. Because the expected cost is estimated from a finite number of measurements, its statistical error decreases as more shots are taken. Benchmark all three against a strong classical baseline on the same instances. Zhou et al. account for quantum fluctuations in measurements in their resource analysis, which matters for any realistic estimate.
Related methods
Sources
Farhi, E., Goldstone, J., Gutmann, S. (2014). A quantum approximate optimization algorithm. arXiv preprint arXiv:1411.4028.
Open DOI referenceZhou, L., Wang, S. T., Choi, S., et al. (2020). Quantum approximate optimization algorithm: Performance, mechanism, and implementation on near-term devices. Physical Review X, 10, 021067.
Open DOI referenceHadfield, S., Wang, Z., O'Gorman, B., et al. (2019). From the Ising model to QAOA: A quantum optimization algorithm from the physicist's perspective. Algorithms, 12, 34.
Open publication reference