PennyLane Quantum Machine Learning Demos
Xanadu / Community
QAOA is a hybrid quantum-classical algorithm designed to find approximate solutions to combinatorial optimization problems. It runs a parameterized quantum circuit on NISQ hardware and uses a classical optimizer to tune the parameters, targeting problems like MaxCut, portfolio optimization, and scheduling that are hard for classical solvers at large scale.
QAOA was introduced by Farhi, Goldstone, and Gutmann in 2014 as an algorithm for combinatorial optimization on near-term quantum hardware. The core idea is to encode an optimization problem as a cost Hamiltonian -- a quantum operator whose ground state (lowest-energy state) corresponds to the optimal solution -- and then use a parameterized quantum circuit to prepare an approximate ground state.
The algorithm is hybrid: the quantum computer prepares states and measures energies, while a classical optimizer tunes the circuit parameters to minimize the measured cost. This hybrid structure keeps the quantum circuits shallow enough to run on NISQ devices, at the cost of being approximate rather than exact.
QAOA has a structured circuit architecture defined by a depth parameter p. Higher p means more circuit layers and a better approximation -- at the cost of deeper, noisier circuits.
The optimization problem is mapped to a cost Hamiltonian H_C whose lowest-energy state encodes the optimal solution. For MaxCut, this means assigning qubits to graph vertices and using ZZ interactions to represent the cut objective. The mapping is usually done via a QUBO (Quadratic Unconstrained Binary Optimization) formulation.
All qubits are initialized in equal superposition using Hadamard gates. This state has equal probability of every possible assignment, giving QAOA a quantum starting point that explores the full solution space simultaneously.
The QAOA circuit applies p rounds of two unitary operators: the cost unitary U(H_C, gamma) encodes the problem structure, and the mixer unitary U(H_B, beta) mixes the quantum state to explore the solution landscape. Each round has two tunable parameters (gamma and beta), giving 2p parameters total.
The quantum circuit is run and the expected value of the cost Hamiltonian is measured. A classical optimizer (COBYLA, SPSA, Nelder-Mead) updates the gamma and beta parameters to reduce the measured cost. This loop repeats until convergence. The final circuit parameters produce a quantum state that, when measured, yields a near-optimal solution with high probability.
Any combinatorial optimization problem that can be expressed as a QUBO can be tackled with QAOA.
The canonical benchmark for QAOA. Given a graph, partition the vertices into two sets to maximize the number of edges crossing between them. This is NP-hard in general. QAOA can achieve a 0.6924 approximation ratio at p=1, matching classical algorithms for certain graph families.
Choosing the optimal subset of assets to maximize expected return subject to risk constraints is a quadratic binary optimization problem. QAOA maps each asset to a qubit (hold or don't hold) and optimizes over the portfolio. See quantum finance courses for more.
Job shop scheduling, vehicle routing, and network flow problems can be formulated as QUBOs and attacked with QAOA. These problems appear in logistics, manufacturing, and telecommunications, making them commercially relevant targets.
Boolean satisfiability problems -- finding assignments of variables that satisfy a conjunction of clauses -- map naturally to QAOA's cost Hamiltonian framework. 3-SAT is NP-complete and a common benchmark for testing whether QAOA can provide advantage over classical solvers.
It is important to be honest about where QAOA stands today. For most combinatorial optimization problems on current NISQ hardware, classical algorithms like simulated annealing, branch-and-bound, or semidefinite programming relaxations outperform QAOA implementations. The noise in current hardware limits p to small values (typically 1-3), which constrains approximation quality.
Theoretical results show QAOA performance improving with larger p, and some complexity-theoretic arguments suggest QAOA may eventually provide advantage for specific problem classes on fault-tolerant hardware. The honest current assessment: QAOA is a compelling research direction and an important algorithm to understand, but demonstrated quantum advantage over state-of-the-art classical optimization has not been achieved for practically relevant problem sizes.
Quantum computing courses that include QAOA in their curriculum, sorted by rating.
Xanadu / Community
Prof. Elias Fernandez-Combarro Alvarez, University of Oviedo
Hasso Plattner Institute / IBM Quantum
D-Wave
Hands-on implementations in Qiskit and PennyLane, from MaxCut to portfolio optimization.