Curriculum / Quantum Machine Learning / Parameterized Quantum Circuits

Lesson 2 of 15Code challengePro+125 XP

Parameterized Quantum Circuits

Build trainable quantum circuits with tunable gate angles.

Parameterized Quantum Circuits

The key innovation that makes Quantum Machine Learning possible is the parameterized quantum circuit (PQC): a quantum circuit where some gate angles are tunable variables rather than fixed constants. Just as a neural network learns by adjusting weights, a PQC learns by adjusting rotation angles.

Why Parameterization Matters

A fixed quantum circuit always produces the same output for the same input state. A parameterized circuit produces different outputs depending on : this is what enables learning.

The simplest example: the Ry gate.

When : (no rotation) When : (full flip) When : (superposition)

By tuning , a single-qubit PQC can prepare any state on the Bloch sphere.

Multi-Parameter Circuits

Real QML models use many parameters. A typical layer structure:

  1. 1.Encoding layer: Encode input data as rotation angles (Rx, Ry, or Rz)
  2. 2.Variational layer: Trainable Ry rotations on each qubit
  3. 3.Entanglement layer: CNOT or CZ gates to create correlations
  4. 4.Repeat 2-3 for L layers

The total parameter count is: (parameters per layer) x (number of layers). For n qubits with one Ry per qubit per layer and L layers: n*L parameters.

Gradient Computation: Parameter Shift Rule

Unlike neural networks where you can use backpropagation through differentiable operations, quantum circuits require a special technique: the parameter shift rule.

For a gate generated by a Pauli operator , the gradient of an expectation-value cost is:

This means you can compute exact gradients by running the circuit twice with shifted parameters. The fine print: the rule is exact when is the expectation value of a measured observable and the gate's generator has two eigenvalues, which every Pauli rotation satisfies. If your loss applies nonlinear post-processing to that expectation value (a squared error, a cross-entropy), you apply the shift rule to the expectation value and finish the derivative with the classical chain rule.

This is the opening of the lesson. The full walkthrough, the interactive circuit, and the graded challenge continue inside myqubit.

How this lesson works

A hands-on coding challenge. You write Qiskit-compatible Python in the browser editor, run it instantly via WebAssembly, watch the circuit and Bloch sphere react, and pass automatic output checks. The AI tutor Qubitus gives Socratic hints if you get stuck.

Part of: Quantum Machine Learning

Apply quantum computing to machine learning with variational circuits and optimization.

This lesson is part of Pro

Unlock Quantum Machine Learning and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.