Hybrid Quantum-Classical Neural Network
Hybrid Quantum-Classical Neural Network
A five-stage hybrid model trained end to end, with an ablation experiment comparing it to the same architecture without the quantum layer.
An educational research project on small data and quantum simulation: the results measure the model's behaviour in this setting only, and prove no quantum advantage.
The notebook and Google Colab
05-hybrid-quantum-classical-network.ipynb — The notebook ran in full without errors (2026-11-20 08:11 UTC, 28 s on CPU)
The notebook has not yet been published in a public GitHub repository, so we do not give a direct Colab link. Download the notebook, then open it from Colab via "File → Upload notebook".
The notebook's twelve sections
- Project title
- Problem statement
- Installing the libraries
- Importing the libraries
- data loading
- Preprocessing
- Building the quantum model
- Training
- Evaluation
- Charts
- Results
- References
The notebook runs on a CPU without a GPU, and pins the versions it was tested with in its first cell.
Research problem
Does the quantum layer really contribute to the hybrid model's performance, or are the classical layers alone enough?
Objectives
- Build a Classical → Quantum → Measurement → Classical pipeline.
- Train the classical and quantum parameters together.
- Perform an ablation with a comparable number of parameters.
- Separate training time from inference time.
| Data | Breast Cancer Wisconsin (Diagnostic) — scikit-learn / UCI Machine Learning Repository CC BY 4.0 Source |
|---|---|
| Architecture | 30 → Dense(4, tanh·π/2) → [4 qubits, StronglyEntanglingLayers×2] → ⟨Z₀..Z₃⟩ → Dense(1, sigmoid) |
| Tools | PennyLane 0.45.1 (autograd) · scikit-learn · Matplotlib |
| Evaluation metrics | Accuracy · F1 · Classical vs quantum parameter count · Train/Inference time · Ablation gap |
Method
- Load, split and scale the data.
- Define the three layers.
- Train the hybrid model.
- Train the equivalent classical model.
- Compare accuracy, F1, times and number of parameters.
- Plot the two loss curves.
Linked interactive experiment
References
- Andrea Mari; Thomas R. Bromley; Josh Izaac; Maria Schuld; Nathan Killoran (2020). Transfer learning in hybrid classical-quantum neural networks. Quantum 4, 340 doi:10.22331/q-2020-10-09-340
- K. Mitarai; M. Negoro; M. Kitagawa; K. Fujii (2018). Quantum circuit learning. Phys. Rev. A 98:032309 doi:10.1103/PhysRevA.98.032309
- Joseph Bowles; Shahnawaz Ahmed; Maria Schuld (2024). Better than classical? The subtle art of benchmarking quantum machine learning models. arXiv:2403.07059 arxiv.org
- W. Wolberg; O. Mangasarian; N. Street; W. Street (1995). Breast Cancer Wisconsin (Diagnostic). UCI Machine Learning Repository (CC BY 4.0) archive.ics.uci.edu
