Part VI has spent three chapters measuring quantum machine learning against classical baselines and
Prerequisites
- 32
- 33
- 34
Learning Objectives
- Identify when data is quantum by nature and the input problem disappears.
- Implement classical shadows and compare at EQUAL TOTAL BUDGET.
- Explain the classical simulation boundary and what it means for advantage claims.
- Price the latency of a hybrid loop.
In This Chapter
Chapter 35: Hybrid Architectures
Part VI has spent three chapters measuring quantum machine learning against classical baselines and losing. Chapter 32's input problem, Chapter 33's inference bill, Chapter 34's quadratic — and in every comparison, a classical model that was faster, cheaper, and at least as accurate.
Every one of those chapters ended by pointing here. The argument changes when the data is already quantum, because the encoding cost — the thing Chapter 32 identified as arguably fatal — simply does not exist.
This chapter measures that case, and it has two results that belong together.
The claim is true. A classifier acting on quantum states pays zero encoding gates, against Chapter 32's $N - \log_2 N - 1$ per sample per epoch. That is not a marginal saving; it removes the dominant term.
And at any scale where you can check it, it buys nothing — because a state you can write down is a
state sklearn can read. On this chapter's 6-qubit problem, an SVM given the same measurement
probabilities scores 0.7857 against the quantum classifier's 0.6429.
Part VI closes on that boundary, because it is the same boundary as everywhere else in this book.
35.1 What "hybrid" actually means
Every algorithm in Parts IV and VI has been hybrid. Chapter 24's VQE, Chapter 32's classifier, Chapter 34's kernel — all of them are a quantum circuit inside a classical loop:
CLASSICAL QUANTUM
choose parameters -> prepare state
evolve
<- measure
update parameters
repeat
The interesting question is not whether to be hybrid — you have no choice — but where to put the boundary, and Part VI has measured the consequences of putting it in different places:
Ch. 32/33 variational quantum evolves AND is optimized -> plateaus, shots x samples x steps
Ch. 34 kernel quantum only EVALUATES -> convex, but n^2 evaluations
Ch. 35 quantum data quantum SUPPLIES the input too -> no encoding cost
Each move shifts work across the boundary, and each shift trades one cost for another. Chapter 34's convexity removed the optimization and introduced a quadratic. This chapter's move removes the encoding and introduces a constraint on what the data can be.
Every algorithm in this book is hybrid
Worth establishing before the term does any work, because "hybrid quantum-classical" is used as though it named a category and it names almost everything.
algorithm classical part crossings
Shor (Ch.23) reduction to order finding, 1 per attempt
continued fractions
Grover (Ch.21) choosing the iteration count 0 (fixed in advance)
VQE (Ch.24, 36) the optimizer ~100s
QAOA (Ch.24, 37) the optimizer ~100s
error mitigation (Ch.13) extrapolation, matrix inversion 1 per estimate
error correction (Ch.25) syndrome decoding every cycle
QML (Ch.32-34) training, and usually inference too ~1000s
BB84 (Ch.38) sifting, reconciliation, amplification several per block
Only Grover is not hybrid, and only because its iteration count can be computed in advance — Chapter 21 measured what happens when you get it wrong (3 iterations gives 0.9613, 6 gives 0.0204).
So the term does not distinguish algorithms. What distinguishes them is the crossing count in the last column, and it spans four orders of magnitude. That is the quantity worth naming, and §35.6 develops it into a design procedure.
⚛️ The Physics Underneath: why the boundary exists at all.
A quantum computer cannot make a decision. It can put a system into a superposition of branches where different decisions were taken, but the moment you need to know which branch you are in — to choose the next gate, to update a parameter, to declare a syndrome — you must measure, and measurement collapses everything else.
Classical control is not a limitation of current hardware; it is what measurement is. Chapter 5 established this as the reason quantum programs return samples rather than values. Chapter 9's dynamic circuits are the tightest possible coupling — classical logic inside the coherence time — and even there, the decision is made classically on a measured bit.
This is why the three-category taxonomy in §35.6 is about where the measurement happens, and why a design that measures less often is structurally cheaper regardless of what hardware improves.
35.2 Quantum data
The transverse-field Ising model is the standard example, and it is a good one:
$$H(h) = -\sum_i Z_i Z_{i+1} - h\sum_i X_i$$
At small $h$ the ground state is ordered; at large $h$ it is disordered; and at $h = 1$ there is a quantum phase transition. Classifying which phase a ground state is in is a real physics question with a known answer, which makes it a genuine test rather than a demonstration.
And the input is a quantum state. On a real setup those states come out of an experiment, or out of another quantum computation — Chapter 24's VQE, for instance, produces exactly this kind of object.
Chapter 32's amplitude encoding, 64 amplitudes:
57 two-qubit gates PER SAMPLE, PER EPOCH
Quantum data:
0 gates -- the state is already in the register
⚛️ The Physics Underneath: the input problem is a statement about classical data.
Chapter 32 §32.2's bound is information-theoretic: an arbitrary $N$-dimensional state has $N$ independent real parameters, so loading one costs $\mathcal{O}(N)$ gates.
A state produced by a physical process was never loaded. It was prepared by the dynamics, and the classifier acts on it directly. The $\mathcal{O}(N)$ does not apply because there is nothing to encode.
This is the strongest structural argument in quantum machine learning, and unlike most of Part VI's claims it is not in dispute.
⚙️ Under the Transpiler: the simulator did prepare the state, and it cost more than the formula says.
§35.3's code calls
qml.StatePrep(state, ...). On a simulator that is a real operation with a real decomposition. The "zero encoding gates" claim is about the physical setting the experiment stands in for, not about what ran on this laptop — worth stating explicitly, because that distinction is the whole chapter.Decomposing the state preparation for the same 64-amplitude vector, in both frameworks:
text framework / synthesis two-qubit gates Qiskit 2.5.1 StatePreparation -> [cx, u] 57 Qiskit 2.5.1 the same, optimization_level=3 57 PennyLane 0.45.1 qml.StatePrep().decomposition() 124 (+ 61 RY)Qiskit reproduces Chapter 32 §32.2's $N - \log_2 N - 1 = 57$ exactly, and
optimization_level=3removes not one gate — which is what an information-theoretic count should look like under a peephole optimizer. Chapter 28 measured that same optimizer reducing a circuit to zero two-qubit gates atapproximation_degree=0.9; here it removes nothing, because every gate is carrying a parameter of the state and there is no redundancy to find.PennyLane's default decomposition emits 2.18× as many. Neither is wrong — they are different syntheses of the same unitary, and Qiskit's is the tighter one. But it means the cost quantum data avoids is 57 to 124 two-qubit gates per sample per epoch depending on your framework, not a universal 57, and the larger figure is the one a PennyLane pipeline actually pays.
35.3 The classifier
Train on states away from criticality, test on states near it — the hard cases, where the phases are least distinguishable:
train: 28 states, h <= 0.7 or h >= 1.3
test: 14 states, 0.75 <= h <= 1.25
A 36-parameter StronglyEntanglingLayers classifier acting directly on the state:
@qml.qnode(dev)
def classifier(state, w):
qml.StatePrep(state, wires=range(n_qubits)) # the data, already quantum
qml.StronglyEntanglingLayers(w, wires=range(n_qubits))
return qml.expval(qml.PauliZ(0))
train accuracy 1.0000
test accuracy 0.6429
It separates the training set perfectly and generalizes poorly across the critical point — which is what you would expect from 36 parameters on 28 samples, and is worth stating plainly rather than reporting only the training number.
What makes a phase transition learnable, and what makes this one hard
The task is not arbitrary, and knowing why it is hard is what makes 0.6429 interpretable rather than merely disappointing.
A phase is a property of the whole system, not of any qubit. What distinguishes the two phases is the behaviour of the two-point correlator $\langle Z_i Z_j\rangle$: it decays exponentially in $|i-j|$ in the disordered phase, saturates to a constant in the ordered one, and at criticality the correlation length $\xi$ diverges and the decay becomes a power law. The learnable signal lives in the correlators — which are exactly the observables §35.5 spends its shot budget estimating.
Here is the ground state at $h = 0.5$, well inside the ordered phase, by exact diagonalization:
6-qubit TFIM ground state, h = 0.5, exact expectation values:
<Z0 Z1> +0.8424 <X0> +0.5006 <Z0> ... <Z5> all 0.0000
<Z1 Z2> +0.9081 <X1> +0.3144
<Z2 Z3> +0.9173 <X2> +0.2887
<Z3 Z4> +0.9081 <X3> +0.2887
<Z4 Z5> +0.8424 <X4> +0.3144
<X5> +0.5006
Three features of that table decide the problem.
Every single-site $\langle Z_i \rangle$ is exactly zero. The Hamiltonian is invariant under flipping every $Z$, and a finite system's ground state respects that symmetry, so the magnetization — the textbook order parameter for this model — is identically zero on both sides of the transition at every $h$. The obvious feature carries no signal whatever. A model looking only at single-site $Z$ expectations is at chance by construction, and would stay there at any system size.
The signal is in the correlators, and on the ordered side they are near-saturated. 0.84 to 0.92, which leaves little room to move — a point that returns in §35.5, where near-saturated observables are also the ones direct estimation estimates most accurately.
A third of the system is boundary. $\langle X_0 \rangle = 0.5006$ against $\langle X_2 \rangle = 0.2887$: the edge sites differ from the bulk by 73%, and two of six sites are edges. That is finite-size geometry, not physics, and a classifier has every opportunity to learn it instead of the phase.
And that is why the near-critical split is hard in a specific, quantifiable way. On an infinite chain the transition at $h = 1$ is sharp. On a finite chain the correlation length cannot exceed the system size, so the transition is smeared over a window that narrows as $L^{-1/\nu}$; the 1D transverse-field Ising chain has $\nu = 1$, so the window shrinks as $1/L$ — of order $\pm 0.17$ at $L = 6$. The test set spans $0.75 \le h \le 1.25$, which is $\pm 0.25$: essentially the whole smeared region.
So the test states are not merely "the hard cases." At six qubits the two phases are genuinely less distinct there, and a classifier scoring 1.0000 on that window would be more suspicious than one scoring 0.6429. This is the honest version of the finding, and it is a statement about the system size rather than about the model.
🧪 Run It: find out which feature is doing the work.
The section above makes three predictions that take a few lines to check, and one of them would explain §35.4's most surprising result.
- Fit
LogisticRegressionon only the six $\langle Z_i \rangle$ magnetizations. The prediction is chance — they are exactly zero everywhere, at every $h$.- Fit it on only the five $\langle Z_i Z_{i+1}\rangle$ correlators — five features against the table's 64 or 128. The prediction is that five is enough.
- If (2) holds, then the other 59 probability entries were never carrying signal, which is a candidate explanation for why probabilities beat full amplitudes in §35.4: the extra dimensions are not just uninformative, they are actively harmful to a distance-based model like kNN.
Exercise 35.5 asks the same question from the model's side by shrinking the parameter count until train and test accuracy converge. Both routes are looking for the same number: how many degrees of freedom does this task actually have? If the answer is five, then 36 parameters was never going to generalize.
What makes data "quantum" in the sense that matters
The phrase is used loosely enough to be worth pinning down, because three quite different things travel under it and only one of them removes Chapter 32's input problem.
1. Data that is about quantum systems. Molecular geometries, measured spectra, material properties. This is classical data describing quantum objects, and it is stored as floating-point numbers on a disk. Loading it costs exactly what Chapter 32 measured — $N - \log_2 N - 1$ gates for amplitude encoding. Calling it "quantum data" is a category error, and it is the most common one.
2. Data produced by a quantum simulation you control. A state prepared by a circuit you wrote. This is genuinely a quantum state and the encoding is free, because you never encoded anything — but you also learn nothing about the world, only about your own circuit. Useful for benchmarking, not for science. This chapter's §35.2 states plainly that its states are of this kind, which is why §35.4's classical baseline is decisive rather than merely interesting.
3. Data arriving from a physical quantum system you did not prepare. A quantum sensor's output. A state received over a quantum channel. The output of another quantum processor. This is the case where the input problem genuinely does not exist, because the state was never classical at any point.
Only category 3 supports the advantage argument, and it is the rarest. The proven separations — Huang et al. on learning from experiments — are all in category 3, and they require the learner to process copies of the state coherently, not to measure them and analyse the outcomes classically.
⚠️ Common Pitfall: measuring quantum data makes it classical data.
This sounds obvious and is violated constantly. A pipeline that prepares a quantum state, measures it, and feeds the measurement outcomes to a classical model has not avoided the input problem — it has simply moved the classical data's origin.
That pipeline is exactly what §35.4 measures, and
SVC(rbf)on the measurement probabilities scored 0.7857 against the quantum model's 0.6429. The classical model won on the quantum data, because once you have measured, it is not quantum data any more.The distinction that matters: does the learning algorithm ever hold two copies of the state at once? Coherent processing across copies is where the proven separations live. A pipeline that measures each copy independently and aggregates classically is subject to the same bounds a classical learner is.
35.4 The baseline that has to be run
Here is the question Part VI has taught us to ask before believing anything: what does a classical model get, given the same information?
The states are 6-qubit, so each is a 64-dimensional complex vector — 128 real numbers. That is a perfectly ordinary feature vector.
classical model input test acc
LogisticRegression full amplitudes 0.6429
SVC (rbf) full amplitudes 0.5714
kNN full amplitudes 0.5714
LogisticRegression probabilities only 0.6429
SVC (rbf) probabilities only 0.7857
kNN probabilities only 0.7857
quantum classifier the state itself 0.6429
An SVM on measurement probabilities scores 0.7857 against the quantum classifier's 0.6429.
Note also that probabilities beat full amplitudes for SVC and kNN — the phase information is not useful for this task and adds 64 dimensions of noise. The best classical result uses strictly less information than the quantum model has access to.
🔬 Honest Assessment: the zero-encoding-cost advantage is real, and at checkable scale it buys nothing.
A quantum state on $n$ qubits is $2^n$ numbers. At 6 qubits that is 128 reals, and
sklearnreads them for free — the saving Chapter 32 identified as decisive is a saving on an operation the classical model never needed to perform.The advantage exists only when $2^n$ is too large to write down.
And that is the same boundary as everywhere else in this book. Chapter 21's Grover crossover, Chapter 23's Shor, Chapter 25's threshold, Chapter 30's XEB — the quantum case begins where classical simulation ends, and every honest demonstration below that line is a demonstration of the method rather than of an advantage.
The consolation is real, though: this is the one place in Part VI where the argument survives the
scaling. Chapter 32's input problem does not go away at 50 qubits — it gets worse. This one
disappears, because at 50 qubits there is no classical feature vector to hand sklearn at all.
The simulation boundary, and why it decides the argument
§35.4's result depends on a fact that is easy to state and easy to forget: the classical baseline could run at all.
SVC(rbf) was given the measurement probabilities of the quantum states. Producing those probabilities
required simulating the states — which was possible because the system was small. Above roughly 30–35
qubits it would not have been, and the comparison could not have been made.
That cuts both ways, and the symmetry is the whole difficulty of the field:
Below the boundary, any quantum result can be checked classically. A method that works there has demonstrated correctness, not advantage — because the classical simulation that verified it is itself a classical algorithm solving the same problem.
Above the boundary, no quantum result can be checked classically. A method that works there cannot be verified, only trusted.
There is no regime where a quantum advantage is both real and directly checkable, and this is not a temporary situation. It is structural, and it is why Chapter 37 §37.7's certificate question matters so much: a method that produces a bound on its own answer escapes the dilemma, and a method that produces only a bitstring does not.
>>> from vqelab.hybrid import quantum_data_verdict
>>> quantum_data_verdict(n_qubits=20, ...)
'CLASSICALLY_CHECKABLE' # 2^20 = 1,048,576 complex amplitudes
>>> quantum_data_verdict(n_qubits=40, ...)
'BEYOND_SIMULATION'
The module returns CLASSICALLY_CHECKABLE rather than an advantage claim below 32 qubits, and names the
state's size in reals when it does. That is not pedantry — it is the difference between "our method
works" and "our method wins," and Part VI's scorecard exists because the second claim was made in
several places where only the first was supported.
📊 What the Numbers Say: the three ways past the dilemma, and what each costs.
Certification. Produce a bound alongside the answer, so correctness is checkable without re-solving. Chapter 37 measured Goemans–Williamson doing exactly this — an SDP bound certifying its cut to within 0.9975 of optimal, without knowing the optimum. No near-term quantum algorithm in this book produces one.
Cross-checking against physical reality. For simulation problems, compare against experiment rather than against classical computation. This is the strongest route for Chapter 36's chemistry, and it requires that the experiment exist — which is a research programme rather than a benchmark.
Bootstrapping from the checkable region. Validate a method thoroughly below 30 qubits, then argue the validation extends. This is what everyone does and it is the weakest of the three, because the obstacles that appear above the boundary — barren plateaus, error accumulation, sampling cost — are precisely the ones that do not show up below it.
Fourteen test states, and what that number can support
Part VI has attached an error bar to every accuracy difference it reported — Chapter 33's $-0.0626 \pm 0.0067$, Chapter 34's $+0.0576 \pm 0.0083$ — and §35.4's table does not have one. It should, and the arithmetic is uncomfortable.
Every accuracy in that table is a fraction over 14, because the test set is 14 states:
accuracy x 14 correct model
0.5714 8.00 8 SVC and kNN on full amplitudes
0.6429 9.00 9 quantum classifier; LogisticRegression on either input
0.7857 11.00 11 SVC and kNN on probabilities
The headline gap — 0.7857 against 0.6429 — is two test states. Eleven right instead of nine.
Two ways to price that, and they agree:
binomial SE of a proportion at n = 14
quantum 9/14 = 0.6429 SE 0.1281
SVC 11/14 = 0.7857 SE 0.1097
difference 0.1429 SE 0.1686 -> 0.85 SE
The two models were scored on the same 14 states, so treating them as independent is not quite right. The paired test is McNemar's, and it needs only the states the two models disagree on. If SVC is right on $b$ states where the quantum model is wrong and wrong on $c$ where it is right, then $b - c = 2$, and the exact two-sided $p$ over every consistent split is:
b, c discordant pairs exact p
2, 0 2 0.5000
3, 1 4 0.6250
4, 2 6 0.6875
8, 6 14 0.7905
The best case for the classical model is $p = 0.50$, and it gets worse from there. No arrangement of the results makes this difference significant, and none could — two states is simply not enough evidence to distinguish two classifiers.
★ This does not overturn §35.4's conclusion; it states it correctly. What the experiment supports is "the quantum classifier did not beat a classical baseline" — which is true, and is exactly what Part VI's scorecard claims. What it does not support is "SVC is 0.14 better." Holding the proportions fixed, that difference reaches two standard errors at 78 test states and stays under one until about 20 — so the experiment as run sits at the far wrong end of that scale.
test states SE(difference) difference / SE
14 0.1686 0.85
30 0.1152 1.24
50 0.0892 1.60
78 0.0714 2.00
And notice the shape of the failure, because this book has catalogued it six times across Part V: a measurement that cannot detect the thing being asked about. A 14-state test set cannot resolve a 14-point accuracy difference. Chapter 27 §27.5 made the same error in the other direction, reporting a 1.0% false-failure rate from 2 failures in 200 runs and finding 0.150% at 2,000.
And here the fix is free. Each test state is one eigenvector of a $64 \times 64$ matrix at one value
of $h$ — a numpy.linalg.eigh call, on a continuous parameter, with as many values available as you
care to ask for. The test set is 14 because a split was chosen, not because 14 was all that could be
obtained. Fourteen was a convenient number, and the convenient number is once again the one that stops
the search.
35.5 Classical shadows
If the data is quantum and you cannot write it down, how do you learn anything about it efficiently?
The naive approach estimates one observable per circuit. Classical shadows (Huang, Kueng, and Preskill, 2020) measure in randomly-chosen Pauli bases, store the outcomes, and reconstruct many observables from the same record:
6-qubit state, 17 observables. Same shots PER OBSERVABLE, 12 repetitions:
shots direct |err| shadow |err| ratio
1,000 0.0202 0.0542 2.7x
5,000 0.0088 0.0218 2.5x
20,000 0.0050 0.0113 2.3x
Read naively that looks bad — the shadow estimate is 2.5× less accurate per observable. But the comparison is unfair: direct estimation used 17× the total shots.
Give both methods the same total budget and the result reverses:
total budget direct (split 17 ways) shadows (all on one record) winner
1,700 0.0645 0.0431 SHADOWS 1.50x
8,500 0.0284 0.0172 SHADOWS 1.65x
34,000 0.0157 0.0087 SHADOWS 1.80x
Splitting a budget 17 ways costs $\sqrt{17} = 4.1\times$ in error. Shadows pay only ~2.5× for reusing one record. The difference is the win.
The real result is not "17× fewer shots" — it is "a better use of whatever budget you have, once the observables outnumber a handful."
⚛️ Why one measurement record answers many questions. A random Pauli-basis measurement produces a classical snapshot whose expectation over the random basis choice reconstructs the state. Any observable can then be estimated from the same snapshots — you are not measuring the observable, you are measuring the state and asking the record afterwards.
The number of snapshots needed grows with the locality of the observables, not with how many there are. That is what makes the trade favourable.
This is the practical primitive that makes the quantum-data case workable, and it is Chapter 24 §24.3's shot budget attacked from the one direction that helps: not fewer shots per estimate, but more estimates per shot.
Why shadows work, and where the square root comes from
The equal-budget result is worth understanding rather than memorizing, because the mechanism tells you exactly when shadows will and will not help.
Direct estimation measures one observable at a time. To estimate $M$ observables to precision $\epsilon$, you rotate into each one's eigenbasis and spend $\mathcal{O}(1/\epsilon^2)$ shots there:
$$N_{\text{direct}} = \mathcal{O}\!\left(\frac{M}{\epsilon^2}\right)$$
Classical shadows measure in randomly chosen bases and reconstruct every observable from the same data. Each individual estimate is noisier — this chapter measured shadows as roughly 2.5× less accurate per observable — but every shot contributes to every estimate:
$$N_{\text{shadow}} = \mathcal{O}\!\left(\frac{\log M \cdot 3^{k}}{\epsilon^2}\right)$$
where $k$ is the observable's locality — the number of qubits it acts on non-trivially.
Two things follow, and they are the whole practical story:
The win grows with $M$ and is only logarithmic in it. Estimating 10 observables, shadows are barely worth it; estimating 1,000, they are transformative. That is why Chapter 36's chemistry Hamiltonians — 631 terms for LiH, 1,086 for H₂O — are the natural application.
The $3^k$ is brutal and is the catch. A weight-2 Pauli string costs $3^2 = 9$; a weight-10 string costs $3^{10} \approx 59{,}000$. Chapter 36 measured Jordan–Wigner producing Pauli weights with a long tail out to 12, and Bravyi–Kitaev capping at 10 — and that measurement, which looked like a footnote about circuit depth, is also the measurement that decides whether shadows are affordable.
📐 Math Aside: the locality dependence is not a limitation of the technique.
It is information-theoretic. A weight-$k$ observable is sensitive to correlations across $k$ qubits, and a randomly-chosen product basis agrees with the required basis on all $k$ of them only $3^{-k}$ of the time. The other measurements carry no information about that particular observable.
Derandomized and locally-biased shadow variants improve the constant by choosing bases that favour the observables you actually want — which is exactly the situation in chemistry, where the Hamiltonian is known in advance. They do not remove the exponent, and no method can, because the exponent is a property of the question rather than of the estimator.
The practical rule: shadows are for many low-weight observables. For a few high-weight ones, measure them directly.
The estimator itself: what a snapshot actually is
The formula above is a bound. The estimator underneath it is three lines of arithmetic, and writing it out explains both of this chapter's measured numbers.
Each shot picks a random Pauli basis $b_i \in \{X, Y, Z\}$ on each qubit independently, measures, and gets a bit $s_i$. The snapshot is not the bitstring — it is the operator
$$\hat{\rho} = \bigotimes_{i=1}^{n} \left(3\,|s_i\rangle\langle s_i| - I\right)$$
and the estimate of an observable $O$ is $\hat{o} = \mathrm{Tr}(O\hat{\rho})$, averaged over shots. The factor of 3 and the subtracted identity are the inverse of the depolarizing channel that random single-qubit Pauli measurement applies — they are what makes $\mathbb{E}[\hat\rho] = \rho$ exactly.
Now evaluate $\hat{o}$ for a single Pauli observable of weight $k$:
On the qubits where the random basis matched, $\mathrm{Tr}(P\,(3|s\rangle\langle s| - I)) = \pm 3$, because $|s\rangle$ is an eigenvector of $P$ and $\mathrm{Tr}(P) = 0$. On any qubit where it did not match, the trace is exactly zero.
So the single-shot estimator is a remarkable object:
$$\hat{o} = \begin{cases} \pm 3^{k} & \text{with probability } 3^{-k} \text{ (all $k$ bases matched)} \\ 0 & \text{otherwise}\end{cases}$$
It is zero almost all the time and enormous when it is not. For a weight-2 term like $Z_0Z_1$ it contributes $\pm 9$ on one shot in nine and nothing on the other eight. It is nevertheless unbiased — the $3^{-k}$ hit rate and the $3^k$ magnitude cancel exactly — and its variance is
$$\mathrm{Var}[\hat{o}] = 3^{-k}\cdot 3^{2k} - \langle O\rangle^2 = 3^{k} - \langle O\rangle^2$$
which is where the $3^k$ in the sample-complexity bound comes from. Not from a proof technique: from the estimator's own second moment.
📐 Math Aside: both of this chapter's measured ratios follow from that one variance.
Direct estimation of a Pauli observable averages $\pm 1$, so its single-shot variance is $1 - \langle O\rangle^2$. Shadows average the object above, so theirs is $3^k - \langle O\rangle^2$. Nothing else is needed.
§35.3's exact expectation values give both, per observable, for this chapter's 17-observable set — five weight-2 couplings and twelve weight-1 terms:
```text observable
Var direct Var shadow +0.9173 0.1586 8.1586 +0.8424 0.2904 8.2904 +0.5006 0.7494 2.7494 +0.2887 0.9167 2.9167 0.0000 1.0000 3.0000 mean single-shot sd over all 17: direct 0.8152 shadow 2.0508 ```
The chapter reports mean absolute error across observables, so combine the standard deviations the same way — as a mean, not in quadrature.
Equal shots per observable. Both methods get $N$ shots per estimate, so the error ratio is just the ratio of the mean standard deviations:
$$\frac{2.0508}{0.8152} = 2.516$$
Measured: 2.7×, 2.5×, 2.3× at 1,000 / 5,000 / 20,000 shots.
Equal total budget $B$. Direct estimation splits it, so each observable gets $B/17$ and its error grows by $\sqrt{17}$. Shadows put all $B$ on one record:
$$\frac{0.8152 \times \sqrt{17}}{2.0508} = 1.639$$
Measured: 1.50×, 1.65×, 1.80× — and 1.65 is exactly the middle budget.
Breakeven. Shadows win when the per-observable penalty is smaller than $\sqrt{M}$, so $M^{*} = 2.516^2 = \mathbf{6.33}$ observables. The book has been stating the crossover as "around four to eight" from measurement; this derives it.
Two independently measured ratios and a measured crossover, all three predicted by a single second-moment calculation. That is what it looks like when you understand a result rather than having observed it.
Median of means, and why this chapter's own code did not use it
The Huang–Kueng–Preskill estimator is not the plain average of the snapshots. It is a median of means: split the $N$ snapshots into $K$ equal bins, average within each bin, and take the median of the $K$ bin averages.
The reason is the $\log M$ in the sample-complexity bound, and it is worth being precise about where that term comes from, because it is easy to attribute it to the random measurement.
It comes from the estimator, not the measurement. You need all $M$ estimates to be accurate simultaneously, at confidence $1 - \delta$. With a plain mean you have only the variance to work with, so Chebyshev gives a failure probability that shrinks as $1/K$ and a union bound over $M$ observables costs a factor $M/\delta$ in shots. Median of means converts that into exponential concentration — the median is wrong only if more than half the bins are wrong, and the bins are independent — so $K = \mathcal{O}(\log(M/\delta))$ bins suffice. The $\log M$ that makes shadows scale is a property of the median, and the $3^k$ is a property of the snapshot.
Which raises an obvious question about this chapter's own measurement, since example-02 calls
est = np.array([shadow.expval(o, k=1) for o in OBSERVABLES])
and k is the number of median-of-means bins. k=1 is the plain mean. The measured 1.65× win was
obtained without median of means at all.
That is not an error, and PennyLane's own documentation says why: "For the case of Pauli measurements
and Pauli observables, there is no advantage expected from setting k>1." Measuring it directly, at
900 snapshots and 600 independent records, on the $\langle Z_0Z_1\rangle$ term:
estimator mean |err| ratio 99th pct |err|
k = 1 (plain mean) 0.0773 1.000 0.2424
k = 3 (median of 3) 0.0892 1.154 0.2676
k = 9 (median of 9) 0.1009 1.304 0.3276
★ Median of means is 30% worse here, and worse in the tail too. The 99th percentile — the quantity median of means exists to control — also degrades.
The ratio is not arbitrary. The median of $K$ independent sample means has asymptotic variance $\pi/2$ times the variance of their average, so the predicted penalty is $\sqrt{\pi/2} = 1.253$. Measured 1.304 at $K = 9$, where the asymptotic is only approximate.
The reconciliation is that median of means buys a worst-case guarantee and charges an average-case price. With Pauli measurements of Pauli observables the snapshot is bounded by $3^k$, so at 900 shots the sample mean is already close to Gaussian and there is no heavy tail left to protect against. The construction earns its keep where the estimator is genuinely heavy-tailed — shadows with random Clifford measurements, or observables of high operator norm — and costs you $\sqrt{\pi/2}$ everywhere else.
So the theoretical guarantee and the practical estimator are answering different questions, which is worth knowing before quoting the bound as though it described the code.
🐛 Debug This: your shadow estimate of a Pauli observable came back as 2.16.
A Pauli expectation value lives in $[-1, +1]$. An estimate outside that range looks like a bug, and teams spend real time hunting for one.
It is not a bug. The estimator is unbounded. Each snapshot contributes $0$ or $\pm 3^k$, so a short record can average to anything up to $3^k$. Measured on this chapter's state — 50 snapshots per record, 200 independent records, estimating $\langle Z_0 Z_1 \rangle$ whose exact value is $+0.8424$:
text estimates outside [-1, +1]: 65 of 200 (32.5%) minimum -0.1800 maximum +2.1600 mean +0.8325A third of short records produce an impossible number, and the mean of all of them is right to three decimal places. The estimator is unbiased, not bounded, and those are different properties.
Three real fixes, and one that is not:
- Take more snapshots. The excursion shrinks as $1/\sqrt{N}$ like everything else.
- Report the estimate with its standard error, so an out-of-range value is visibly one draw from a wide distribution rather than a claim.
- Do not clip to $[-1, 1]$. Clipping is the tempting fix and it introduces bias — precisely toward whatever the true value is not. If you clip, you can no longer average records and get the right answer, which is the one property the estimator has.
- Median of means will not fix it either: the measurement above shows $K = 9$ making the 99th percentile worse, not better.
Derandomized and locally-biased shadows, and what they give up
The $3^{-k}$ hit rate is wasteful in an obvious way: if you already know which observables you want, most of your random bases are measuring nothing relevant. Two families of variant exploit that.
Locally-biased shadows keep the randomness but tilt the per-qubit distribution away from uniform $(\tfrac13, \tfrac13, \tfrac13)$ toward the bases your observable set needs. The estimator stays unbiased — the inverse channel is re-derived for the new distribution — and the variance drops for the targeted observables while rising for everything else.
Derandomized shadows go further and drop the randomness entirely, choosing each measurement basis greedily to minimize a confidence bound over the target set. The hit rate for the observables you named approaches 1.
Both are the right tool when the Hamiltonian is fixed and known — which is Chapter 36's chemistry exactly. But notice the trade, because it is the same trade this chapter keeps finding:
They require the observable list in advance, and that is the property shadows were selling. The appeal of §35.5's construction is that you measure the state and interrogate the record afterwards — including for questions you had not thought of when you ran the experiment. Derandomization converts that back into a measurement of a specified list, which is what direct estimation already was.
So the variants are a better direct estimation rather than a better shadow. They are worth using; they are not worth confusing with the thing they optimize away. And as the earlier Math Aside notes, none of them removes the $3^k$ — the exponent is a property of the question, and improving the constant is all that is on offer.
📉 Noise Report: readout error biases shadows by exactly as much as it biases direct estimation.
This is worth measuring rather than assuming, because the $3\,|s\rangle\langle s| - I$ reconstruction multiplies every bit by three and it is natural to expect it to multiply the error too.
It does not. With independent bit flips at rate $p$, a measured Pauli expectation of weight $k$ is scaled by $(1 - 2p)^k$ — the same factor for both methods, because both estimators are linear in the same corrupted bits. Simulating flips directly on the measurement record, 40,000 shots × 8 records:
text flip p method <Z0 Z1> (1-2p)^2 x exact <X0> (1-2p) x exact 0.00 shadow +0.8459 +0.8424 +0.5014 +0.5006 0.00 direct +0.8420 +0.8424 +0.5010 +0.5006 0.01 shadow +0.8048 +0.8090 +0.4936 +0.4906 0.01 direct +0.8093 +0.8090 +0.4916 +0.4906 0.05 shadow +0.6895 +0.6823 +0.4409 +0.4506 0.05 direct +0.6819 +0.6823 +0.4496 +0.4506Both track $(1-2p)^k$, and neither is systematically worse than the other.
The exponent is the thing to worry about, not the method. At a 1% flip rate:
text weight k (1-2p)^k bias 1 0.9800 2.0% 2 0.9604 4.0% 6 0.8858 11.4% 10 0.8171 18.3%Chapter 36 measured Jordan–Wigner Pauli weights running out to 12 for LiH, so an unmitigated chemistry estimate loses over a fifth of its magnitude to readout error alone. The fix is Chapter 13's assignment matrix, which applies to shadow snapshots as readily as to direct measurements — "robust shadows" is the calibrated version — and Chapter 13 measured readout mitigation removing 64% of the error for 16 extra circuits.
What noise does do differently to shadows is cost you shots, not accuracy: the $3^k$ variance means you need more of them to resolve a bias of a given size, so the same noise floor takes longer to reach.
🗝️ Version Note: the PennyLane 0.45.1 shadow API, and the argument that matters.
python qml.classical_shadow(wires, seed=None) # a measurement process qml.shadow_expval(H, k=1, seed=None) # QNode-level, one step qml.ClassicalShadow(bits, recipes).expval(H, k=1) # post-hoc, from a stored recordThree things to know:
kdefaults to 1, which is the plain mean, not median of means. If you are quoting the Huang–Kueng–Preskill bound alongside your numbers, you are quoting a bound for a different estimator. The measurement above says that is fine for Pauli observables, and says why.
ClassicalShadowtakesbitsandrecipesseparately, which is the whole point: the record is two integer arrays you can serialize, archive, and re-query months later for observables you had not thought of. Chapter 39 §39.8's metadata discipline applies with extra force here, because the record is only re-queryable if you also stored the qubit ordering and the basis convention.
qml.shadow_expvalcomputes inside the QNode and does not hand you the record. It is the convenient call and it discards exactly the thing that makes shadows worth using. Use it for a one-shot estimate; useclassical_shadowwhen the point is to keep the data.🔀 In Another Framework: Qiskit 2.5.1 has no shadow primitive at all.
Searched: no name containing "shadow" exists in
qiskit.primitivesorqiskit.quantum_info. Classical shadows are a PennyLane-native convenience, and in Qiskit you build the pieces yourself:
text step PennyLane Qiskit 2.5.1 random basis choice automatic in your own RNG over qml.classical_shadow {H, S-dagger H, I} per qubit execution one QNode call SamplerV2 over a batch of basis-rotated circuits reconstruction ClassicalShadow.expval your own 3|s><s| - I product storage bits + recipes arrays BitArray + your basis logThe build is perhaps forty lines and worth doing once, because it forces you to write down the inverse channel and therefore to see the $3^k$.
The Qiskit-native alternative is a different technique:
EstimatorV2accepts a list of observables and groups commuting terms behind the scenes, which is Chapter 24 §24.3's ~100× on chemistry Hamiltonians. Grouping and shadows solve the same problem by opposite routes — grouping finds the observables that can share a basis exactly, shadows accept a random basis and pay $3^k$ for the mismatch. Grouping wins when the terms commute nicely and you know them in advance; shadows win when they do not, or when you do not.
Where the input is unavoidably quantum: sensing and metrology
One more setting deserves naming, because it is §35.3's third category in its purest form and it is the only place in this book where the $1/\sqrt{N}$ that governs everything else is beaten.
A quantum sensor's state is the data. An atomic interferometer, a magnetometer, an optical clock:
the physical quantity you want has been imprinted as a phase on a quantum state, and there is no
classical description of that state anywhere — it was never simulated, never loaded, and cannot be
handed to sklearn because it does not exist as numbers until you measure it. Chapter 32's input
problem is not merely avoided here; it is unintelligible.
The scaling argument is the one this book has met repeatedly, running the other way. Measuring a phase $\phi$ with $N$ independent probes gives the standard quantum limit $\Delta\phi \sim 1/\sqrt{N}$ — the same shot noise as Chapter 27's $3/\sqrt{N}$ total-variation floor and §35.5's $\sqrt{17}$ splitting penalty. Entangling the $N$ probes gives the Heisenberg limit, $\Delta\phi \sim 1/N$.
That is a quadratic improvement, and it is worth noticing it is the same quadratic as Grover's (Chapter 21) — $\sqrt{N}$ appears in both because both are asking a $1/\sqrt{N}$ statistical process to behave like a $1/N$ deterministic one. The book's recurring observation applies: every remedy is denominated in the currency of the disease. A quadratic buys a constant-factor-squared, not an exponent, and Chapter 21 §21.7 priced exactly what that is worth.
And the honest caveat is the same one as everywhere else in this book: decoherence. Entangled probe states are more fragile in proportion to their advantage, and the standard result in the metrology literature is that under realistic dephasing the $1/N$ scaling is restored to $1/\sqrt{N}$ with a better constant. Not a repeal of the advantage — a demotion of it from an exponent to a constant, which is Chapter 13's verdict on error mitigation almost word for word.
Still: this is a real deployed technology, and it is the clearest case of quantum data in existence. Part VI's argument survives here for the same reason it survives at 50 qubits — because there is no classical alternative to run.
Where the comparison would flip back
The equal-budget framing decided this chapter's result, so it is worth stating precisely when the opposite conclusion is the correct one:
When you want one observable. $M = 1$ makes $\log M = 0$ and the whole advantage disappears. Direct estimation wins, by the 2.5× per-observable accuracy factor.
When the observables are high-weight. Past $k \approx 6$ the $3^k$ dominates any plausible $\log M$.
When you know which observables you want in advance and they are few. Grouping commuting terms (Chapter 24 §24.3) is a better tool for that case — it is a constant factor of roughly 100× on chemistry Hamiltonians and it does not pay a locality penalty.
When the state is expensive to prepare. Shadows need many independent copies. If state preparation dominates the shot cost — which is Chapter 32's input problem in another guise — the measurement strategy is not where your budget is going.
⚠️ Common Pitfall: the budget you are comparing at is a choice, and it is the whole result.
This chapter's first version gave direct estimation the same shots per observable as shadows, silently handing it 17× the total budget, and concluded that shadows lose. Fixing the budget inverted the conclusion.
The general form: when comparing two randomized algorithms, fix the resource and vary the method. Chapter 37 §37.5 hit exactly this with QAOA and Goemans–Williamson — both are randomized algorithms that sample and take the best, and giving one many samples and the other a single rounding produces whatever answer you like.
The question to ask of any sampling comparison: what was held constant? If the answer is "the thing that favours the method being advocated," the comparison is decorative.
35.6 The hybrid loop in production
Three architectural facts that only appear when something is deployed, and that no chapter of Part VI has needed until now.
The round trip is the bottleneck, not the circuit. A variational step is: submit, queue, execute, return, compute an update, submit again. Chapter 31 measured the circuit itself at 7.10 μs. Queue and network latency on a shared device are measured in seconds. The quantum computer is idle for essentially the entire optimization.
That is why every serious hybrid runtime — Qiskit Runtime and its equivalents — moves the classical update next to the quantum device, so the loop closes without a round trip per iteration. It is an architectural fix to a latency problem, and it changes nothing about the shot budget.
Batching is not optional. Chapter 33 §33.3 and Chapter 34 §34.2 both hit ~500× speedups from submitting many circuits at once instead of looping. On hardware this is the difference between one job and forty thousand.
And the inference bill from Chapter 33 §33.6 does not go away. A deployed hybrid model pays a shot budget per prediction, forever — 27.8 QPU-hours per million predictions at 1,000 shots. Quantum data changes the input cost; it does not change the measurement cost.
💰 Cost and Queue: the latency is the architecture.
Chapter 39 measured a 4,096-shot job occupying a device for 6.92 ms and a five-minute queue giving a utilization of $2.31\times10^{-5}$. A hybrid loop makes that ratio worse in the most direct way possible: it pays the queue once per iteration.
text 120 iterations, 5-minute queue, 6.92 ms per job as 120 separate jobs: 10.0 hours waiting, 0.83 s computing inside one session: 0.1 hours waiting, 0.83 s computingThe same computation, two orders of magnitude apart in wall clock, decided entirely by an execution-mode flag.
This is why the primitives layer has
Sessionat all, and why Chapter 39 §39.9's second recommendation is count jobs before counting gates. A team optimizing their ansatz depth while submitting 120 separate jobs is optimizing the 6.92 ms and ignoring the ten hours.And note that none of this is a quantum problem. It is scheduling, and Chapter 40 §40.1 lists it among the field's largest employment categories for exactly that reason.
The three places a hybrid boundary can sit
"Hybrid" describes almost every algorithm in Parts IV–VII, which makes it nearly contentless as a term. It becomes useful once you ask where the boundary is drawn, because the three answers have completely different cost structures.
1. Per-shot. The quantum device produces samples; classical code post-processes them. Readout mitigation (Chapter 13), classical shadows (§35.5), and Chapter 37's QAOA sampling all sit here. The classical side is cheap and the boundary is crossed once per job. This is the well-behaved case.
2. Per-iteration. The classical optimizer proposes parameters, the device evaluates, repeat. VQE and QAOA training sit here. The boundary is crossed hundreds of times and each crossing costs a queue wait — which is the arithmetic above, and the reason sessions exist.
3. Per-gate. Classical logic inside the circuit, deciding later operations from earlier measurement outcomes. Teleportation, repeat-until-success, and error-correction decoding sit here. The boundary is crossed inside the coherence time, so the classical computation must finish in microseconds — which is why real-time decoding is a hard systems problem and, per Chapter 40 §40.1, one of the field's highest-demand skills.
The cost of a crossing spans roughly twelve orders of magnitude across those three, from microseconds to minutes. A design that moves work from category 2 to category 1 is usually a bigger win than any circuit optimization — which is what warm-starting QAOA from a classical solution (Chapter 37 §37.9) actually accomplishes, and it is worth noticing that its concession is starting from the classical answer.
Circuit knitting: the same boundary, drawn through the circuit
The three placements above all cut the boundary around the circuit. Circuit knitting cuts it through the middle.
The problem it addresses is width, not depth: your circuit needs more qubits than the device has, or more connectivity than the coupling map provides. Knitting cuts a two-qubit gate — or a wire — and replaces it with a sum over local operations on each side, executed as separate circuits and recombined classically. The pieces fit the device; the classical post-processing puts the answer back together.
The mechanism is exactly Chapter 13's PEC, and recognizing that is the useful part. Both express an operation you cannot perform as a signed combination of operations you can, sample from the resulting quasi-probability distribution, and reweight. Both are therefore unbiased and exact, and both pay a sampling overhead that is exponential in the number of decompositions — $\gamma^{2d}$ in depth for PEC, and the same shape in the number of cuts for knitting.
So the trade is the book's recurring one, in its cleanest form:
knitting converts a WIDTH problem you cannot solve
into a SHOT-COUNT problem you can pay for
at a price of exponential in the number of cuts
A width you do not have becomes shots you must buy. That is a genuinely useful transformation when the cut count is small — two or three cuts on an otherwise-fitting circuit — and it is worthless when it is not, because "exponential in cuts" reaches Chapter 36's $10^{20}$-shot territory quickly.
And it does not move the classical-simulation boundary. A circuit that needs $k$ cuts to fit is paying an exponential in $k$ to be run; a classical simulator that needs to hold $2^n$ amplitudes is paying an exponential in $n$. Knitting trades one exponential for a smaller one when $k \ll n$, which is real engineering value and is not an advantage argument. §35.4's dilemma is untouched — a knitted result above the boundary is exactly as unverifiable as an unknitted one.
Error mitigation is a hybrid boundary nobody calls hybrid
Worth stating explicitly, because the term "hybrid" is almost always reserved for variational loops and the largest classical component in most quantum workflows is not one.
Chapter 13's entire toolkit is classical post-processing sitting in category 1 of the taxonomy above:
technique the quantum part the CLASSICAL part
readout mitigation 2^n calibration circuits invert a 2^n x 2^n stochastic matrix
ZNE run at 3-5 noise scales fit a curve, extrapolate to zero
PEC sample a quasi-prob. re-weight signed samples
twirling random Pauli conjugation none -- it reshapes, not corrects
decoding (Ch.25) syndrome extraction a decoder, every cycle, in microseconds
Three things follow that a hybrid-architecture chapter should say out loud.
The classical side has its own exponential. Readout mitigation needs $2^n$ calibration circuits and a $2^n \times 2^n$ inversion — Chapter 13 measured $n = 20$ requiring 1,048,576 calibration circuits. The quantum side scaled fine; the classical post-processor is what died. "Move it to the classical computer" is not automatically a fix.
Classical post-processing steps do not commute. Chapter 13's headline result is an ordering effect: ZNE alone removed 14% of the error and 42% when it ran after readout mitigation — the same technique, same scales, same shots, 3× more effective from a reordering. That is a pipeline-design result, not a physics one, and it belongs in the same discussion as sessions and batching.
And classical post-processing can destroy a result. Chapter 13 measured readout mitigation making the answer worse on a qubit pair whose assignment matrix had condition number 2.05, and impossible on one with condition number $3.7 \times 10^{33}$ — a singular matrix, because the qubit was stuck and the information was gone. A classical step that amplifies noise is still a classical step. The per-crossing cost model in this section prices latency; it does not price a numerically unstable post-processor, and that is a second axis a real design has to check.
★ Add these up and the largest classical component of most quantum programs is not the optimizer. It is mitigation and decoding — and neither appears in the phrase "hybrid quantum-classical algorithm" as the field uses it.
Designing a hybrid system that is not stupid
Pulling the chapter's measurements into a design procedure, because "use a session" is not architecture.
Step 1 — Find where the boundary is crossed, and count the crossings. This is the single most consequential number in a hybrid design and it is rarely written down. Chapter 39's arithmetic: 120 iterations at a five-minute queue is 10 hours of waiting against 0.83 seconds of computing.
Step 2 — Move crossings up a category. From the three-category taxonomy above, every crossing you can push from per-iteration to per-shot is worth roughly the queue time. Concretely:
- Replace a gradient-descent loop with a precomputed angle schedule where the literature supplies one. Chapter 37 §37.9's QAOA angle-transfer results are exactly this, and they remove the optimization loop entirely.
- Warm-start from a classical solution so fewer iterations are needed — conceding, as Chapter 37 notes, that you started from the classical answer.
- Batch independent evaluations. A gradient needs $2p+1$ circuit evaluations that do not depend on each other, so they belong in one job rather than $2p+1$ jobs.
Step 3 — Price the measurement strategy, not just the circuit. §35.5's shadows-versus-direct question is a measurement-strategy question, and Chapter 36's chemistry Hamiltonians make it the dominant cost. Grouping commuting terms (Chapter 24 §24.3) is worth ~100× on chemistry and pays no locality penalty; shadows are worth $\log M$ against $3^k$. Choose deliberately; the default is neither.
Step 4 — Decide what the system produces. Chapter 37 §37.7's question, applied to your own design. If your pipeline emits a number with no error estimate and no bound, you have built something whose output cannot be checked — and Chapter 39 §39.8's reproducibility problem then applies on top.
Step 5 — Record the metadata. Nine fields, Chapter 39 §39.8. A hybrid loop has more moving parts than a single circuit and correspondingly more ways to be irreproducible.
🔬 Honest Assessment: the best hybrid architecture is usually the one with the least quantum in it.
That is not a rhetorical flourish. Every measurement in this chapter points the same way:
- §35.4 — a classical model on the quantum states' measurement outcomes beat the quantum model.
- §35.5 — the shadows advantage is a classical post-processing result; the quantum part is randomized measurement.
- §35.6 — the dominant cost is queue latency, fixed by scheduling.
- Chapter 37 §37.9 — the most promising QAOA variant starts from the classical solution.
The pattern: the quantum component should be the smallest part of the system that does something classical methods cannot, and everything else should be classical because classical is faster, cheaper, checkable, and reproducible.
A design where the quantum processor does more is not a better design. It is usually a more expensive one, and Chapter 39 priced the difference at up to 3,718×.
35.7 What Part VI adds up to
Four chapters, and the results are consistent enough to state as one finding.
Ch. 32 QML fundamentals input problem: O(N) gates per sample, per epoch
VQC 20,000x slower than LogReg, same accuracy
training: 2.06e9 shots = 2.38 QPU-days
Ch. 33 classifiers data re-uploading: 1 qubit, 6 params -- genuinely elegant
kNN beats it by +0.0626 +/- 0.0067
ties with LOGISTIC REGRESSION
inference: 27.8 QPU-hours per million, forever
Ch. 34 kernels training is CONVEX -- a real structural advantage
SVC(rbf) beats it by +0.0576 +/- 0.0083, same solver
Gram matrix: 38.6 QPU-days at 10 qubits
Ch. 35 quantum data encoding cost is ZERO -- the claim is true
and sklearn still wins at checkable scale
No quantum model in Part VI beat a tuned classical baseline on any dataset. Three of the four tied with logistic regression.
That is the honest summary, and three things should be said alongside it.
The techniques are real and some are elegant. Data re-uploading's single-qubit universality is a genuinely surprising result. The kernel formulation's convexity is a complete solution to a problem that dominates Chapters 32 and 33. Classical shadows are a beautiful and practical primitive. None of these depend on quantum machine learning being useful to be worth knowing.
The negative results are the field's most valuable output. Barren plateaus, the input problem, concentration, and dequantization were all discovered by people trying to make QML work, and they are now among the sharpest tools quantum computing has for evaluating any proposal. A field that produces impossibility results is doing science.
And the quantum-data case survives the scaling. Every other obstacle in Part VI gets worse with size. This one gets better, because the classical alternative disappears. If a practical quantum machine learning advantage is demonstrated, current evidence points here — to states that cannot be written down, measured by shadows, classified by circuits that never had to load anything.
Part VII turns to applications and the career, where the same standard applies to chemistry, optimization, finance, and cryptography — and where one of those has an algorithm that clears it.
Part VI as a research programme, not a verdict
The scorecard reads as four losses, and that framing undersells what the four chapters established.
What was ruled out, and this is genuine progress:
- Amplitude encoding as a route to advantage. Chapter 32's $N - \log_2 N - 1$ is not a bad implementation; it is the cost of writing $N$ numbers into a state. Any proposal whose speedup comes from "exponentially compact encoding" has to answer it, and most do not.
- Width as the path to expressibility. Chapter 33's single qubit matched a four-qubit model. Depth and data re-uploading do the work; adding qubits does not.
- Quantum kernels as a general improvement. Chapter 34 measured concentration driven by feature dimension, and feature-map tuning mattering more than the quantum/classical distinction.
- Measurement-outcome pipelines on quantum data. Chapter 35's
SVC(rbf)beat the quantum model on the states the quantum model produced.
What survived:
- Learning from quantum data processed coherently. Proven separations, hardware demonstrations, and no known dequantization.
- Classical shadows. The one technique in this book that attacks Chapter 24's shot budget from the estimates-per-shot side instead of fighting $1/\epsilon^2$ head-on.
- The negative results themselves, which are what let a practitioner say which proposals are dead rather than being vaguely sceptical of all of them.
🔬 Honest Assessment: a field that can say what does not work is functioning.
Four chapters, four honest comparisons, zero quantum wins — and every obstacle identified is specific: the input problem, barren plateaus, kernel concentration, dequantization, and the simulation boundary. None is "quantum computing does not work." Each is a named mechanism with a measurement attached and, in several cases, a stated condition under which it would not apply.
Compare a field that reports only positive results. It would have four more successes and no idea which direction to go next.
The literature of QML is largely negative results published by people trying to make it work, and that is the strongest available evidence that the field is doing science rather than marketing. Chapter 40 §40.6 makes it a hiring criterion: ask what the team's most interesting negative result was, and listen for whether the answer is immediate.
What we measured
- Quantum data costs zero encoding gates, against Chapter 32's 57 two-qubit gates per sample per epoch for the same 64 amplitudes. The input problem is a statement about classical data.
- A 36-parameter classifier on TFIM ground states reaches 1.0000 train / 0.6429 test across the critical point — perfect separation, poor generalization, and both worth reporting.
- ★★★
SVC(rbf)on the same states' measurement probabilities scores 0.7857 — better than the quantum classifier, and using less information (probabilities beat full amplitudes, 0.7857 against 0.5714). - A 6-qubit state is 128 real numbers. The advantage exists only where $2^n$ is too large to write down — the same boundary as every other chapter in this book.
- ★ Classical shadows are ~2.5× less accurate per observable but win at equal total budget, by 1.4–1.8× across three budgets — because splitting a budget 17 ways costs $\sqrt{17} = 4.1×$.
- ★★ Both of those ratios follow from one variance. The single-snapshot estimator is $0$ or $\pm 3^k$, so $\mathrm{Var} = 3^k - \langle O\rangle^2$ against direct estimation's $1 - \langle O\rangle^2$. From the exact expectation values that predicts 2.516× per observable (measured 2.7 / 2.5 / 2.3), 1.639× at equal budget (measured 1.50 / 1.65 / 1.80), and a breakeven at 6.33 observables — the "four to eight" crossover, derived.
- ★ Median of means made the estimate 30% worse, not better — 0.0773 → 0.1009 mean absolute error at $K = 9$, and the 99th percentile degraded too. The predicted penalty for a bounded estimator is $\sqrt{\pi/2} = 1.253$; measured 1.304. The $\log M$ in the shadow bound is a property of the median, and this chapter's own measurement used the plain mean.
- Every accuracy in §35.4's table is a fraction over 14. 0.7857 against 0.6429 is two test states, worth 0.85 standard errors, with an exact paired $p \ge 0.50$ under every consistent split. The conclusion that survives is "the quantum model did not win," not "SVC is 0.14 better."
- The same 64-amplitude state preparation costs 57 two-qubit gates in Qiskit and 124 in PennyLane — so the cost quantum data avoids is framework-dependent, and the formula is the tighter of the two.
- Readout error biases shadows and direct estimation identically, both by $(1-2p)^k$ — at a 1% flip rate that is 4.0% at weight 2 and 18.3% at weight 10, which is Chapter 36's LiH Pauli weights.
- Part VI overall: no quantum model beat a tuned classical baseline on any dataset, and three of four tied with logistic regression.
The theme: the encoding cost vanishes for quantum data, and so does the classical alternative — but only above the scale where you can check either.