Level 5 · Advanced Topics

QAOA: The Quantum Approximate Optimization Algorithm, Explained with Max-Cut

About 5,073 words · roughly 23 minute read · sources checked December 2, 2026

Many real problems ask for the best choice among an enormous number of possibilities: the best route, the best schedule, the best way to split a network. These are optimisation problems, and most of the interesting ones are hard for classical computers to solve exactly. The Quantum Approximate Optimization Algorithm, QAOA, is a method for trying to find good, not necessarily perfect, answers on a quantum computer.

It was introduced by Edward Farhi, Jeffrey Goldstone and Sam Gutmann in 2014. The arXiv abstract I opened describes an algorithm with an integer parameter p, where the quality of the approximation improves as p grows, and where the circuit depth grows linearly with p. It also reports that for the Max-Cut problem on graphs where every vertex has three neighbours, the p = 1 version guarantees a cut of at least 0.6924 times the best possible.

This lesson works with Max-Cut throughout, because it is simple enough to simulate completely. I ran QAOA on six small graphs on my own simulator, with p = 1, 2 and 3, and the results are in the tables. The circuits are tiny, from 3 to 6 qubits, so these experiments teach how the algorithm behaves, not whether it beats classical methods at scale. That question is open.

As in the other lessons, the Qiskit code is not run, because Qiskit was not installed. The numbers come from my own NumPy simulation of the same gates.

What you will learn

  • What the Max-Cut problem is and how to turn it into a cost function on qubits.
  • How a QAOA circuit alternates a cost layer and a mixer layer.
  • What the angles γ and β do, and how the sign convention affects the Qiskit code.
  • How the approximation ratio changes as the depth p grows, for six graphs.
  • How often the circuit actually samples a best-possible cut.
  • Why QAOA is a hybrid algorithm and what limits it.

Helpful first: The Variational Quantum Eigensolver (VQE), Quantum Gates.

The problem: Max-Cut

A graph is a set of dots, called vertices, joined by lines, called edges. A cut splits the vertices into two groups. An edge is cut if its two ends land in different groups. Max-Cut asks: how should you assign each vertex to group 0 or group 1 so that as many edges as possible are cut?

Max-Cut is a clean example because the answer is easy to check but hard to find. For n vertices there are 2ⁿ ways to assign groups, and no known classical method finds the best cut quickly in all cases. It also models real tasks, such as dividing a network into two parts with as much traffic crossing as possible.

Worked example

A triangle

  1. Take three vertices joined in a triangle, so there are three edges. Put vertices A and B in group 0 and C in group 1.
  2. The edge A–B has both ends in group 0, so it is not cut. The edges A–C and B–C cross between groups, so both are cut. The cut value is 2.
  3. No assignment can cut all three edges, because a triangle has an odd cycle. So the best cut is 2. A random assignment cuts, on average, half of the edges, which is 1.5.

Turning it into qubits

Give each vertex one qubit. The value 0 or 1 of the qubit says which group the vertex is in. The cut value of a bit string z is the number of edges whose two bits differ. Using the Pauli Z operator, whose eigenvalue is +1 for bit 0 and −1 for bit 1, an edge between vertices i and j contributes ½(1 − Z_i Z_j): it is 1 when the bits differ and 0 when they match.

C  =  Σ over edges (i,j)  of  ½ · ( 1 − Z_i Z_j )
The Max-Cut cost operator. Its eigenvalue on a bit string is the number of cut edges. The goal is to find a string with the largest eigenvalue.

Notice that, unlike in VQE where we minimised an energy, here we want to maximise C. The algorithm is the same either way; you just flip a sign.

The QAOA circuit

QAOA prepares a state in four kinds of steps, repeated p times.

  1. Start with every qubit in |+⟩ by applying a Hadamard to each. This is an equal superposition of all 2ⁿ bit strings, so every cut is equally likely at the start.
  2. Cost layer: apply e^(−iγC). This gives each bit string a phase that depends on its cut value. Strings with different cut values get different phases.
  3. Mixer layer: apply e^(−iβΣXᵢ), which is a rotation RX(2β) on every qubit. This mixes amplitude between neighbouring bit strings so the phases turn into changes in probability.
  4. Repeat steps 2 and 3 for p rounds, each with its own pair of angles (γₖ, βₖ).
  5. Measure all qubits. Each shot gives one bit string, and you compute its cut value classically.

The circuit has 2p angles in total. A classical optimiser tunes them to make the average cut value as large as possible. This is the same hybrid loop as VQE: quantum computer evaluates, classical computer adjusts.

An intuition

The cost layer marks good answers with a phase, and the mixer converts phase differences into probability differences. Chosen well, the angles make the good bit strings more likely. At p = 0 you have a uniform random guess. Each further round gives the optimiser more freedom.

Gates for one edge

The cost layer for one edge is a two-qubit rotation about ZZ. Up to a global phase it is e^(iγ/2 · Z_iZ_j). In Qiskit, the RZZ(θ) gate equals e^(−iθ/2 · ZZ). So to implement the cost layer for C = Σ½(1 − ZZ), you must call RZZ with θ = −γ. I hit this sign issue in my own simulation, and I note it because getting the sign backwards makes the circuit minimise the cut instead of maximising it.

from qiskit import QuantumCircuit

def qaoa_layer(qc, edges, gamma, beta, n):
    for (i, j) in edges:
        qc.rzz(-gamma, i, j)      # cost layer, sign matters
    for q in range(n):
        qc.rx(2 * beta, q)        # mixer layer
One QAOA layer in Qiskit, not run here. The minus sign on gamma follows from RZZ(θ) = exp(−iθ/2 · ZZ) and the cost C = Σ ½(1 − ZZ).

The smallest possible example: one edge, by hand

To see why the circuit works, shrink the problem to a graph with two vertices joined by a single edge. The best cut is 1: put the vertices in different groups. There are four bit strings, 00, 01, 10 and 11. The strings 01 and 10 cut the edge, so their cut value is 1. The strings 00 and 11 have cut value 0.

After the Hadamards, each of the four strings has amplitude ½. The cost layer multiplies each amplitude by e^(−iγ·cut). With γ = π/2, the strings 00 and 11 keep their amplitude, and the strings 01 and 10 are multiplied by e^(−iπ/2) = −i. The probabilities are still all 0.25, because phases alone change no probabilities. This is why a mixer is needed.

Now apply the mixer with β = π/8. In my simulation this makes the probabilities of 00 and 11 exactly 0, and the probabilities of 01 and 10 exactly 0.5 each. Every shot is then a best cut. The average cut value is 1.0.

γβAverage cut valueReading
000.5No layers do anything useful; this is random guessing.
π/2 (1.5708)π/8 (0.3927)1.0Every shot is a best cut.
π/2 (1.5708)π/4 (0.7854)0.5Too much mixing undoes the effect; back to random.

A single edge at p = 1, from my exact simulation. The mixer strength matters as much as the cost phase.

The last row is a useful warning. With β = π/4 the mixer rotates too far, and the benefit of the phase pattern is lost. The angles are tuned together; neither alone does the job.

A slightly bigger case: a path of three vertices

Three vertices in a line (edges 0–1 and 1–2) have a best cut of 2: put the middle vertex alone. At p = 1 my optimiser reached an average cut of 1.64952, a ratio of 0.8248. At p = 2 it reached 2.0, a ratio of 1.0. The triangle, which has no such neat structure, reaches its best value of 2.0 at p = 1, as the main table shows. Graph shape changes how much depth is needed.

How big are these circuits?

Count the gates. Each layer has one RZZ gate per edge and one RX gate per vertex. The start adds one Hadamard per vertex. So a depth-p circuit on n vertices and m edges has n Hadamards, p·m RZZ gates and p·n RX gates. Each RZZ is usually compiled into two CNOT gates and a Z rotation, though the exact compilation depends on the device, and I did not check any specific one.

GraphnmGates per layer (m + n)Gates at p = 1Gates at p = 3
Triangle336921
4-cycle4481228
K446101434
5-cycle55101535
K3,369152151
Prism69152151

Gate counts before compilation, counting each RZZ as one gate. Gates at depth p equal n + p(m + n).

These circuits are tiny. Real problems of interest have hundreds or thousands of vertices and many more edges, and on hardware where qubits are not all connected to each other, extra swap gates are needed to bring distant qubits together. That makes the compiled circuits longer, and I have not measured how much longer.

Why brute force is fine here and not later

Vertices nBit strings 2ⁿ
664
201,048,576
301,073,741,824
401,099,511,627,776
501,125,899,906,842,624

Number of possible assignments. Checking all of them is trivial at six vertices and stops being practical somewhere past forty or so, which is why people look for cleverer methods, classical and quantum.

The size of this table is the motivation for the whole subject. It is not evidence that quantum methods do better. Smart classical algorithms do not check every string, and the honest status is that the comparison on large instances is still being worked out.

Results on six graphs

I simulated QAOA exactly on six small graphs, using the convention above, and optimised the angles with many starting points for p = 1, 2 and 3. The approximation ratio is the average cut value divided by the best possible cut. A ratio of 1.0 means the average sampled cut is the best cut.

GraphVerticesEdgesBest cutRandom averagep = 1p = 2p = 3
Triangle3321.52.0 (ratio 1.0)2.0 (1.0)2.0 (1.0)
4-cycle4442.03.0 (0.75)4.0 (1.0)4.0 (1.0)
K4 (complete, 4 vertices)4643.03.69752 (0.92438)4.0 (1.0)4.0 (1.0)
5-cycle5542.53.75 (0.9375)4.0 (1.0)4.0 (1.0)
K3,3 (3-regular)6994.56.23205 (0.69245)8.01976 (0.89108)8.85786 (0.98421)
Prism (3-regular)6974.55.93922 (0.84846)6.60295 (0.94328)6.87802 (0.98257)

Average cut value and approximation ratio from my exact simulation, with optimised angles. The triangle reaches its best cut value of 2 already at p = 1 because every cut of a triangle that is not all-in-one-group cuts exactly two edges.

Several things stand out. The ratio never gets worse as p increases. The small, symmetric graphs reach a ratio of 1.0 at p = 2. The larger 3-regular graphs, where every vertex has three neighbours, improve more slowly: K3,3 goes from 0.692 to 0.891 to 0.984 as p goes from 1 to 3.

The K3,3 value of 0.69245 at p = 1 is consistent with the 0.6924 guarantee for 3-regular graphs stated in the abstract of the original paper. That agreement is reassuring but is not a proof, and it comes from a single graph.

Angles for the best p = 1 cases

  • 4-cycle: γ = 0.7854 (π/4) and β = 0.3927 (π/8) give an average cut of 3.0.
  • K4: γ = 0.4915 and β = 1.8533 give 3.69752.
  • 5-cycle: γ = 3.927 and β = 0.3927 give 3.75.

These angles are not unique, since the cost and mixer layers are periodic in the angles and there are symmetries. Different optimiser runs can report different but equivalent values.

A flat landscape and a grid search

For the 4-cycle at p = 1 I also scanned a grid of (γ, β) values. The average cut was 2.0, the same as random guessing, over most of the grid. The best grid points reached 2.75 and the lowest were 1.25. The true optimum of 3.0 lies between grid points. The lesson is that a coarse scan can miss the good region, and that bad angles can do worse than random.

Experiment: a ring of vertices, p = 1, 2 and 3

A ring is the simplest graph where QAOA has something to do. For an even number of vertices the best cut takes every edge (alternate the groups around the ring), so the best value equals the number of edges. I ran an exact statevector simulation for rings of 4, 6, 8 and 10 vertices at p = 1, 2 and 3. For each p I optimised the angles with the Nelder–Mead method from 6 random starts and kept the best result. All numbers are from my own NumPy simulation.

Ring size npAverage cutRatio to bestProbability of an optimal string
614.50000.75000.2852
625.00000.83330.5364
636.00001.00001.0000
816.00000.75000.1486
826.66670.83330.3608
837.00000.87500.5381
1017.50000.75000.0775
1028.33330.83330.2344
1038.75000.87500.4027

QAOA on rings. Ratio = average cut divided by the best cut. My own simulation, best of 6 starts.

A clear pattern appears. For rings of 8 and 10 vertices the ratio is 0.75 at p = 1, 0.8333 at p = 2 and 0.875 at p = 3. These equal 3/4, 5/6 and 7/8, which fit the formula (2p + 1)/(2p + 2). I recall a result of this form being known for the ring from the original QAOA literature, but I did not open a source to confirm it, so I call it a pattern in my numbers. It says that each extra layer closes about half of the remaining gap, and that the ratio approaches 1 only slowly as p grows. The 6-vertex ring is small enough that three layers reach the exact optimum.

The last column is the more striking one. For the 10-vertex ring only 2 of the 1,024 bit strings are optimal, so a random guess finds one with probability 0.00195. QAOA at p = 1 raises that to 0.0775, which is about 40 times higher, and at p = 3 to 0.4027, about 200 times higher. The circuit concentrates probability on good strings, even when its average cut is still below the optimum.

What the ring teaches

Depth buys quality. Each increase in p gives better answers, at the price of more gates. The next sections count that price.

Experiment: a cube and the Petersen graph

Rings are special. To test a less regular case I used two classic three-regular graphs: the cube, with 8 vertices and 12 edges, and the Petersen graph, with 10 vertices and 15 edges. The cube is bipartite, so its best cut is 12 (every edge). The Petersen graph contains odd cycles, and its best cut is 12 of 15 edges, which I confirmed by brute force over all 1,024 assignments. The same optimisation procedure was used.

GraphpAverage cutRatio to bestProbability of an optimal stringShots for 99% confidence
Cube (best 12)18.30940.69250.186323
Cube29.69530.80790.52077
Cube310.71320.89280.74594
Petersen (best 12)110.38680.86560.168226
Petersen211.10530.92540.44908
Petersen311.64890.97070.76264

QAOA on two three-regular graphs, my own simulation. The shots column is the number of shots needed to see an optimal string at least once with 99% probability, computed from ln(0.01)/ln(1 − P), rounded up.

The ratios rise steadily with p. On the Petersen graph, three layers reach an average cut of 11.65 out of 12 and find an optimal string with probability 0.76 in a single shot. The random-guess average for the Petersen graph is 7.5, so QAOA at p = 1 already lifts the average cut from 62.5% of the best to 86.6%.

The honest comparison: brute force and random sampling

There is a catch, and it matters. These graphs are tiny. A computer can try all 1,024 assignments of the Petersen graph in a fraction of a millisecond. Even a plain random sampler, with 10 optimal strings among 1,024, finds one with 99% probability after about 469 random draws, and the cube (2 optimal strings among 256) needs about 587. QAOA needs about 4 to 26 shots for the same confidence, but each shot costs a full circuit run. For problems this small, the classical method wins on time. The experiment shows the mechanism of QAOA, not an advantage.

The question of real interest is whether QAOA gives an edge on graphs of hundreds or thousands of vertices, where brute force is impossible and strong classical heuristics, such as the Goemans–Williamson approximation algorithm (known to guarantee roughly 0.878 of the optimum, a figure I recall from the literature and did not open a source for here), compete. At that scale no simulation of mine can say, and the evidence from hardware so far is limited.

What the circuit costs on a real device

Each cost layer applies one two-qubit RZZ rotation per edge, and each RZZ is typically compiled into two CNOT gates plus a single-qubit rotation. A mixer layer applies one single-qubit rotation per vertex. For the Petersen graph, with 15 edges, that gives the following counts.

pRZZ gates (15 per layer)CNOT gates (2 per RZZ)Chance of no two-qubit error at 0.5% per CNOT
115300.860
230600.740
345900.637

Two-qubit gate counts for QAOA on the Petersen graph, before any routing overhead. The last column is 0.995 raised to the number of CNOTs, my own arithmetic with an illustrative error rate.

At p = 3 the circuit has 90 CNOT gates, and about 36% of runs would contain at least one two-qubit error even before readout errors and connectivity. Real devices rarely have every pair of qubits connected, and the Petersen graph is far from a line, so swap gates would add more. The deeper circuit that gives the better ideal answer is also the one most damaged by noise. On a noisy device the best p is therefore often small. This tension is the central practical difficulty of QAOA, and I observed its idealised side in the tables above.

A rough budget

  • If the target needs ratio 0.97, the experiments suggest p = 3 on the Petersen graph.
  • With 90 CNOTs at 0.5% error, only 64% of the shots are error-free, so the observed probability of an optimal string is lower than the ideal 0.76. A rough guess is that it falls by a similar factor, though I did not simulate noise for this graph.
  • Hardware with better two-qubit gates (0.1% error) would give 0.999⁹⁰ = 0.914, a large improvement.

This is the same trade-off as in the Grover noise study: the answer improves with depth in theory and worsens with depth in practice, and the sweet spot depends on the error rate.

Finding the angles is itself a hard problem

All of my results depended on an optimiser that found good angles. For p = 1 with two angles, a grid search is enough, and the energy landscape is smooth. For p = 3 there are six angles, and the landscape has many local maxima. I used 6 random starts per case, and the best start did not always agree with the others, so some of my numbers could be improved with more starts. This is a general feature, which I describe from general knowledge and not from a source opened here: the optimisation can be the bottleneck.

Each evaluation of the cost on a real device needs many shots, because the average cut is estimated from samples. If one average needs 1,000 shots and the optimiser needs 500 evaluations, that is half a million shots for one set of angles. The shot arithmetic from the VQE lesson applies directly: precision costs shots, and the optimisation multiplies that cost.

Warm starts

A common practical trick is to reuse good angles from a smaller or similar problem as the starting point for a bigger one. Studies have reported that good angles for regular graphs of the same degree transfer between sizes. I mention this as something reported in the literature that I did not verify in this session. It matters because it can cut the number of optimiser evaluations a great deal.

Reading a QAOA paper

Ask: how many random starts, how many shots per evaluation, and was the final number the best of many runs? A single lucky run can look better than the typical case.

Run the one-edge QAOA in your browser

The widget below is the one-edge example from earlier, built from the gates in the circuit section: Hadamards, a cost layer made of CX, RZ(−γ) and CX, and a mixer RX(2β) on each qubit. Predict which strings appear and how often, then run it. The strings follow Qiskit's bit order, with qubit 0 on the right.

Run this circuit

One QAOA layer on a single edge (γ = π/2, β = π/8)

q0q1HHRZ-1.57RX0.79RX0.79

Bit order: q0 is the rightmost digit of each result, as in Qiskit. All qubits start in |0⟩ unless marked. This is an ideal simulator with no hardware noise.

Predict first: Two vertices joined by one edge. The best cuts are 01 and 10 (the two ends in different groups). After H on both, a cost layer built from CX, RZ(−γ) and CX with γ = π/2, and a mixer RX(2β) = RX(π/4) on each qubit, which strings do you expect, and how likely is each?

Press Run to simulate. Results appear here with a short explanation.

Now compare with the table of the one-edge case: at γ = π/2 and β = π/8 every shot is a best cut. If you could change β to π/4, the mixer would rotate too far and the strings would return to equal probability. Changing the numbers is a good exercise: try to predict the result with your own formula before you test it in code on your computer.

Beyond Max-Cut: other problems QAOA is applied to

Max-Cut is the standard example because its cost operator is simple. The same recipe applies to any problem that can be written as minimising or maximising a sum of products of binary variables, often called a QUBO problem (quadratic unconstrained binary optimisation). I describe the following from general knowledge of the field, and I did not open sources for the specific applications.

  • Scheduling and assignment: decide which job goes to which machine, with a penalty when two jobs conflict.
  • Portfolio selection: choose a subset of assets that balances return and risk, with binary variables for 'hold' or 'not hold'.
  • Graph partitioning and clustering: split a network into balanced groups with few connections between them.
  • Constraint satisfaction: encode a rule as a penalty term, so that violations raise the cost.

In each case the work is in the encoding. Constraints that must hold exactly become penalty terms with weights that have to be tuned, and a poor weight makes the landscape harder. A problem with n binary variables needs n qubits, so the sizes that fit on current hardware are small compared with industrial instances.

What to ask about any claimed QAOA result

  1. How large is the instance, in variables and edges, and is it small enough to solve exactly by brute force?
  2. What depth p was used, and what was the two-qubit gate count after compilation?
  3. What classical solver was the comparison, and what time and quality did it get?
  4. Is the reported number the best of many runs or the typical value?
  5. Does the improvement come from the quantum part, or from the classical optimiser and post-processing?

The last question deserves attention. Several published demonstrations apply a classical clean-up step after sampling, such as flipping single vertices when that improves the cut. If the clean-up does most of the work, the quantum circuit may not be what is helping. A fair test removes the quantum part and checks that the result gets worse.

Average cut versus the chance of the best cut

The approximation ratio uses the average over many shots. Often you care about something stricter: how likely is a single shot to be a best-possible cut? Because you can run many shots and keep the best one, even a modest probability can be enough.

GraphUniform randomp = 1p = 2p = 3
4-cycle0.1250.53121.01.0
K3,30.03120.33420.76140.9064
Prism0.09380.40080.72090.9233

Probability that one measurement gives a maximum cut, from my simulation. The 4-cycle has two best cuts out of 16 strings, so uniform guessing gives 0.125.

For K3,3 the chance of a best cut rises from 3% by blind guessing to 33% at p = 1 and 91% at p = 3. With 33% per shot, ten shots find a best cut with probability 1 − 0.67¹⁰ ≈ 98%. So even a shallow circuit can solve these tiny instances in practice.

An important caution

These are 3 to 6 vertex graphs. A classical computer solves them instantly by checking all 2ⁿ options, and there are only 64 options for six vertices. Nothing here suggests QAOA wins on large graphs. It shows the behaviour of the method.

Why not just use a bigger p?

Each extra layer adds gates. The abstract of the original paper says circuit depth grows linearly with p. On noisy hardware, deeper circuits accumulate more errors, and Preskill’s 2018 paper, whose abstract I opened, says noise limits the size of circuits on near-term devices. There is also the optimisation problem: with 2p angles, finding good values gets harder, and the barren-plateau effects described in the VQE lesson can apply. The review by Cerezo and colleagues lists trainability, accuracy and efficiency as challenges for variational algorithms in general.

The full workflow in Qiskit terms

Putting the pieces together, a complete QAOA program has these steps. I describe the structure rather than a full listing, since I could not run Qiskit and interfaces change between versions.

  1. Describe the graph as a list of edges.
  2. Build the circuit: Hadamards on all qubits, then p repetitions of the layer function above, with symbolic or numeric angles.
  3. Define an objective: run the circuit, measure many shots, and compute the average cut value from the counts. Return the negative of it if your optimiser minimises.
  4. Give the objective to a classical optimiser such as COBYLA, starting from a few different initial angles.
  5. After optimising, sample the final circuit with many shots and report the best bit string seen, together with its cut value, which you verify classically.

Step 5 is a good habit. Because the cut value of any bit string is cheap to compute classically, you can always check the answer. The quantum part only needs to suggest good candidates.

Starting angles

A common practical question is where to start the optimiser. For p = 1 the angles can be searched on a grid, as I did. For deeper circuits, a popular idea is to reuse good angles from p − 1 as a starting guess for p. I have not tested that here, so I mention it only as something people try.

QAOA, VQE and adiabatic computing

QAOA and VQE are close cousins. Both use a circuit with adjustable angles and a classical optimiser, and both are aimed at today’s noisy machines. The difference is in the ansatz. VQE’s ansatz is chosen freely, often from the physics of the problem. QAOA’s ansatz is fixed in form: alternate the problem’s cost operator with a simple mixer.

The structure also resembles adiabatic quantum computing, covered in its own lesson on this site: there, a system is slowly steered from an easy state to one that encodes the answer. QAOA can be seen as a discrete, finite-step version of that steering, with the step sizes chosen by an optimiser instead of by a slow schedule. I describe this link as a common way of thinking about the algorithm, and I did not verify the precise statement against a source here.

FeatureVQEQAOA
Typical goalLowest energy of a HamiltonianGood solution to an optimisation problem
AnsatzChosen freelyAlternating cost and mixer layers
ParametersAs many as the ansatz has2p angles
Check the answer classically?Hard for large systemsEasy for problems like Max-Cut
Main difficultyAnsatz quality, shots, barren plateausAngle optimisation, depth vs noise

A side-by-side summary. These are general descriptions, not benchmark results.

Honest limits

  • No proven large-scale advantage. As far as I could verify from the abstracts I opened, the original paper shows guarantees for low p on specific graph families, not a general speed-up.
  • Small graphs only in my experiments. Exact simulation grows as 2ⁿ, so I stopped at six vertices.
  • Classical competition is strong. Good classical approximation algorithms for Max-Cut exist; I did not compare against them here, and I will not claim a comparison I did not run.
  • Noise limits depth, which limits p.
  • Hard optimisation. Finding good angles can be difficult, and the landscape can be flat or have many local optima.

Frequently asked questions

Does QAOA find the exact best answer?

Not guaranteed. It produces a distribution over answers, biased toward good ones. You sample it and keep the best, which you can verify.

What do γ and β mean physically?

γ sets how strongly the cost layer imprints phases. β sets how strongly the mixer spreads probability between bit strings. Their best values depend on the graph.

Why does the 4-cycle at p = 1 only reach 0.75?

One layer of cost and mixer gives limited reach. The same graph reaches ratio 1.0 at p = 2 in my simulation, and the probability of a best cut goes from 0.53 to 1.0.

Is the Max-Cut mapping the only one?

No. Many optimisation problems can be written as Ising-type cost operators of Z terms. I only worked through Max-Cut, so I cannot report results for others.

Practice questions

Check yourself

What is the best cut value of a triangle?

2. An odd cycle cannot cut all its edges.

What does a uniform random assignment cut on average in a graph with m edges?

m/2, because each edge is cut with probability 1/2. For the triangle that is 1.5.

Which Qiskit RZZ angle implements the cost layer for C = Σ½(1 − ZZ) with parameter γ?

θ = −γ, because RZZ(θ) = exp(−iθ/2 · ZZ).

How many angles does a depth-p QAOA circuit have?

2p: one γ and one β per layer.

For K3,3, what happens to the probability of sampling a best cut as p goes from 1 to 3?

It rises from 0.3342 to 0.7614 to 0.9064 in my simulation.

Summary

  • QAOA encodes an optimisation problem as a cost operator, then alternates cost and mixer layers with tunable angles.
  • Depth p gives 2p angles, and in my six-graph simulation the approximation ratio never fell as p grew.
  • For K3,3 the ratio went 0.692, 0.891, 0.984 for p = 1, 2, 3, and the chance of sampling a best cut went 0.334, 0.761, 0.906.
  • Mind the Qiskit sign: RZZ(−γ) for C = Σ½(1 − ZZ).
  • Everything here is small-scale. Whether QAOA beats classical methods on large problems is unsettled.

References and further reading

I opened the arXiv abstract pages for Farhi, Goldstone and Gutmann (QAOA), for Cerezo et al. (variational algorithms review) and for Preskill (the NISQ era). Statements attributed to papers are limited to what those abstracts say. The six graphs, angles and all the tables come from my own simulation. My numbers are consistent with the 0.6924 guarantee for 3-regular graphs at p = 1, but a consistency check is not a proof. Qiskit was not installed, so the code is not run.

  1. A Quantum Approximate Optimization Algorithm (arXiv (Farhi, Goldstone, Gutmann, 2014)) Opened the abstract. Integer parameter p; quality improves with p; depth grows linearly with p; Max-Cut p = 1 on 3-regular graphs gives at least 0.6924 of the optimum.
  2. Variational Quantum Algorithms (arXiv (Cerezo et al., 2020)) Opened the abstract. Trainability, accuracy and efficiency as key challenges.
  3. Quantum Computing in the NISQ era and beyond (arXiv / Quantum (J. Preskill, 2018)) Opened the abstract. Near-term devices of 50 to 100 qubits, limited by noise.