Lesson 30: Quantum Convolutional Neural Networks (QCNN)¶
30.1 Learning Outcomes¶
By the end of this hour a student will be able to:
- Recall the classical CNN structure and its two key inductive biases.
- Define the quantum convolution and quantum pooling layers.
- Explain how QCNN achieves \(O(\log n)\) depth and \(O(\log n)\) parameters.
- State why QCNNs provably avoid barren plateaus.
- Describe the MERA connection and the canonical application to quantum phase recognition.
30.2 Classical CNN Recap¶
A CNN alternates:
- Convolution — apply the same small filter across all positions (translation invariance + weight sharing).
- Pooling — downsample, reducing resolution while keeping the strongest features (hierarchical locality).
- Fully connected layers at the end for classification.
The two inductive biases that make CNNs work:
- Locality — nearby pixels are more related than distant ones.
- Translation invariance — a feature means the same thing wherever it appears.
Weight sharing cuts the parameter count from \(O(n^2)\) (fully connected) to \(O(k)\) for a filter of size \(k\), independent of the input size.
30.3 The QCNN Architecture¶
Cong, Choi and Lukin (Nature Physics, 2019).
n = 8 qubits
q0 --+--U--+--------------+--V--+---------------------
| | | |
q1 --+--U--+---(traced out)-----+ <- pooled away
| |
q2 --+--U--+--+--V--+-----------+--W--+-----
| | | |
q3 --+--U-----+-----+ (traced out) | <- pooled away
|
q4 --+--U--+--+--V--+--------+--W--+--+-----[M]--> output
| | | | | |
q5 --+--U--+--+ (traced) | | <- pooled away
| |
q6 --+--U--+--+--V--+--------+ <- pooled away
| | | |
q7 --+--U--+--+-----+ <- pooled away
|---conv---|--pool--|---conv---|--pool--|--FC--|
8 qubits 4 qubits 2 qubits 1 qubit
Convolution layer¶
Apply the same two-qubit unitary \(U(\vec\theta)\) to every neighbouring pair:
Weight sharing is explicit: every pair uses the identical parameter vector \(\vec\theta\). A general two-qubit unitary needs 15 parameters (the dimension of \(SU(4)\)); simplified ansätze use 6.
Translation invariance follows immediately from using the same \(U\) everywhere — the quantum analogue of a shared convolutional filter.
Pooling layer¶
Classical pooling discards information deterministically (max, average). Quantum pooling has two standard forms:
(a) Measurement-based pooling. Measure one qubit of each pair and apply a rotation to its partner conditioned on the outcome:
This is a genuine non-linearity — measurement is not a unitary operation — and it is the direct analogue of a CNN's activation function.
(b) Trace-out pooling. Simply stop using the qubit. Formally, take the partial trace. Simpler to implement but discards the information rather than using it.
Either way, the number of active qubits halves at each pooling layer.
Fully connected layer¶
Once \(O(1)\) qubits remain, apply a general unitary \(F(\vec\theta_{\mathrm{FC}})\) and measure.
30.4 Why the QCNN Is Special¶
Logarithmic scaling¶
| Quantity | Value |
|---|---|
| Layers | \(\log_2 n\) (halving each time) |
| Parameters | \(O(\log n)\) — because of weight sharing |
| Circuit depth | \(O(\log n)\) |
| Qubits | \(n\) |
For \(n = 1024\): only \(\log_2 1024 = 10\) layers, and a few dozen parameters total. Compare a hardware-efficient ansatz with \(L\) layers on 1024 qubits: \(2\times1024\times L\) parameters.
No barren plateaus — and it is a theorem¶
Theorem (Pesah, Cerezo, Wang, Volkoff, Sornborger, Coles, PRX 2021). For a QCNN with local measurements, the gradient variance is
— polynomially, not exponentially, small. QCNNs are trainable at scale.
Why. Three reinforcing reasons:
- Shallow depth. \(O(\log n)\) layers cannot form a 2-design over the full \(2^n\)-dimensional space.
- Local structure. Each gate acts on 2 qubits, and the measured observable is local, so the causal lightcone of any parameter contains only \(O(\mathrm{polylog}\,n)\) gates.
- Weight sharing. With \(O(\log n)\) independent parameters, each one influences many gates, so its gradient is a sum of contributions rather than a single vanishing term.
The MERA connection¶
Read the QCNN backwards and it becomes the Multiscale Entanglement Renormalisation Ansatz (MERA), a tensor network used in condensed-matter physics to represent critical ground states.
| MERA (physics) | QCNN (ML) |
|---|---|
| Disentanglers | convolution layers |
| Isometries (coarse-graining) | pooling layers |
| Renormalisation-group flow | feature hierarchy |
| Run bottom-up to generate a state | Run top-down to classify a state |
Why this matters. MERA is known to represent physically relevant states efficiently. Since QCNN is its inverse, the QCNN is guaranteed to be able to recognise exactly those states — a principled reason to expect it to work on quantum data.
30.5 The Canonical Application: Quantum Phase Recognition¶
The problem. Given a many-body ground state \(|\psi\rangle\), determine which phase of matter it belongs to (e.g. topological versus trivial). Classically this needs a hand-designed order parameter, which for topological phases is a non-local string operator that is often unknown.
The QCNN solution. Feed the state directly into the QCNN and train it to output the phase label. No order parameter is needed — the network learns one.
The Cong–Choi–Lukin result. On the \(\mathbb{Z}_2\times\mathbb{Z}_2\) symmetry-protected topological phase of a cluster-Ising chain, a QCNN trained on a handful of examples identified the phase boundary more accurately than the best known string order parameter, and generalised to system sizes it was never trained on.
This is the QQ quadrant done right. The data is already quantum (no encoding bottleneck), the classical alternative is genuinely hard (exponential tomography, or an unknown order parameter), and the architecture matches the physics. Of everything in Unit III, this is the most credible route to practical quantum advantage in machine learning.
30.6 Solved Problems¶
Problem 1 — Counting layers, parameters and depth¶
Design a QCNN for 16 qubits with 15-parameter convolution unitaries and 6-parameter pooling unitaries. Count layers, parameters and depth, and compare with a hardware-efficient ansatz.
Solution.
Layers. \(16 \to 8 \to 4 \to 2 \to 1\), i.e. \(\log_2 16 = \mathbf{4}\) conv–pool blocks.
Parameters. With weight sharing, each block has one shared conv unitary and one shared pool unitary:
(If parameters were also shared across blocks, this would fall to \(15 + 6 + 15 = 36\).)
Depth. Each conv layer applies gates to disjoint pairs in parallel — depth \(O(1)\) per layer (about 2 time steps for a \(SU(4)\) decomposition into 3 CNOTs). Pooling adds 1–2 more.
Comparison with a hardware-efficient ansatz on 16 qubits with 8 layers:
| QCNN | Hardware-efficient | |
|---|---|---|
| Parameters | 99 | \(2\times16\times8 = 256\) |
| Depth | 16 | \(\approx 8\times(1 + 16) = 136\) |
| Barren plateau | no (proved) | yes |
| Gradient shots at \(n=16\) | \(\sim10^{3}\) | \(\sim10^{5}\) |
The QCNN is 2.6× fewer parameters, 8× shallower, and trainable.
Problem 2 — Tracing a two-qubit convolution¶
A convolution unitary \(U(\theta) = \exp(-i\theta\,Z\otimes Z/2)\) acts on \(|{+}{+}\rangle\). Compute the output state and its entanglement, and interpret \(\theta\) as a filter strength.
Solution.
\(Z\otimes Z\) is diagonal with eigenvalues \(+1\) on \(|00\rangle,|11\rangle\) and \(-1\) on \(|01\rangle,|10\rangle\). Since \((Z\otimes Z)^2 = I\):
Apply to \(|{+}{+}\rangle = \frac12(|00\rangle+|01\rangle+|10\rangle+|11\rangle)\):
Entanglement (concurrence, from L08). With \(a_{00}=a_{11}=\frac{e^{-i\theta/2}}{2}\) and \(a_{01}=a_{10}=\frac{e^{i\theta/2}}{2}\):
| \(\theta\) | \(C\) | Meaning |
|---|---|---|
| \(0\) | 0 | identity — filter does nothing |
| \(\pi/4\) | 0.707 | partial correlation detected |
| \(\pi/2\) | 1 | maximally entangling — strongest filter |
| \(\pi\) | 0 | back to a product state (up to phase) |
Interpretation as a learned filter. \(\theta\) controls how strongly the layer correlates neighbouring qubits — exactly what a convolutional filter weight does classically. Training adjusts \(\theta\) to whatever correlation strength the data demands. At \(\theta = \pi/2\) the filter maximally couples the pair; at \(\theta=0\) it passes the input through unchanged (a "do nothing" filter, which the network can learn if the feature is irrelevant).
Problem 3 — Gradient scaling: QCNN versus hardware-efficient¶
Estimate the shots needed for one gradient component at \(n = 8, 16, 32, 64\) for a QCNN (\(\mathrm{Var}\sim1/n^2\)) and a deep hardware-efficient ansatz (\(\mathrm{Var}\sim2^{-n}\)), at SNR 3.
Solution.
| \(n\) | QCNN \(\mathrm{Var} = n^{-2}\) | \(S_{\text{QCNN}}\) | HEA \(\mathrm{Var}=2^{-n}\) | \(S_{\text{HEA}}\) |
|---|---|---|---|---|
| 8 | \(1.56\times10^{-2}\) | \(5.8\times10^{2}\) | \(3.91\times10^{-3}\) | \(2.3\times10^{3}\) |
| 16 | \(3.91\times10^{-3}\) | \(2.3\times10^{3}\) | \(1.53\times10^{-5}\) | \(5.9\times10^{5}\) |
| 32 | \(9.77\times10^{-4}\) | \(9.2\times10^{3}\) | \(2.33\times10^{-10}\) | \(3.9\times10^{10}\) |
| 64 | \(2.44\times10^{-4}\) | \(3.7\times10^{4}\) | \(5.42\times10^{-20}\) | \(1.7\times10^{20}\) |
At \(n = 64\), at 10 kHz:
This single table is the strongest argument in the course for problem-structured ansätze.
Problem 4 — Designing a QCNN for image classification¶
Adapt a QCNN to classify \(8\times8\) grayscale images (64 pixels) into 2 classes. Specify encoding, architecture and parameter count, and state the honest caveat.
Solution.
Encoding. Two options:
- Amplitude encoding: 64 pixels into \(\log_2 64 = 6\) qubits. Compact, but the \(O(64)\) preparation depth is the bottleneck, and it destroys the 2-D spatial structure the QCNN is designed to exploit.
- Angle encoding after PCA: reduce 64 pixels to 8 principal components, then angle-encode on 8 qubits with depth \(O(1)\). Recommended for NISQ.
Take the second: 8 qubits.
Architecture.
Layer 1: conv (shared 15-param SU(4) on pairs 0-1, 2-3, 4-5, 6-7)
pool (6-param, measure odd qubits) 8 -> 4 qubits
Layer 2: conv (shared 15-param on pairs 0-1, 2-3)
pool (6-param) 4 -> 2 qubits
Layer 3: fully connected (15-param SU(4) on the remaining pair)
measure <Z_0> -> class label
Parameters.
Depth. \(\approx 1\) (encoding) \(+ 2\times4 + 3 = \mathbf{12}\) gates deep — very NISQ-friendly.
Training. SPSA, 1024 shots, cross-entropy loss.
The honest caveat, which must be stated. For \(8\times8\) images:
- A classical CNN with two conv layers achieves >99 % on MNIST-style data in seconds.
- The PCA step already reduced 64 pixels to 8 numbers, and a logistic regression on those 8 components typically gets 90–95 %.
- The QCNN's spatial inductive bias is largely wasted, because PCA destroyed the spatial structure it was designed for.
The right conclusion. A QCNN on classical image data is a good exercise in the architecture but not a competitive method. QCNNs earn their keep on quantum data — many-body states, quantum sensor readings, error-syndrome patterns — where the 1-D chain structure is physically meaningful and no classical alternative exists.
Problem 5 — Quantum phase recognition, worked conceptually¶
Explain how a QCNN distinguishes an SPT phase from a trivial phase in a spin chain, and why this succeeds where a naive approach fails.
Solution.
The physics. The cluster-Ising Hamiltonian
has an SPT phase (protected by \(\mathbb{Z}_2\times\mathbb{Z}_2\) symmetry) for small \(h_1,h_2\) and a trivial paramagnetic phase for large \(h_1\).
Why naive approaches fail.
- Local order parameters are all zero. The SPT phase has no local order parameter — that is what "topological" means. Measuring \(\langle Z_i\rangle\), \(\langle X_i\rangle\) or any single-site observable gives the same answer in both phases.
-
The correct order parameter is a non-local string:
\[ S = \left\langle Z_1X_2X_3\cdots X_{n-1}Z_n\right\rangle \]— it must be guessed in advance, and for a general unknown phase nobody knows what it is. 3. Tomography is exponential. Reconstructing \(|\psi\rangle\) to test it classically needs \(O(4^n)\) measurements.
How the QCNN succeeds.
- Convolution layers detect local correlations such as \(Z_{i-1}X_iZ_{i+1}\) — the stabilisers of the cluster state. These are nonzero in the SPT phase.
- Pooling propagates the information upward. A correlation detected on qubits \((i-1,i,i+1)\) is compressed into the surviving qubit, so the next layer sees correlations over a doubled length scale.
- After \(\log_2 n\) layers, the single remaining qubit encodes a correlation spanning the whole chain — which is precisely a string order parameter, discovered rather than assumed.
- Training on a few labelled states adjusts the shared filters to whichever correlations distinguish the phases.
The renormalisation-group interpretation. Each conv–pool block is one step of RG coarse-graining: short-range fluctuations are removed and the long-distance universal behaviour — the phase — is retained. This is why the depth is \(\log n\) and why the network generalises to system sizes it never saw: the RG flow is scale-invariant.
Result (Cong–Choi–Lukin 2019). The QCNN located the phase boundary more sharply than the known string order parameter, and did so from a small number of training states.
30.7 Practice Problems¶
- How many conv–pool layers for 64 qubits? [Ans: 6]
- Parameter count for a 32-qubit QCNN with 15-param conv and 6-param pool, plus a 15-param FC. [Ans: \(5\times21+15 = 120\)]
- Compute the concurrence produced by \(\exp(-i\theta X\otimes X/2)\) on \(|00\rangle\). [Ans: \(|\sin\theta|\)]
- Why does weight sharing help avoid barren plateaus?
- Explain the MERA–QCNN correspondence in three sentences.
- Shots for one QCNN gradient component at \(n=128\) with \(\mathrm{Var}=n^{-2}\), SNR 3. [Ans: \(1.5\times10^{5}\)]
- Name two application domains where a QCNN is genuinely the right tool.
30.8 Summary¶
- A QCNN alternates convolution (shared two-qubit unitaries on neighbouring pairs — weight sharing and translation invariance) and pooling (measure-and-condition or trace-out, halving the qubit count), ending with a small fully connected block.
- Scaling: \(\log_2 n\) layers, \(O(\log n)\) parameters, \(O(\log n)\) depth.
- QCNNs provably avoid barren plateaus: \(\mathrm{Var}[\partial L] = \Omega(1/\mathrm{poly}(n))\), because of shallow depth, local lightcones and weight sharing. The gradient-cost table (Problem 3) shows polynomial versus exponential shot requirements.
- The architecture is the inverse of MERA, which is why it efficiently represents and recognises physically relevant many-body states.
- Killer application: quantum phase recognition — the network learns a non-local string order parameter that would otherwise have to be guessed, and generalises across system sizes via the RG interpretation.
- On classical image data a QCNN is a useful exercise but not competitive; its real domain is quantum data.
Next lesson: L31 — Quantum linear regression.
Practise now: unit3-qml-lab.html → QCNN Builder: set the qubit count, watch the conv–pool
tree contract, and compare gradient-variance curves for QCNN versus hardware-efficient ansätze.