Measuring and Decoding Solutions
At the end of a QAOA circuit the quantum state is a superposition of many bitstrings, each with some amplitude. Measurement in the computational basis collapses the state to a single bitstring, and the probability of obtaining bitstring is by the Born rule. Repeating the circuit many times and collecting all outcomes yields a probability distribution over candidate solutions; the most frequent bitstrings are the best candidates.
What a measurement outcome means
Every bitstring read off a QAOA circuit corresponds to a concrete assignment of the original combinatorial variables. For a Max-Cut problem on vertices, a bitstring assigns vertex to partition 0 if and to partition 1 if . An edge is cut whenever , so the cost value for outcome is immediately computable without any further quantum processing.
This is a key structural feature of QAOA: because the cost Hamiltonian is diagonal in the computational basis, its eigenvalues are exactly the cost values of the corresponding bitstrings. Measuring in the computational basis therefore reads out cost values directly, with no additional basis rotation.
Decoding the best solution
In practice the procedure is:
- Run the QAOA circuit with fixed angles a large number of times (shots).
- Record every bitstring and its count.
- Evaluate the cost function classically for each observed bitstring.
- Return the bitstring with the highest cost as the candidate solution.
Step 3 is entirely classical and cheap: for Max-Cut, evaluating for a bitstring of length takes time on a classical computer.
Why optimal solutions peak in probability
When the variational angles are well-chosen, QAOA constructively interferes the amplitudes of high-quality solutions and destructively interferes those of low-quality ones. For a -layer QAOA circuit on an -qubit system the state after the final layer is
The probability of the optimal solution grows with the number of layers : Farhi, Goldstone and Gutmann (2014) showed that as the distribution concentrates on optimal solutions. Even at small the most probable outcomes are typically near-optimal, so measuring a modest number of shots already reveals good candidate solutions.
The 2-node Max-Cut example
For the single-edge graph on vertices , the two optimal cuts are the bitstrings and : each puts the two vertices in different partitions and achieves cost 1. A well-tuned QAOA circuit converges to equal probability on both. The state is
which is maximally entangled across the two vertices. Measuring this state yields or each with probability , and both bitstrings represent the maximum cut.
Try it
Build a 2-qubit circuit that ends with equal probability on the Max-Cut solutions and , then measure. The grader checks the output distribution.
After pressing Run you should see two equal-height bars at bitstrings 01 and 10. Both
bitstrings cut the single edge — they differ only in which vertex is labelled 0 vs 1 in
each partition, so they represent the same cut up to a global relabelling.
Sign in on the full site to ask questions and join the discussion.