Variational Quantum Classifiers
A variational quantum classifier encodes data into a circuit, applies trainable gates, and measures an observable whose expectation is optimized to predict labels.
Anatomy of the model
A variational quantum classifier (VQC) has three stages. First a data-encoding block maps input x into a state. Second a parameterized circuit with trainable angles theta transforms it. Third a measurement of some observable, often a single-qubit Pauli-Z, yields an expectation value
The training loop
- Forward pass: for each example, prepare the encoded state, apply the ansatz, measure to estimate the expectation with many shots.
- Loss: compute a differentiable loss such as squared error or cross-entropy between predictions and labels.
- Gradient: obtain partial derivatives with the parameter-shift rule, which uses circuit evaluations at shifted angles.
- Update: a classical optimizer such as Adam or SPSA adjusts theta; repeat.
# One prediction from a variational classifier (schematic)
def predict(x, theta):
encode(x) # feature map
variational_layers(theta) # trainable ansatz
return expval(PauliZ(0)) # in [-1, 1] -> map to class label
Design choices that decide success
The encoding sets which functions of x are even reachable; through the Fourier picture, repeating the encoding raises the frequency content the model can fit. The ansatz sets expressivity and trainability, which trade off: an ansatz expressive enough to approximate any unitary tends to induce a barren plateau with exponentially small gradients.
Relation to neural networks
VQCs are often called quantum neural networks, and the analogy is loose but useful: encoding resembles an input layer, variational blocks resemble hidden layers, and measurement resembles a readout. Unlike deep nets, the model is linear in the state and its gradients come from a hardware-native rule rather than backpropagation, so the optimization dynamics differ substantially.
Practical caution
On classical benchmark data, VQCs have not shown a consistent advantage over well-tuned classical models. They remain valuable as a research testbed and as candidates for quantum-native data, where the input already lives in a quantum state and no expensive encoding is required.