Strip away the vocabulary and a quantum classifier has the same shape as any other machine learning model: settings, a prediction, a score, and a rule for adjusting the settings.
- fixed by the data
- trained by the optimizer
Making a prediction
Load. Your data goes in through the feature map from the last lesson.
Mix. A series of adjustable rotations, with entangling gates between them. The rotation angles are the model's settings — the equivalent of weights in a neural network.
Look. Measure one qubit and average over many runs. That number is your prediction.
That is the entire model. Numbers in, one number out, with dials in the middle that decide how the one relates to the other.
How the dials get tuned
Ordinary neural networks are trained by backpropagation — running the network backwards to see how each weight affected the answer.
You cannot do that here. There are no intermediate values to look at, because looking at them would destroy the calculation.
Instead there is a rather beautiful trick called the parameter-shift rule. To find out which way to nudge a dial, run the whole circuit twice: once with that dial turned up a quarter turn, once turned down a quarter turn. Subtract the two scores. That difference is exactly the right answer — not an approximation.
Choosing the layout
The arrangement of the adjustable part is called the ansatz, and it is the main design decision.
Hardware-friendly layouts use whatever gates the chip does naturally. Shallow and runnable — and the most likely to hit the flat-score problem in the next lesson.
Problem-shaped layouts build in something you already know about the problem, like the structure of a molecule. Much easier to train, and deeper.
The tension never goes away: flexible enough to represent the answer, shallow enough to survive the noise, and structured enough to be trainable at all.
Worth remembering
- A quantum circuit with adjustable angles is a model, trained like any other.
- Load the data, apply adjustable rotations and entanglers, then measure.
- The parameter-shift rule gives exact gradients from two runs per dial.
- That costs far more than backpropagation, and it dominates training time.
- Layout design trades flexibility against depth and trainability.