Quantum machine learning asks whether quantum states, circuits and measurements can create useful learning models whose representation, optimisation or inference differs meaningfully from classical alternatives.
The subject is broad, so this guide keeps one clear owner: supervised learning with quantum feature maps, quantum kernels and variational quantum classifiers. It does not treat “machine learning” as a synonym for generic variational circuits, nor does it assume a speedup simply because data are placed inside a quantum state.
The central mathematical objects are familiar from classical learning. A feature map embeds input x into a representation space. A kernel compares two embedded inputs. A classifier combines those similarities or trains circuit parameters against labelled data. The quantum difference is that the representation can be a state |φ(x)⟩ in a Hilbert space too large to write explicitly, while the relevant inner products or expectation values are estimated by quantum circuits.
Classical data → quantum feature map → Hilbert-space geometry → kernel or trainable circuit → classical loss → parameter update → held-out validation against classical baselines.
1. Supervised learning setup
Suppose the training set is
D={(x_i,y_i)}_{i=1}^N
with input xi and label yi.
A learning algorithm chooses a hypothesis f from some model class to minimise an empirical loss such as
L_train=(1/N)Σ_i ℓ(f(x_i),y_i).
The real goal is not low training loss. It is low expected loss on unseen data drawn from the same task distribution.
2. Quantum feature map
A quantum feature map prepares a normalised state
|φ(x)⟩=U_φ(x)|0…0⟩.
The input-dependent unitary Uφ(x) can contain single-qubit rotations, entangling gates and repeated nonlinear trigonometric dependence on components of x.
The quantum state defines a feature vector implicitly. For n qubits the state lives in dimension 2n, but one should not conclude that the model automatically has useful exponential expressive power: accessible observables, circuit depth and data structure constrain what is learnable.
3. Angle encoding
A simple encoding maps one real feature x to a qubit rotation
|φ(x)⟩=R_y(x)|0⟩.
Using
R_y(x)=exp(−ixY/2),
the state is
cos(x/2)|0⟩+sin(x/2)|1⟩.
Nearby x values have large overlap; distant angles may become nearly orthogonal.
4. Quantum kernel
A pure-state quantum kernel can be defined as
K(x,x’)=|⟨φ(x)|φ(x’)⟩|².
It lies between 0 and 1.
Other valid quantum kernels use the unsquared inner product, Hilbert–Schmidt overlaps of density matrices or expectation values of feature-space observables. The exact kernel must be stated because its geometry changes the learning problem.
5. Worked one-qubit kernel
For angle encoding |φ(x)⟩=Ry(x)|0⟩,
⟨φ(x)|φ(x')⟩=cos[(x−x')/2].
Therefore
K(x,x’)=cos²[(x−x’)/2].
If x−x’=π/3, then K=cos²(π/6)=3/4.
The kernel is periodic, so x and x+2π encode the same state. Preprocessing must respect this periodicity rather than treating the map as globally one-to-one.
6. Kernel matrix
For N training points, define Gram matrix
K_ij=K(x_i,x_j).
A valid kernel matrix is positive semidefinite:
c†Kc≥0
for every complex vector c.
For the fidelity kernel, PSD follows because the squared overlap can be represented as an inner product between tensor-product feature vectors such as |φ(x)⟩⊗|φ(x)⟩*.
7. Kernel estimation circuit
Because
⟨0|U_φ(x)†U_φ(x')|0⟩=⟨φ(x)|φ(x')⟩,
one can estimate the fidelity kernel by preparing
U_φ(x)†U_φ(x')|0⟩
and measuring the probability of returning to |0…0⟩.
That all-zero probability equals |⟨φ(x)|φ(x’)⟩|² ideally.
8. Shot noise in kernel estimates
If K is estimated from M Bernoulli shots of the all-zero event,
Var(K̂)=K(1−K)/M≤1/(4M).
Every kernel-matrix entry is therefore noisy.
A full N×N training kernel contains O(N²) entries, so measurement cost can dominate even when each circuit is shallow.
Symmetry Kij=Kji halves duplicate work but not the quadratic scaling.
9. Noisy kernel matrices can lose PSD numerically
Finite-shot and hardware noise can produce an estimated matrix with small negative eigenvalues even if the exact kernel is PSD.
Possible responses include:
- increase shots;
- symmetrise K←(K+KT)/2;
- project onto the PSD cone;
- regularise K+λI;
- model the noise statistically inside the classifier.
Blindly zeroing negative eigenvalues changes the learned kernel and should be reported as part of the method.
10. Support-vector classification
Once K is available, a classical kernel machine can train exactly as it would for a classical kernel.
For a binary support-vector machine, the decision function has the form
f(x)=sign[Σ_i α_i y_i K(x_i,x)+b].
The quantum device supplies similarities; the convex optimisation is classical.
Havlíček and collaborators proposed quantum-enhanced feature spaces in this form and experimentally demonstrated small proof-of-principle classifiers. [1]
11. Feature-space geometry matters more than Hilbert-space dimension alone
A 2n-dimensional state space sounds enormous, but learning quality depends on the geometry induced on the actual data manifold.
Bad feature maps can make all training states nearly orthogonal, yielding a kernel matrix close to identity and poor generalisation.
Other maps can make all states nearly identical, producing a nearly rank-one kernel that cannot separate classes.
Useful learning needs an intermediate geometry aligned with the task.
12. Kernel concentration
For highly expressive random circuits, pairwise state fidelities can concentrate near typical values as qubit count grows.
If most off-diagonal Kij become almost equal, distinguishing examples requires many shots and the kernel can lose useful inductive bias.
More expressive feature circuits are therefore not automatically better.
13. Trainable quantum kernel
Introduce trainable parameters θ inside the feature map:
|φ_θ(x)⟩=U_φ(x,θ)|0⟩.
Then
K_θ(x,x')=|⟨φ_θ(x)|φ_θ(x')⟩|².
One can optimise θ using kernel-target alignment or validation loss.
This adds flexibility but also creates a nonconvex outer optimisation problem and a risk of overfitting the finite training set.
14. Variational quantum classifier
Instead of estimating pairwise kernels, prepare a data-encoded state and apply a trainable circuit U(θ):
|ψ(x,θ)⟩=U(θ)U_φ(x)|0⟩.
Measure observable O and define
f_θ(x)=⟨ψ(x,θ)|O|ψ(x,θ)⟩.
For binary labels one may predict sign[fθ(x)] or pass the expectation through a classical logistic function.
15. Parameter-shift gradients
If one trainable gate is
e^{-iθP/2}
with Pauli-type generator P satisfying P²=I, then for many expectation objectives
∂f/∂θ=[f(θ+π/2)−f(θ−π/2)]/2.
This exact parameter-shift identity replaces finite differences by two shifted circuit evaluations under its generator assumptions.
More general generators may require modified shift rules or linear-combination techniques.
16. Worked gradient example
Suppose a circuit expectation gives
f(θ+π/2)=0.62;f(θ−π/2)=0.18.
Then
∂f/∂θ=(0.62−0.18)/2=0.22.
If the loss derivative with respect to f is −0.4, the chain-rule contribution to ∂L/∂θ is −0.088.
17. Data re-uploading
A shallow circuit can encode x repeatedly between trainable blocks:
U(θ_L)U_x(x)…U(θ_2)U_x(x)U(θ_1)U_x(x).
Repeated trigonometric encoding creates higher-frequency functions of x in measured expectations.
Pérez-Salinas and collaborators showed that data re-uploading can give small quantum circuits substantial function-approximation power. [2]
Expressivity still depends on encoding frequencies, entangling structure and measurement observables.
18. Fourier view of encoded models
When data enter through rotations such as e−ixP/2, expectation values become trigonometric polynomials whose accessible frequencies are determined by the encoding generators and the number/order of re-uploading layers.
This gives a useful design rule: the circuit’s frequency spectrum should be rich enough for the target function but not so uncontrolled that training becomes ill-conditioned.
19. Barren plateaus
McClean and collaborators showed that sufficiently random variational circuits can exhibit gradients whose variance decays exponentially with system size. [3]
This is a barren plateau: many parameters have gradients too small to resolve efficiently.
The phenomenon depends on circuit architecture, depth, cost locality, initialisation and noise.
Problem-inspired shallow circuits with local losses can behave very differently from global random ansätze.
20. Noise-induced trainability loss
Hardware noise can flatten expectation landscapes even when an ideal circuit would have usable gradients.
As circuit depth grows, depolarisation and decoherence push measured states toward parameter-insensitive mixtures.
This creates another trainability barrier separate from ideal barren-plateau concentration.
21. Generalisation
Low training error can result from memorisation.
Generalisation depends on effective model complexity, margin, regularisation, sample size and data distribution.
Quantum models are not exempt from standard machine-learning discipline:
- split training/validation/test sets before tuning;
- avoid selecting hyperparameters on the final test set;
- report uncertainty over random seeds and data splits;
- compare parameter count and computational budget fairly;
- use strong classical baselines.
22. Inductive bias
A useful learning model imposes structure before seeing every possible example.
Quantum feature maps may encode symmetries, periodicity, conservation laws or interaction graphs that match the task.
That task-aligned inductive bias is a more credible source of practical value than raw Hilbert-space size alone.
23. Data-loading problem
If a classical vector with dimension D is amplitude encoded as
|x⟩=Σ_{j=1}^{D}x_j|j⟩/||x||,
then only log₂D qubits are needed to hold the index space.
But preparing arbitrary amplitudes xj from classical memory can itself cost O(D) without special structure or QRAM assumptions.
A claimed exponential dimension reduction in qubits does not automatically imply end-to-end exponential runtime advantage.
24. Classical simulation boundary
Some quantum feature circuits are efficiently simulable classically because they have low entanglement, Clifford structure, low treewidth or other exploitable form.
Others may produce kernels that are classically hard to estimate under complexity assumptions.
Classical hardness of simulating a feature map is not sufficient for useful learning advantage. The hard kernel must also align with the data labels and outperform efficiently computable classical alternatives.
25. Quantum kernel advantage needs three ingredients
A convincing advantage story requires at least:
- computational separation: the relevant kernel/features are hard to reproduce classically under stated assumptions;
- statistical usefulness: those features generalise well on the target distribution;
- end-to-end efficiency: data loading, kernel estimation, shots and optimisation do not erase the benefit.
Missing any one of these can eliminate practical advantage.
26. Small-data versus large-data regimes
Near-term quantum kernel experiments often use small N because O(N²) kernel estimation is expensive.
In small-data regimes, generalisation uncertainty can dominate hardware differences.
In large-data regimes, loading and kernel-matrix cost can dominate.
The regime must therefore be part of any claimed benchmark.
27. Generative quantum models
Quantum machine learning also includes Born machines, quantum GANs and quantum Boltzmann-like models.
Those models learn distributions rather than supervised decision boundaries.
This guide does not claim canonical ownership of generative QML; they are noted only to preserve the boundary of this feature-map/kernel/classifier lane.
28. Common misconception: exponentially large Hilbert space means exponentially powerful learning
Most of Hilbert space may be inaccessible, irrelevant or impossible to distinguish with practical measurements. Useful capacity depends on the induced data geometry and accessible hypothesis class.
29. Common misconception: a quantum kernel is automatically better than an RBF or polynomial kernel
Kernel quality is task dependent. A classical kernel with the right inductive bias can outperform a quantum kernel even if the quantum kernel is difficult to simulate.
30. Common misconception: training accuracy demonstrates quantum advantage
Training accuracy can reflect memorisation. Advantage requires held-out performance, matched classical baselines, uncertainty analysis and realistic resource accounting.
31. Worked synthesis problem
Use one-qubit feature map |φ(x)⟩=Ry(x)|0⟩ for training points x₁=0 and x₂=π/2.
Step 1: Diagonal entries. K(x,x)=1.
Step 2: Off-diagonal. K(0,π/2)=cos²(π/4)=1/2.
Step 3: Gram matrix.
K=[[1,0.5],[0.5,1]].
Step 4: PSD check. Eigenvalues are 1.5 and 0.5, both nonnegative.
Step 5: Learning interpretation. The two examples are distinguishable but not orthogonal in feature space. Whether that is useful depends entirely on how labels and unseen data are arranged—not on the PSD calculation alone.
32. Practice set
- What is a quantum feature map?
- Define the fidelity quantum kernel used here.
- Why is the exact kernel matrix PSD?
- How can the kernel be estimated with U_φ(x)†U_φ(x’)?
- How does shot noise scale for one kernel entry?
- Why can a noisy estimated Gram matrix have small negative eigenvalues?
- What does an SVM do with the quantum kernel?
- What is a variational quantum classifier?
- State the Pauli-generator parameter-shift rule.
- What is data re-uploading?
- Why does amplitude encoding not automatically give end-to-end exponential speedup?
- Name three ingredients needed for a convincing quantum-kernel advantage claim.
Answers
- An input-dependent unitary/state preparation x→|φ(x)⟩ defining a quantum representation of data.
K(x,x')=|⟨φ(x)|φ(x')⟩|².- It is a Gram matrix of valid feature vectors in an induced Hilbert space.
- The all-zero return probability equals the squared feature-state overlap ideally.
- Standard deviation scales as O(1/√M) with M shots.
- Finite-shot/hardware noise perturbs entries away from an exact Gram matrix.
- Uses K as the similarity matrix inside an otherwise classical convex classifier.
- A data-encoded trainable circuit whose measured expectation supplies a prediction.
∂f/∂θ=[f(θ+π/2)−f(θ−π/2)]/2under the stated generator assumptions.- Repeatedly encoding data between trainable circuit layers to enlarge the accessible function spectrum.
- Preparing arbitrary amplitudes from classical data can cost O(D) without special structure/QRAM, eliminating the apparent qubit-compression runtime gain.
- Classical computational separation, statistical usefulness/generalisation, and end-to-end resource efficiency.
Sources and further study
[1] Vojtěch Havlíček and colleagues, Supervised learning with quantum-enhanced feature spaces, Nature 567, 209–212 (2019). A foundational quantum-feature-map and kernel-classification demonstration.
[2] Adrián Pérez-Salinas and colleagues, Data re-uploading for a universal quantum classifier, Quantum 4, 226 (2020). Develops repeated data encoding as a compact function-approximation mechanism.
[3] Jarrod R. McClean and colleagues, Barren plateaus in quantum neural network training landscapes, Nature Communications 9, 4812 (2018). Establishes exponentially vanishing gradients for broad random variational-circuit settings.
[4] Maria Schuld and Nathan Killoran, Quantum Machine Learning in Feature Hilbert Spaces, Physical Review Letters 122, 040504 (2019). Frames quantum embeddings through kernel/feature-space language.
[5] M. Cerezo and colleagues, Variational quantum algorithms, Nature Reviews Physics 3, 625–644 (2021). Reviews trainability, ansatz design, optimisation and noise issues across variational quantum models.
Continue through Quantum Mathematics
Guide 61: Quantum Approximate Optimisation Algorithm, MaxCut, Cost Hamiltonians and Alternating Operators develops structured variational optimisation. Guide 63: Quantum Differential Equations, Linear ODEs, PDEs, Spectral Methods and Solution States develops numerical-analysis algorithms. Guide 64: Quantum Simulation of Lattice Gauge Theories, Gauge Constraints, Wilson Loops and Kogut–Susskind Hamiltonians develops a physics simulation lane.
