ZKSF logo, a neon quantum brainZKSF
← All articles

Quantum Machine Learning on Simulators: A Practical Overview

· 12 min read · ZKSF team

Quantum machine learning trains a parameterised quantum circuit in a manner loosely analogous to neural network training: a circuit with tunable rotation angles is defined, run, measured, scored against a loss function, and its angles adjusted to reduce that loss. The tunable circuit is variously called a variational quantum circuit, an ansatz, or a quantum neural network.

Interactive diagramOne training step, and the wall that limits scalingThe parameter-shift cost of a single gradient step, next to the barren plateau that constrains adding qubits

The left side follows a single optimization step. The parameter-shift rule computes each gradient exactly from two circuit runs, so a model with P tunable angles needs 2P+1 executions per step (201 runs at P=100), and thousands of steps to converge. On a queued, noisy QPU that is slow and costly, which is why the work runs on a simulator, where statevector evolution is the dense linear algebra a GPU accelerates: for circuits around 20 to 30 qubits, GPU training drops from hours to minutes. The right side shows the central obstacle. For many randomly initialized circuits the gradient magnitude falls exponentially as qubit count grows, a proven effect known as a barren plateau, not a symptom of poor tuning, and the landscape flattens until no usable slope remains. The listed structural responses (problem-informed circuit design, careful initialization, local rather than global cost functions, and layerwise training) are each studied by running many simulated circuits and measuring how the gradients actually behave.

Nearly all of this work happens on simulators. The reasons are structural, and understanding them is more useful than any particular architecture.

Why training is expensive in circuit evaluations

Each optimisation step requires a loss value and a gradient. The standard method for obtaining a gradient on quantum hardware is the parameter-shift rule, which evaluates the circuit twice per parameter: once at theta + pi/2 and once at theta - pi/2, with the difference giving the exact derivative. This is not finite differences; it is exact, which is the rule's appeal.

The cost is that it scales with parameter count. A model with 100 parameters requires 200 circuit executions per gradient, and thousands of steps to converge puts the total in the hundreds of thousands. On a queued, per-shot-billed device this is prohibitive on both time and money.

Simultaneous perturbation stochastic approximation, or SPSA, is the standard alternative. It perturbs every parameter at once along a random direction and costs two evaluations per step regardless of parameter count. The gradient estimate is noisy, so more steps are needed, but the trade is overwhelmingly favourable: 150 iterations of SPSA is 301 evaluations against 30,001 for parameter shift on a 100-parameter model.

Method            Evaluations per step   100-param model, 150 steps
Parameter shift   2 x parameters         30,001
SPSA              2                      301

The choice of optimizer is therefore a hundred-fold cost decision, and it is routinely made on convergence grounds without reference to the invoice. On simulators the difference is minutes against hours; on hardware it is the difference between a feasible experiment and an infeasible one.

Where the data goes in

A question specific to QML, with no classical analogue, is how classical data enters the circuit. The encoding choice determines what function class the model can represent, and it matters more than the ansatz.

Angle encoding writes each feature into a rotation angle, using one qubit per feature. Amplitude encoding writes a 2^n-dimensional vector into the amplitudes of n qubits, which is exponentially compact but requires a state-preparation circuit whose depth generally cancels the saving. Basis encoding writes bits directly. Repeated or data re-uploading encodings interleave data and trainable layers, and the resulting model is provably a truncated Fourier series in the input, with the number of repetitions setting the accessible frequency spectrum.

That last result is worth knowing because it makes the model's expressivity explicit rather than mysterious. A single-layer angle encoding gives access to a small number of frequencies, and no amount of training will fit a function outside that span.

The barren plateau problem

Any accurate account of QML must name its central difficulty. For randomly initialised parameterised circuits drawn from sufficiently expressive families, the variance of the loss gradient decays exponentially with qubit count. The landscape becomes flat to within the precision that finite shot counts can resolve, and gradient descent has no slope to follow.

This is a proven phenomenon rather than an artifact of poor tuning, and it has a sharp practical consequence: resolving a gradient of size 2^-n requires on the order of 4^n shots. Adding qubits to a generic ansatz does not merely fail to help, it makes the model untrainable.

The known responses are structural.

  • Problem-informed ansatze, whose structure reflects the problem's symmetries, rather than generic hardware-efficient layers.
  • Local cost functions. Global observables produce plateaus at shallow depth; local ones provably avoid them for depths growing logarithmically in qubit count.
  • Careful initialisation, including identity-block strategies that begin the circuit near the identity where gradients are well behaved.
  • Layerwise training, growing depth incrementally rather than optimising a full-depth circuit from random initialisation.

Each of these is studied by running many simulated circuits and measuring how gradients behave as structure changes, which places the simulator at the centre of the research rather than at its periphery. Measuring an exponentially small gradient requires an exact simulator; on hardware the shot noise would swamp the quantity being measured.

Where GPUs are effective

Statevector simulation of a QML circuit is dense linear algebra, which is precisely the GPU workload. Training loops that sweep parameter settings or evaluate batches of data points parallelise naturally.

Circuit size    CPU training time     GPU training time
~20 qubits      minutes to ~1 hour    seconds to minutes
~30 qubits      hours                 minutes

For circuits in the 20 to low-30-qubit range a GPU reduces training from hours to minutes relative to a single CPU, which is the regime most current QML research occupies. Note that the GPU does not raise the qubit ceiling meaningfully, as discussed in CPU vs GPU vs QPU. It raises throughput, and throughput is the binding constraint in a training loop.

The unsettled question

QML remains openly unresolved on its central question: whether variational models deliver practical advantage over classical methods at useful scale. Several early advantage claims were subsequently matched by classical kernel methods or by dequantised algorithms, and the barren plateau results place real constraints on naive scaling.

The honest position is that the field has a well-defined set of open problems and no demonstrated advantage on a practically relevant dataset. This is a reason to work on it carefully rather than a reason to dismiss it, and it makes the tooling question sharper: separating genuine signal from artifact requires exact, noise-free, reproducible evaluation, which is what a simulator provides and hardware currently does not.

An exact simulator with GPU acceleration and a documented accuracy statement is the appropriate primary instrument for this work. It is not a fallback for when hardware access is unavailable.

Run your own 100-qubit circuit, with an error bar.

Share this articleLink copied