Power of Data: Quantum vs Classical Kernels (after Huang et al. 2021)
Overview
A small, simulated illustration inspired by Huang et al. (2021), "Power of data in quantum machine learning". The paper shows that classical learners given data can often match quantum models, and gives a test (the geometric difference) for when a quantum kernel might help. This circuit compares an IQP quantum kernel with a classical RBF kernel on a 4-feature toy dataset. It does not compute the geometric difference or reproduce the paper's experiments, and it shows no quantum advantage: on its own task the classical RBF kernel does better on average at every training-set size we tested (15 to 500 points).
| Property | Value |
|---|---|
| Category | Research Reproduction |
| Difficulty | Advanced |
| Framework | Qiskit |
| Qubits | 4 (default, configurable) |
| Paper | Nature Communications 12, 2631 (2021) |
| DOI | 10.1038/s41467-021-22539-9 |
| arXiv | 2011.01938 |
Background and Motivation
The central question of quantum machine learning is: when does a quantum computer genuinely help with learning tasks? Many proposed QML algorithms lack rigorous advantage proofs or rely on oracular assumptions. Huang et al. 2021 ("Power of data in quantum machine learning") approach this with rigorous prediction-error bounds: they show that classical models trained on data can often compete with quantum models, and give a method for assessing when a prediction advantage is possible.
The paper introduces three key ideas:
- Geometric difference -- a computable measure that quantifies the gap between quantum and classical kernel matrices, predicting when advantage is possible.
- Quantum kernel advantage conditions -- bounds showing when a quantum kernel can and cannot out-predict classical ones. For a learning problem built on the discrete logarithm (Liu et al. 2021), an appendix of the paper shows that a projected quantum kernel gives a rigorous speed-up on a fault-tolerant quantum computer.
- Projected quantum kernels -- a variant built from the reduced density matrices of the encoded state, which generalized better than the full quantum kernel in the paper's simulations.
Prerequisites
This circuit builds on quantum kernel fundamentals. If you are new to quantum kernels, start with the prerequisite circuit:
- Quantum Kernel Methods -- covers feature maps, kernel matrices, and kernel-based classification.
Theoretical Framework
The Three Regimes
Huang et al. do not sort problems into three fixed regimes. Their practical tool is a flowchart for pre-screening a potential advantage (Fig. 1 of the paper), which starts from the data:
- Small geometric difference g_CQ: a classical model is guaranteed to perform similarly or better, for any labels on that data.
- Large g_CQ: there exist labels for which the quantum kernel could predict better (a potential advantage).
- For the actual labels: comparing the model complexities s_C and s_Q tells whether that potential is realized for the task at hand.
Geometric Difference
The geometric difference between quantum kernel K_Q and classical kernel K_C quantifies how much "extra information" the quantum kernel captures:
g(K_Q, K_C) = sqrt( || sqrt(K_Q) * K_C^{-1} * sqrt(K_Q) || )
When g >> 1, the quantum kernel encodes structure invisible to the classical kernel. This is a necessary (but not sufficient) condition for advantage; sufficiency requires the target function to align with the quantum feature space.
Projected Quantum Kernels
Standard quantum kernels use the full 2^n-dimensional feature space, which can lead to overfitting on small datasets. The paper introduces projected quantum kernels built from the reduced density matrices rho_k(x) of each qubit k:
K_proj(x, x') = exp(-gamma * sum_k || rho_k(x) - rho_k(x') ||_F^2)
In the paper's numerical simulations of up to 30 qubits (run with TensorFlow Quantum, not on quantum hardware), projected kernels generalized better than the full quantum kernel, and on datasets engineered for a large geometric difference they showed a mild prediction advantage over the best classical models tested. This circuit has no projected kernel.
The IQP Feature Map
Circuit Structure
The feature map follows an Instantaneous Quantum Polynomial (IQP) structure:
CODE┌───┐┌──────┐ ┌───┐┌──────┐ q_0: ┤ H ├┤RZ(x₀)├──●────────●─── ┤ H ├┤RZ(x₀)├─── ├───┤├──────┤┌─┴─┐ │ ├───┤├──────┤ q_1: ┤ H ├┤RZ(x₁)├┤ X ├●──●──┼─── ┤ H ├┤RZ(x₁)├─── ├───┤├──────┤└───┘│ │ │ ├───┤├──────┤ q_2: ┤ H ├┤RZ(x₂)├─────┴──┼──┴─── ┤ H ├┤RZ(x₂)├─── ├───┤├──────┤ │ ├───┤├──────┤ q_3: ┤ H ├┤RZ(x₃)├─────────┴──── ┤ H ├┤RZ(x₃)├─── └───┘└──────┘ └───┘└──────┘ Layer 1 Layer 2
Each layer consists of:
- Hadamard gates -- create uniform superposition
- RZ(x_i) rotations -- encode individual features as phases
- CX-RZ(x_i * x_j)-CX gadgets -- encode pairwise feature products via entanglement
Why IQP?
- Hard to simulate at scale: IQP circuits are believed to be classically intractable under standard complexity-theoretic assumptions (Bremner, Jozsa, Shepherd 2011). This 4-qubit version is simulated exactly.
- Captures correlations: The x_i * x_j products in entangling gates create feature interactions of all orders.
- No proven advantage here: No advantage is proven for this IQP encoding. The proven discrete-log separation (Liu et al. 2021) uses a different, purpose-built feature map on a fault-tolerant computer.
The Quantum Kernel
Kernel Entry
The quantum kernel measures the overlap between two encoded quantum states:
K(x, x') = |<phi(x)|phi(x')>|^2
This fidelity-based kernel satisfies:
- K(x, x) = 1 for all x (self-overlap is perfect)
- 0 <= K(x, x') <= 1 (bounded by definition)
- K is symmetric and positive semi-definite (valid Gram matrix)
Kernel Matrix
For a dataset {x_1, ..., x_N}, the kernel matrix K has entries K[i,j] = K(x_i, x_j). This matrix is computed via statevector simulation (or SWAP test on hardware) and fed to a kernel ridge classifier.
The Discrete Log Problem
The discrete-log learning problem comes from Liu, Arunachalam and Temme (2021); Huang et al. (2021, Appendix K) show that a projected quantum kernel also achieves its speed-up:
CODEData: x, a number modulo a large prime p (x in Z_p^*) Label: +1 if log_g(x) lies in a secret interval [s, s + (p-3)/2], else -1
| Learner | Result (Liu et al. 2021) |
|---|---|
| Any efficient classical learner | Cannot beat random guessing by more than an inverse-polynomial margin, assuming discrete log is classically hard |
| Quantum kernel SVM on a fault-tolerant computer | Learns the labels with high accuracy (it can compute discrete logarithms) |
This circuit does not implement that problem. It uses a parity-of-signs label, prod(sign(x_i)), which keeps nothing of the discrete-log hardness: a classical polynomial kernel on the signs of the features reaches 100% test accuracy from 200 training points. It is a toy task for comparing kernels, not a quantum-advantage problem.
Running the Circuit
Basic Execution
PYTHONfrom circuit import run_circuit result = run_circuit( n_qubits=4, n_layers=2, n_train=15, n_test=5, ) print(f"Quantum Kernel: {result['quantum_kernel']['test_accuracy']:.1%}") print(f"Classical RBF: {result['classical_rbf']['test_accuracy']:.1%}")
Custom Feature Map
PYTHONfrom circuit import create_geometric_kernel_circuit import numpy as np x = np.array([0.5, -1.2, 0.8, 2.1]) qc = create_geometric_kernel_circuit(x, n_qubits=4, n_layers=3) print(qc.draw())
Verification
PYTHONfrom circuit import run_circuit, verify_reproduction result = run_circuit(n_qubits=4, n_layers=2) verification = result["verification"] print(f"Verification: {verification['summary']}") for check in verification["checks"]: status = "PASS" if check["passed"] else "FAIL" print(f" [{status}] {check['name']}: {check['detail']}")
Expected Results
Accuracy Comparison
With default parameters (4 qubits, 2 layers, 15 train, 5 test):
| Kernel | Expected Accuracy | Notes |
|---|---|---|
| Quantum (IQP) | 60% (3 of 5) | Near chance on this task: 50 to 60% on average over 5 data seeds with 15 to 500 training points (300 test points each) |
| Classical (RBF) | 40% (2 of 5) | 57 to 83% on average in the same test, ahead of the IQP kernel at every size |
Note: With 5 test points, one point is 20%, so the default comparison says nothing about which kernel is better. No separation from the paper applies to this circuit: the proven discrete-log speed-up (Liu et al. 2021) needs a different, purpose-built construction and a fault-tolerant quantum computer.
Verification Checks
The verify_reproduction() function validates:
- Kernel matrix validity -- square, correct dimensions
- Above random baseline -- quantum accuracy > 50%
- Quantum >= classical on this run -- 5 test points, so a one-point difference; not a statistically meaningful comparison, and not a claim from the paper
- Kernel diagonal -- the mean diagonal value is at most 1 (off-diagonal entries are not checked)
Implementation Notes
Statevector vs. Hardware Execution
This reproduction uses statevector simulation for exact kernel computation. On real hardware:
- Use the SWAP test or destructive swap to estimate kernel entries
- Shot noise introduces sampling error proportional to 1/sqrt(shots)
- Error mitigation (e.g., readout correction) improves kernel quality
Scaling Considerations
| Parameter | Statevector Limit | Hardware Limit |
|---|---|---|
| Qubits | ~25 (memory) | Device-dependent |
| Samples | O(N^2) kernel entries | Same (parallelisable) |
| Layers | No limit | Decoherence-limited |
Simplifications from the Paper
This reproduction simplifies the full paper construction in several ways:
- Parity-of-signs toy label instead of the discrete-log problem (it keeps none of that problem's hardness)
- Kernel ridge regression instead of SVM (closed-form solution)
- Fixed random seed for reproducibility (seed=42)
- No projected kernel variant (see paper Section V)
Relationship to Other Work
| Paper | Relationship | DOI |
|---|---|---|
| Liu et al. 2021 | Complementary cryptographic construction for provable separation | 10.1038/s41567-021-01287-z |
| Havlicek et al. 2019 | Quantum kernel framework used as foundation | 10.1038/s41586-019-0980-2 |
| Schuld & Killoran 2019 | Quantum models as kernel methods (theoretical basis) | 10.1103/PhysRevLett.122.040504 |
| Kubler et al. 2021 | Inductive bias of quantum kernels (NeurIPS 2021) | arXiv:2106.03747 |
Paper Citation
BIBTEX@article{huang2021power, title={Power of data in quantum machine learning}, author={Huang, Hsin-Yuan and Broughton, Michael and Mohseni, Masoud and Babbush, Ryan and Boixo, Sergio and Neven, Hartmut and McClean, Jarrod R.}, journal={Nature Communications}, volume={12}, pages={2631}, year={2021}, doi={10.1038/s41467-021-22539-9} } @article{liu2021rigorous, title={A rigorous and robust quantum speed-up in supervised machine learning}, author={Liu, Yunchao and Arunachalam, Srinivasan and Temme, Kristan}, journal={Nature Physics}, volume={17}, pages={1013--1017}, year={2021}, doi={10.1038/s41567-021-01287-z} }