Chapter 13: The Quantum Classifier Zoo and a Practical Criterion¶
We have covered the two main families in depth: quantum kernels and variational circuits. This chapter finishes with a short tour of the other architectures you will meet, because they teach something that the main two do not, and then pulls the whole book together into one practical criterion: when, if ever, should a quantum classifier be used rather than a classical one? The chapter ends with the six statements that summarise the course.
13.1 Distance-based and nearest-centroid classifiers¶
Here is a classifier with no training at all. With amplitude encoding, a single interference circuit implements a kernelised nearest-neighbour rule. An ancilla qubit is put through a Hadamard and entangled with the registers that hold the training points and the test point, then a second Hadamard is applied and the ancilla is post-selected on one outcome (Schuld and co-authors, 2017). Let \(\tilde x\) be the test point and \(x_i\) the \(N\) unit-normalised training points. The acceptance probability of the post-selection is
and, conditioned on acceptance, the probability of the label \(\tilde y=0\) is
The larger conditional probability gives the label. The interference sums classical distances in one circuit: there is no optimisation, hence no plateaus.
It is a nearest-centroid rule. For unit vectors, \(\lVert\tilde x+x_i\rVert^2=2+2\,\tilde x\cdot x_i\). Substituting,
The numerator for class \(0\) is \(N_0\big(1+\tilde x\cdot c_0\big)\), where \(N_0\) is the number of class-\(0\) points and \(c_0\) is their mean vector (the centroid). So the circuit votes for the class whose points, on average, have the largest overlap with the test point: for balanced classes, whichever centroid has the larger inner product with \(\tilde x\). This is also why \(p_{\text{acc}}\approx\tfrac12\) for standardised data, independently of \(N\): the average overlap \(\tilde x\cdot x_i\) is then near zero.
Example 13.1: the interference vote on four points
Take unit vectors in \(\mathbb{R}^2\): class \(0\): \(x_1=(1,0)\), \(x_2=(0.8,0.6)\); class \(1\): \(x_3=(0,1)\), \(x_4=(0.6,0.8)\). The test point is \(\tilde x=(0.96,0.28)\), which is a unit vector.
Step 1, overlaps. \(\tilde x\cdot x_1=0.96\); \(\tilde x\cdot x_2=0.768+0.168=0.936\); \(\tilde x\cdot x_3=0.28\); \(\tilde x\cdot x_4=0.576+0.224=0.800\).
Step 2, sums of \(1+\tilde x\cdot x_i\). Class \(0\): \(1.96+1.936=3.896\). Class \(1\): \(1.28+1.800=3.080\). Total \(6.976\).
Step 3, acceptance. \(p_{\text{acc}}=\frac{1}{2N}\cdot6.976=\frac{6.976}{8}=0.872\). (The data are not standardised, so this is not \(\tfrac12\).)
Step 4, label probability. \(p(\tilde y=0)=3.896/6.976=0.558\) and \(p(\tilde y=1)=0.442\), so the predicted label is \(0\). The test point lies close to the class-\(0\) vectors and far from \(x_3\).
Be honest about the costs. Preparing the superposed training state is expensive, and for amplitude encoding it usually dominates and erases any advantage. Post-selection discards about half the shots, and post-selection failure is the practical obstacle to scaling. Its value is pedagogical: it is a minimal example of measurement itself performing the inference, with classification emerging directly from interference and measurement statistics.
13.2 Quantum neural networks and QCNNs¶
A quantum neural network is a layered parameterised circuit trained end to end. Structurally it is a VQC with a regular layer pattern. The quantum convolutional neural network (QCNN) gives that pattern a particular structure.
- Convolution: one two-qubit unitary \(W(\theta)\) applied translation-invariantly across neighbouring qubits, so the weights are shared.
- Pooling: measure half the qubits mid-circuit, using each outcome as a classical control on the qubits retained. This halves the register each round.
The result is a tree. With \(n\) qubits it has only \(\log_2n\) rounds, so the circuit has \(O(\log n)\) layers and parameters (for \(n=16\): \(16\to8\to4\to2\to1\), four rounds), and the gradient variance decays at worst polynomially in \(n\). QCNNs are provably free of barren plateaus (Pesah and co-authors, 2021). They meet the trainability and generalisation prescriptions of Chapter 12 at once: shallow, few parameters, local measurements. They are a natural fit for translationally structured tasks, notably quantum phase recognition, and their most convincing demonstrations are on quantum data, which foreshadows the criterion at the end of this chapter.
The QCNN is the standout architecture because its trainability guarantee is a theorem rather than a heuristic: weight sharing plus logarithmic depth is exactly what defeats the concentration argument.
13.3 Putting it together¶
| Family | How it learns | Main strength | Main limitation |
|---|---|---|---|
| Quantum kernel SVM | Convex dual on an estimated Gram matrix | Global optimum; proven separation on a structured task | \(O(N^2)\) circuits; kernel concentration |
| VQC / QNN | Gradient descent via parameter shift | Flexible; shot cost linear in \(N\) | Non-convex; barren plateaus; noise-sensitive |
| QCNN | Gradient descent with shared weights and pooling | No barren plateaus; \(O(\log n)\) parameters | Needs structured, often quantum, data |
| Distance-based | No training; interference and post-selection | One circuit; no optimisation | Costly state preparation; post-selection loss |
The two main families compare as follows.
| Aspect | Quantum kernel SVM | Variational classifier |
|---|---|---|
| Training | Convex dual; unique global optimum | Non-convex; local minima and plateaus |
| Shot cost | \(O(N^2M)\), grows with dataset size | \(O(\text{epochs}\cdot NpM)\), grows with parameters |
| Circuit depth | Twice the encoding depth (inversion test) | Encoding plus ansatz depth \(L\) |
| Trainability | No barren plateaus; kernel values can still concentrate | Barren plateaus for deep or global-cost models |
| Evidence | Provable separation on a discrete-log task | Empirically competitive at small scale; no proven advantage |
Read this as a decision table rather than a contest: kernels win on training reliability, variational models on scaling with dataset size. Both suffer an exponential-concentration pathology when the circuit is too expressive; it simply appears in different places. Neither currently has an empirical advantage on real-world data.
13.4 The practical criterion¶
The practical criterion
Use a quantum classifier when the data itself has quantum structure, or when the feature map has a proven separation. Otherwise a tuned classical model is the correct answer.
Quantum data is where the field's clearest successes sit, because there no classical description of the input exists to begin with. For ordinary tabular data the safe workflow, assembled from the previous chapters, is:
- Start from a tuned classical baseline (RBF-kernel SVM, gradient boosting, a small neural network) on the same data and splits, and keep its score in view throughout.
- Choose the encoding deliberately (Chapter 5): angle encoding as the default, scaled into a window of length at most \(\pi\); entangling or re-uploading maps only for a reason, such as a symmetry or a frequency content you can name.
- Check the kernel before training (Chapter 8): estimate the Gram matrix and compute its alignment with the labels; if it is near the identity, the encoding is too expressive or the noise too high.
- Keep the cost local and the circuit shallow (Chapter 12): local observables, depth \(O(\log n)\), few trainable gates.
- Count the shots (Chapters 7, 8, 10): \(\tfrac12N^2M\) for kernels, \(\text{epochs}\times N\times(1+2p)\times M\) for variational training.
- Report honestly: accuracy, shot counts, the classical baseline, and negative results. A negative result reported honestly is a contribution.
13.5 What to take away¶
The six statements below are the spine of the course; everything else is detail supporting them.
- A quantum model is a linear functional in an exponentially large Hilbert space. The encoding fixes which functions are reachable, so it is part of the model, not preprocessing (Chapters 2 and 5).
- A quantum kernel is a fidelity \(k(x,x')=\lvert\langle\varphi(x)\vert\varphi(x')\rangle\rvert^2\). The device supplies similarities and the learning problem stays convex (Chapters 6 to 8).
- A variational classifier trains a parameterised circuit. Gradients are exact through the parameter-shift rule, at two circuit evaluations per parameter (Chapters 9 to 11).
- Expressivity is not free. Over-expressive maps concentrate kernel values and flatten gradients into barren plateaus, \(\operatorname{Var}[\partial_\theta C]\sim2^{-n}\) (Chapters 8 and 12).
- Generalisation improves with few trainable gates, roughly \(O\big(\sqrt{T\log T/N}\big)\) for \(T\) trainable gates and \(N\) training samples (Chapter 12).
- Claims of advantage need data with quantum structure and an honest classical baseline on the same task (Chapter 12 and this chapter).
13.6 Summary¶
Chapter Summary
- A distance-based classifier uses one interference circuit and post-selection; for unit vectors it is a nearest-centroid vote, \(p(\tilde y=0)=\sum_{y_i=0}(1+\tilde x\cdot x_i)/\sum_i(1+\tilde x\cdot x_i)\). It has no training, but state preparation and post-selection costs usually erase any advantage.
- A QCNN has convolution with shared weights and pooling by mid-circuit measurement, \(O(\log n)\) layers and parameters, and is provably free of barren plateaus; it suits structured, often quantum, data.
- Kernels win on training reliability; variational models on scaling with dataset size; both concentrate when over-expressive; neither has an empirical advantage on real-world data.
- Practical criterion: use a quantum classifier when the data has quantum structure or the feature map has a proven separation; otherwise use a tuned classical model.
13.7 Exercises¶
Exercise 13.1
For each situation say whether you would reach for a quantum classifier first, and why: (a) 200 labelled flowers with four features; (b) states produced by an experiment on a quantum many-body system, to be sorted by phase; (c) a feature map with a proven separation for your data's structure.
Answer
(a) No: classical tabular data with no known structure that a feature map could exploit; use a tuned classical baseline. (b) Yes, a QCNN is a natural candidate: the data is quantum, the task is translationally structured (phase recognition) and no classical description of the input exists to begin with. (c) Yes, this is the second half of the practical criterion, but still compare with the best classical method and count the shots.
Exercise 13.2
Compare the shot costs of a quantum-kernel SVM with \(N=1000\), \(M=10^4\) and a variational classifier trained for \(20\) epochs on \(N=1000\) points with \(p=10\) parameters and \(M=10^4\) shots. Then repeat with \(p=100\) and \(50\) epochs.
Answer
Kernel: \(\tfrac12N^2M=\tfrac12\cdot10^6\cdot10^4=5\times10^9\). Variational with \(p=10\), \(20\) epochs: \(20\times1000\times21\times10^4=4.2\times10^9\), comparable. With \(p=100\), \(50\) epochs: \(50\times1000\times201\times10^4\approx1.0\times10^{11}\), twenty times more. Neither family dominates: kernels scale with \(N^2\), variational training with \(\text{epochs}\times N\times p\).
Exercise 13.3
Repeat Example 13.1 with the test point \(\tilde x=(0.28,0.96)\). What label is predicted?
Answer
Overlaps with \(x_1,\dots,x_4\): \(0.28\), \(0.168+0.576=0.744\), \(0.96\), \(0.168+0.768=0.936\). Class \(0\): \((1.28)+(1.744)=3.024\); class \(1\): \((1.96)+(1.936)=3.896\); total \(6.92\). \(p(\tilde y=0)=3.024/6.92=0.437\), so the predicted label is \(1\).
Exercise 13.4
How many pooling rounds does a QCNN need on \(n=32\) qubits to reduce the register to one qubit, and what does this say about the parameter count?
Answer
Each round halves the register: \(32\to16\to8\to4\to2\to1\), which is \(\log_232=5\) rounds. With shared weights the parameter count is a few parameters per round, so \(O(\log n)\) in total, in contrast with the \(2nL\) of a hardware-efficient ansatz.
Exercise 13.5
True or false, with a reason: "the quantum-kernel SVM has barren plateaus because its encoding is a deep circuit."
Answer
False. The SVM dual is convex with a unique optimum, so there is no plateau in the optimisation. The analogous failure appears elsewhere: an over-expressive feature map makes the kernel values concentrate exponentially, so the estimated Gram matrix tends to the identity and needs exponentially many shots to resolve.
Exercise 13.6
Which of the six statements of Section 13.5 is each of these experimental observations evidence for? (i) A ZZ feature map with two repetitions scores \(30\%\) on the iris data where the angle map scores \(100\%\). (ii) The XOR classifier fails without the CNOT. (iii) At \(n=30\) qubits a global-cost gradient needs \(10^9\) shots.
Answer
(i) Statement 4 (expressivity is not free; the kernel is the model's idea of similarity) and, through the encoding, statement 1. (ii) Statement 1: the model's structure fixes what is reachable (the entangling gate is part of the hypothesis class), and statement 3 for the variational circuit it concerns. (iii) Statement 4, the barren plateau.
Exercise 13.7
A paper reports that a variational classifier reaches \(88\%\) on a dataset where a default (untuned) logistic regression reaches \(80\%\). List three things you would require before concluding that the quantum model is better.
Answer
(1) A tuned classical baseline of a stronger kind (RBF-kernel SVM, gradient boosting, a small MLP) with the same hyperparameter budget, on identical splits. (2) The shot count and circuit evaluations used, reported alongside accuracy. (3) Whether the result survives repeated splits or seeds, and whether noise was included. Optionally: whether a classical surrogate or random-Fourier-feature model reproduces the quantum model's outputs.