Quantum Circuit Lab / quantum machine learning
Lesson 11 · quantum machine learning

Parameterized Quantum Circuits: The Weights of Quantum AI

Understand trainable rotations, observables, loss functions, and the classical optimiser inside a parameterized quantum circuit.

Advanced20 min readsoftware engineering · quantum computing

A circuit-shaped hypothesis

A parameterized quantum circuit replaces fixed gate angles with variables θ. The circuit maps those variables to a measurement value, which becomes a prediction or feature.

def model(theta, x):
    encode(x)
    for layer in range(L):
        ry(theta[layer, 0], 0)
        rz(theta[layer, 1], 1)
        cnot(0, 1)
    return expectation(Z, wire=0)

The training loop is familiar: predict, compute a loss, estimate gradients, and update parameters. The quantum part supplies the forward pass; the optimiser is still classical.

What counts as a weight?

Rotation angles are trainable weights, but circuit topology also matters. The number of layers, entangling pattern, and measurements define the hypothesis space. This fixed shape is an ansatz.

Why gradients become difficult

On hardware, a parameter-shift gradient can need several noisy executions per parameter. Deep random circuits can also produce very small gradients, often called a barren plateau.

Good baseline: start shallow, initialise near identity, log gradient norms, and compare against a classical model with a similar parameter budget.
  • Keep train, validation, and test data separate.
  • Report shots, noise, circuit depth, and parameter count.
  • Repeat across seeds; one success is not evidence of advantage.

Next, read the encoding guide before building a quantum layer for images or text.