← All modules 08 Hybrid optimization with QAOA

SESAME · Day 3 · Module 08

Hybrid optimization
with QAOA

How can a short quantum circuit help us search for good solutions?

QUANTUM

Run a circuit.
Return measured bits.

CLASSICAL

Assess the results.
Choose the next settings.

01 / The hybrid approach02 / QAOA for optimization03 / Learning from results

The hybrid approach / QAOA / Learning from results

We can search for good solutions by combining short quantum circuits with classical feedback.

01Classical feedback lets us search using circuits of limited depth.

02QAOA turns a scoring problem into an adjustable quantum circuit.

03Measured scores guide the search for better circuit settings.

01 / The hybrid approach · 1.1

Hardware imperfections limit reliable circuit depth.

A gate can introduce an error. A longer sequence exposes the state to more operations and more elapsed time.

Circuit depth counts successive stages 3 successive stages 1 2 3 8 successive stages 1 2 3 4 5 6 7 8 Successive operations within one run →

Depth counts successive stages of operations in one circuit.

Gates on different qubits can share a stage. The usable depth depends on the device and the circuit.

01 / The hybrid approach · 1.2

A fixed circuit pattern can have adjustable settings.

Setting A

a = 0.00   b = 0.125

Setting B

a = 0.50   b = 0.125

One circuit pattern

Prepare qubits

ab

Measure

Different settings can change the output probabilities.

We change the circuit settings so that good candidate solutions occur more often when we measure.

a and b are settings we choose. The measured bit string describes a candidate solution.

01 / The hybrid approach · 1.3

Classical feedback chooses the next circuit settings.

The quantum and classical parts of the feedback loop CLASSICAL COMPUTER QUANTUM DEVICE CLASSICAL COMPUTER Choose settings Two numbers: a and b Prepare and measure Fresh preparations at fixed settings Assess the results Evaluate the chosen task settings bit strings Results guide the next choice

The quantum device supplies samples. Classical computation guides further runs.

We search the settings to improve the sampled candidates. Each shot starts with a fresh preparation.

02 / QAOA for optimization · 2.1

MaxCut asks us to split vertices into two groups.

This graph is small enough that we can check every answer. We use it to follow the method.

One graph throughout

The three-vertex path 0 vertex 0 1 vertex 1 2 vertex 2

Each vertex belongs to group 0 or group 1.

We earn one point for each edge joining different groups.

We want the largest score.

Candidate: x₀x₁x₂One bit per vertex, in the order 0, 1, 2.

02 / QAOA for optimization · 2.1

The score counts edges whose endpoint bits differ.

Candidate 000

Candidate 000 on the path 0 points 0 points 0 vertex 0 0 vertex 1 0 vertex 2 Digits inside vertices: group 0 or group 1

Score 0

Candidate 001

Candidate 001 on the path 0 points 1 point 0 vertex 0 0 vertex 1 1 vertex 2 Digits inside vertices: group 0 or group 1

Score 1

Candidate 010

Candidate 010 on the path 1 point 1 point 0 vertex 0 1 vertex 1 0 vertex 2 Digits inside vertices: group 0 or group 1

Score 2

010 cuts both edges. Its score is 2, the best possible for this graph.

101 describes the same partition with the group labels exchanged.

02 / QAOA for optimization · 2.1

Uniform sampling gives each of the eight strings probability ⅛.

ScoreCandidate strings x₀x₁x₂Probability of this score
0000, 1112/8 = 25%
1001, 011, 100, 1104/8 = 50%
2010, 1012/8 = 25%

Uniform sampling finds a score-2 candidate on one quarter of the runs, on average.

This gives us a starting distribution to compare with other circuit settings.

02 / QAOA for optimization · 2.2

QAOA alternates problem phases and mixing.

Quantum Approximate Optimization Algorithm · One qubit per vertex.

One layer of the three-qubit QAOA circuit q₀ |0⟩ H x₀ q₁ |0⟩ H x₁ q₂ |0⟩ H x₂ Problem-dependent phase setting a Mixing setting b One QAOA layer

Problem-dependent phase

a sets the phase change per score point.

Mixing

b controls how amplitudes combine afterward.

H on every qubit prepares equal amplitudes. Each block contains gates; this example uses one layer.

02 / QAOA for optimization · 2.2 / Prediction

Does the phase block change the immediate probabilities?

At setting B, a = 0.50 adds a phase of \( -\pi/2 \) per score point.

ScorePhase addedAmplitude factor
0\(0\)\(1\)
1\(-\pi/2\)\(-i\)
2\(-\pi\)\(-1\)

Measure before mixing

H preparation gives each candidate probability ⅛.

What is it after these phase changes?

Still ⅛. All three phase factors have magnitude 1.

Mixing then allows the phases to affect the final probabilities.

02 / QAOA for optimization · 2.3

Changing the settings changes the sampled scores.

b controls mixing. At b = 0 there is no mixing; here both choices use b = 0.125.

Setting A · Uniform baseline · a = 0.00

Setting A is the uniform-sampling baseline: score zero 25 percent, score one 50 percent, score two 25 percent. Probability 100% 50% 0% 25% 0 50% 1 25% 2 Solution score

Setting B · a = 0.50

Ideal probabilities at setting B: score zero 12.5 percent, score one 25 percent, score two 62.5 percent. Probability 100% 50% 0% 12.5% 0 25% 1 62.5% 2 Solution score

At B, mixing turns the score-dependent phases into more score-2 outcomes.

Ideal probabilities · The score influences interference; the settings determine whether the result is useful.

03 / Learning from results · 3.1

One shot returns one candidate bit string.

Prepare

Three qubits
in zero.

Run

QAOA circuit
at setting B.

Measure

For example:
010

Score classically

Two crossing
edges: 2

Illustrative records from fresh shots

010001101000…

We keep the settings fixed while collecting a batch of samples.

Strings use the labelled vertex order x₀x₁x₂. These are separate circuit executions.

03 / Learning from results · 3.1

Repeated shots give counts for each score.

Candidate scoreNumber of results
010
120
250

10 + 20 + 50 = 80 shots.

One batch at setting B

a = 0.50
b = 0.125

80 fresh runs

Every returned string is scored with the same graph.

The counts tell us how often each score occurred in this batch.

Illustrative counts, chosen to match the ideal proportions. Actual finite samples can differ.

03 / Learning from results · 3.1

The average score is total score divided by shots.

ScoreCountContribution to the total score
0100 × 10 = 0
1201 × 20 = 20
2502 × 50 = 100
\[\text{Average score}=\frac{0+20+100}{80}=1.50\]

This estimates the expected score at setting B.

The average evaluates a circuit setting across many samples.

03 / Learning from results · 3.2 / Prediction

Which tested setting has the highest average score?

SettingScore 0
count
Score 1
count
Score 2
count
Average
score
A2040201.00
B1020501.50
C5020100.50

B has the highest observed average.

C performs worse than A. A change of settings need not improve the result.

80 fresh shots per setting · Illustrative counts.
C uses a = 0.50, b = 0.375; the graph and one-layer circuit pattern stay fixed.

03 / Learning from results · 3.2

The classical search uses scores to propose further settings.

The quantum and classical parts of the feedback loop CLASSICAL COMPUTER QUANTUM DEVICE CLASSICAL COMPUTER Choose settings a = 0.50, b = 0.125 Prepare and measure 80 fresh shots at fixed settings Score the results Estimate an average settings bit strings Results guide the next choice

We retain the best observed setting while exploring further choices.

One option is a coarse grid of settings, followed by a closer search around the best observed pair.

03 / Learning from results · 3.3

The output is a candidate, with its own score.

Used to compare settings

Observed average at B

1.50

One number summarizing a batch of samples.

A possible result after tuning

Candidate 010 on the path 1 point 1 point 0 vertex 0 1 vertex 1 0 vertex 2 Digits inside vertices: group 0 or group 1

010Candidate score: 2

We sample with the chosen settings, score the candidates and keep a good result.

The average guides tuning. The bit string describes the solution.

03 / Learning from results · 3.3 / Prediction

Does the better setting always give an optimal cut?

Setting B · Ideal probabilities

Ideal probabilities at setting B: score zero 12.5 percent, score one 25 percent, score two 62.5 percent. Probability 100% 50% 0% 12.5% 0 25% 1 62.5% 2 Solution score

No. A score of 0 or 1 still has total probability 37.5%.

Every returned candidate can be scored classically.

For this tiny graph we can verify the optimum by inspection. In general, a good candidate does not certify global optimality.

03 / Learning from results · 3.4

Short circuits can still require many executions.

Setting A

80

fresh circuit runs

Setting B

80

fresh circuit runs

Setting C

80

fresh circuit runs

3 settings × 80 shots240 circuit executions

Depth describes one run. Shots and trials determine how often we run it.

More layers add settings and circuit depth. Noise limits how many layers we can use reliably.

03 / Learning from results · 3.4

A useful comparison includes solution quality and total work.

Our graph is easy to solve directly

Candidate 010 on the path 1 point 1 point 0 vertex 0 1 vertex 1 0 vertex 2 Digits inside vertices: group 0 or group 1

Assign alternating groups.
Both edges cross: score 2.

For the same problem

How good are the solutions?

How much quantum and classical work produces them?

How does that compare with a suitable classical method?

This example demonstrates the workflow. It does not establish a speedup.

The hybrid approach / QAOA / Learning from results

We can search for good solutions by combining short quantum circuits with classical feedback.

01Classical feedback lets us search using circuits of limited depth.

02QAOA turns a scoring problem into an adjustable quantum circuit.

03Measured scores guide the search for better circuit settings.

Practice / The same graph and scoring rule

Which setting would we retain from these results?

SettingScore 0
count
Score 1
count
Score 2
count
D202040
E402020

01What is the average score for each setting?

02Which setting has the better observed average?

03Would one more shot necessarily return a score-2 candidate?

80 fresh shots per setting · Supplied illustrative sample data.
Average score = total score / number of shots.