Curriculum / Quantum Machine Learning / Hybrid Classical-Quantum Models

Lesson 7 of 15Code challengePro+150 XP

Hybrid Classical-Quantum Models

Combine neural networks with quantum circuits.

Hybrid Classical-Quantum Models

Why Hybrid?

Pure quantum computers today have limited qubits, high noise, and short coherence times. Pure classical computers cannot efficiently simulate quantum systems. Hybrid models combine the best of both: classical preprocessing and postprocessing with quantum circuit as a trainable feature extractor.

The standard hybrid pipeline:

Classical input -> Encoder -> Quantum Circuit (PQC) -> Measurement -> Classical output

Classical layers handle data preprocessing, dimensionality reduction, and final classification. The quantum circuit acts as a nonlinear kernel with trainable angles.

Architecture Design

A typical hybrid classifier for 2D data:

- Angle encode: Ry(x1, 0), Ry(x2, 1)

- Variational layer: ,

- Entanglement: CNOT(0, 1)

- Measure qubit 0: is the classifier output

  1. 1.Classical encoder: Normalize input features to [0, pi] range
  2. 2.Quantum circuit:
  3. 3.Classical head: threshold at 0.5 for binary classification

The variational angles and are optimized during training to minimize classification loss.

Training the Hybrid Model

Training updates only the quantum circuit parameters (the angle values). The encoding angles come from the data and are fixed.

A simple training loop:

  1. 1.For each data point : run circuit, get
  2. 2.Compute loss:
  3. 3.Compute the gradient: the parameter shift rule gives the derivative of exactly, and the chain rule turns it into the loss gradient,
  4. 4.Update :

In practice, mini-batch training (averaging gradient over multiple data points) improves convergence.

Expressibility of Hybrid Models

The expressibility of a hybrid circuit depends on:

  • Number of qubits n (Hilbert space dimension )
  • Number of variational layers L (parameter count = n * L)
  • Entanglement structure (affects correlations the circuit can capture)

For 2D binary classification, a 2-qubit circuit with 2 variational layers typically achieves good accuracy if the data is not too complex.

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.