ZZ Feature Map
Qiskit-standard entangling feature map with Hadamard, phase, and ZZ interaction layers.
Qubits
4
Depth
22
Total Gates
52
Simulability
Not simulable
Mathematical Formulation
Description
The ZZ Feature Map is a widely-used entangling encoding that follows the Qiskit convention for quantum feature maps. Each layer applies Hadamard gates to create superposition, single-qubit phase gates P(2x_i) for individual feature encoding, and two-qubit ZZ interactions with a distinctive (π−x_i)(π−x_j) phase convention.
The ZZ interaction is decomposed as CNOT · RZ(2(π−x_i)(π−x_j)) · CNOT, creating pairwise feature correlations through entanglement. This phase convention (different from IQP's direct x_i·x_j product) ensures non-trivial interaction even when individual features are small, as the (π−x) shift moves the operating point away from zero.
The ZZ Feature Map is the standard benchmark encoding in Qiskit's quantum ML ecosystem and is commonly used for quantum kernel methods. Its quantum kernel k(x,x') = |⟨ψ(x)|ψ(x')⟩|² has been shown to achieve quantum advantage on structured learning problems.
Circuit Diagram
Property Radar
Properties
Resource Scaling
How resource requirements grow with the number of input features.
| Features | Qubits | Depth | Gates | 2Q Gates |
|---|---|---|---|---|
| 2 | 2 | 10 | 14 | 4 |
| 4 | 4 | 22 | 52 | 24 |
| 8 | 8 | 46 | 200 | 112 |
| 16 | 16 | 94 | 784 | 480 |
Code Examples
ZZ Feature Map with PennyLane using full entanglement and 2 reps.
from encoding_atlas import ZZFeatureMap
import pennylane as qml
import numpy as np
enc = ZZFeatureMap(n_features=4, reps=2, entanglement="full")
dev = qml.device("default.qubit", wires=enc.n_qubits)
@qml.qnode(dev)
def circuit(x):
enc.get_circuit(x, backend="pennylane")
return qml.state()
x = np.array([0.1, 0.5, 1.2, 2.3])
state = circuit(x)When to Use This Encoding
- Quantum kernel methods and QSVM classifiers
- Standard benchmark encoding for quantum ML research
- Variational quantum classifiers with balanced expressibility
- Quantum advantage experiments on structured data
- Feature interaction modeling with ZZ correlations
Pros & Cons
Advantages
- Qiskit-standard encoding with extensive ecosystem support
- Non-trivial (π−x) phase convention avoids zero-interaction regions
- Proven quantum advantage on certain learning problems
- Flexible entanglement topologies
- Well-balanced between expressibility and trainability
Limitations
- O(n²) CNOT gates with full entanglement
- Higher circuit depth than IQP due to phase gate structure
- Feature count limited to ~12 for practical use
- Sensitive to noise on current hardware
- Trainability decreases with repetitions
References
- [1]Havlíček, V., et al. (2019). Supervised learning with quantum-enhanced feature spaces. Nature, 567(7747), 209–212.
- [2]Schuld, M. (2021). Supervised quantum machine learning models are kernel methods. arXiv:2101.11020.
- [3]Huang, H.-Y., et al. (2021). Power of data in quantum machine learning. Nature Communications, 12, 2631.