ExperimentAdvancedQuantum machine learning

Hybrid Classical–Quantum Model

A classical linear layer maps inputs to angles π·tanh(Wx+b), followed by a variational circuit and output σ(a⟨Z0⟩+c); all parameters train jointly.

Goal

Understand the structure of the hybrid model and how derivatives propagate through both parts.

Approximate duration: 10 minutes

Steps

  1. Choose the moons data.
  2. Train the hybrid model for 30 epochs.
  3. Compare with the classical baseline.
  4. Change the number of layers and watch the number of quantum and classical parameters.
Loading the simulator…
What theory predicts

Theory predicts that the training loss generally decreases, and that the number of quantum parameters is $2nL$ (8 for two qubits and two layers) and of classical ones $qd+q+2$. No guaranteed advantage over the classical baseline is expected; the result depends on the data and the seed.

In Hybrid Learning, the quantum computer is called as a layer within a classical model. Derivatives of the circuit parameters are computed with the parameter-shift rule, and those of the classical layers with the chain rule (Backpropagation), and then everything is updated by the same optimiser.

The moons data are not linearly separable, so they are a useful test of the model's ability to represent a curved decision boundary. The lab shows a classical baseline (logistic regression) for an honest comparison. Simulation results on small datasets do not prove any quantum advantage over classical machine learning.

Test your understanding

The quiz needs JavaScript.

Related topics

References

  1. K. Mitarai; M. Negoro; M. Kitagawa; K. Fujii (2018). Quantum circuit learning. Phys. Rev. A 98:032309 doi:10.1103/PhysRevA.98.032309
  2. Marcello Benedetti; Erika Lloyd; Stefan Sack; Mattia Fiorentini (2019). Parameterized quantum circuits as machine learning models. Quantum Sci. Technol. 4:043001 doi:10.1088/2058-9565/ab4eb5
  3. M. Cerezo et al. (2021). Variational quantum algorithms. Nature Reviews Physics 3:625–644 doi:10.1038/s42254-021-00348-9