Chapter 33 — Key Takeaways (Quantum Classifiers)

Chapter 32 gave a checklist. This chapter builds classifiers against it, and the second result corrects the first.

★ First, a dataset that can distinguish anything

   dataset                 LogReg     SVC      RF     kNN   informative?
   moons (noise 0.10)       0.859   0.990   0.990   1.000   no (all perfect)
   moons (noise 0.30)       0.768   0.879   0.919   0.949   YES
   circles (noise 0.20)     0.465   0.859   0.808   0.828   YES

Moons at noise 0.30: 201 train / 99 test, and a classical spread of 0.768 to 0.949. LogisticRegression is linear and moons is not, so it underperforms kNN by 0.1818that gap is what a quantum model would have to close to mean anything.

⚠️ Choose the dataset before building the model, and check the baseline first. Chapter 32's iris had all three baselines at 1.0000, so no result there could be distinguished from any other.

★ Data re-uploading: one qubit as a universal classifier

@qml.qnode(dev)                    # ONE qubit
def reupload(x, w):
    for layer in w:
        qml.RY(x[..., 0], wires=0)          # inject feature 0
        qml.RZ(x[..., 1], wires=0)          # inject feature 1
        qml.Rot(layer[0], layer[1], layer[2], wires=0)   # trainable
    return qml.expval(qml.PauliZ(0))

⚛️ Why re-uploading buys expressibility on one qubit. Encoding once gives a simple function of the data, and trainable rotations afterwards cannot change that. Re-injecting INTERLEAVES the data with the trainable operations — the nesting a neural network's alternating layers provide.

Pérez-Salinas et al. (2020) prove universality: with enough layers, one qubit approximates any bounded continuous function. Width is not what limits expressibility — DEPTH is.

The single split

   model                                   params   qubits   train s    test
   data re-uploading, 1 QUBIT, 2 layers         6        1       0.3   0.9091
   data re-uploading, 1 QUBIT, 8 layers        24        1       0.7   0.9091
   VQC, 4 qubits, 2 layers                     24        4       0.8   0.7778
   VQC, 4 qubits, 4 layers                     48        4       1.5   0.8788

One qubit with six parameters, 0.9091. Four qubits with twenty-four, 0.7778.

★★★ And then ten splits

   model                          mean      std     min     max
   kNN                          0.8970   0.0377  0.8283  0.9495
   SVC                          0.8889   0.0310  0.8283  0.9394
   LogReg                       0.8414   0.0463  0.7677  0.9091
   1-qubit reupload (2L)        0.8343   0.0407  0.7677  0.9091
   4-qubit VQC (2L)             0.8142   0.0336  0.7778  0.8889

   1-qubit - 4-qubit VQC  = +0.0202 +/- 0.0170   NOT SIGNIFICANT

The 0.13 gap becomes $+0.0202 \pm 0.0170$. And the mechanism is in the min/max columns:

   1-qubit on split 0:  0.9091  =  its MAXIMUM over ten splits
   4-qubit on split 0:  0.7778  =  its MINIMUM over ten splits

🔬 A result from one split is a draw from a distribution, not a measurement. With standard deviations near 0.04, a 0.13 difference between two single draws is unremarkable — and looks large.

Third instance in this book: Ch. 27's 2/200 estimating a 0.15% rate; Ch. 28's two circuits agreeing on optimization levels; now this. The fix each time: run it again.

What survived

Indistinguishable accuracy at a quarter of the parameters and a quarter of the qubits. On hardware where qubits are scarce and two-qubit gates dominate the error budget (Ch. 12, 29, 31), that is exactly the trade you want — a weaker claim than "one qubit beats four," fully supported, and more useful because it is about resources.

★★ The classical bar

   kNN    - 1-qubit reupload = +0.0626 +/- 0.0067   SIGNIFICANT (9 sigma)
   LogReg - 1-qubit reupload = +0.0071 +/- 0.0186   NOT SIGNIFICANT

kNN wins decisively, on a dataset chosen to leave room.

And the "universal classifier" is statistically indistinguishable from LOGISTIC REGRESSION — a linear model, on a problem that is not linearly separable, which is why LogReg underperforms kNN.

Expressibility is necessary and not sufficient. The universality theorem is about what is representable with enough layers, not about what sixty Adam steps finds. Ch. 16 §16.6 made the same point from trainability; Ch. 29 §29.6 from hardware.

★ The decision rule at finite shots

The rule is $\text{sign}\langle Z\rangle$, so measure the margin distribution first:

   |<Z>| over the 99 test points:  p0 0.0159  p50 0.6281  p100 0.9891
   points with |<Z>| < 0.05:  1 of 99
       shots   mean acc      std    worst   flips vs exact
         100     0.9051   0.0112   0.8788              1.8
       1,000     0.9101   0.0044   0.8990              0.2
      10,000     0.9091   0.0000   0.9091              0.0
       exact     0.9091   0.0000   0.9091              0.0

1,000 shots suffices here, and 100 costs only 0.4% on average — though its worst run lost 3%.

⚠️ That is a property of THIS DATA, not of the method. The penalty scales with how many points sit near the boundary. Measure the margins; do not inherit a shot count from a tutorial.

★★ The inference bill

   shots/prediction    QPU hours per MILLION predictions
                100                                  2.8
              1,000                                 27.8
             10,000                                277.8
   kNN.predict on 1,000,000 points:     1.1 SECONDS on a laptop
   quantum, at 1,000 shots each:       27.8 QPU HOURS        (~90,000x)

🔬 Training cost is the number QML papers omit. Inference cost is the number nobody computes at all.

Chapter 32's 2.38 QPU-days was one-time. This is recurring, and for any deployed model it dominates lifetime cost by orders of magnitude.

A quantum classifier is not a model you train once and run cheaply. Every prediction is a circuit execution with a shot budget.

What is actually established

  • Data re-uploading is real and elegant — one qubit, six parameters, a non-linear boundary, proven universality. Circuit width is not what limits expressibility.
  • It is significantly cheaper than the multi-qubit alternative: a quarter of everything, indistinguishable accuracy. On current hardware that is the trade you want.
  • It does not beat classical methods. kNN by $+0.0626 \pm 0.0067$, and it ties with logistic regression on a problem LogReg is structurally wrong for.
  • The costs are not comparable. Milliseconds against QPU-days to train; 1.1 seconds against 27.8 QPU-hours per million to predict.

Common pitfalls

  • Reporting a single split as a comparison.
  • Not checking whether the headline split is an extreme (min/max takes one line).
  • Re-splitting one dataset instead of generating independent ones.
  • Reading a universality theorem as a statement about what training finds.
  • Inheriting a shot count instead of deriving it from the margin distribution.
  • Computing the training bill and stopping.
  • Never measuring the incumbent.

Project piece added this chapter

vqelab/classifiers.pycompare_models returning INSUFFICIENT_REPLICATES for fewer than five independent splits, quoting what replication showed; margin_profile and shots_for_decision, which derives the shot count from measured margins; training_cost and inference_cost; and ClassifierReport.deployable_claim_supported, which is False without an inference bill and says which piece is missing. 20 tests pass, including test_compare_models_REFUSES_a_single_split, test_the_single_split_result_does_not_replicate, test_the_universal_classifier_ties_with_LOGISTIC_REGRESSION, and test_a_deployable_claim_needs_the_INFERENCE_bill.