QAOA Encoding
QAOA-inspired encoding with alternating cost and mixer layers for combinatorial data.
Qubits
4
Depth
9
Total Gates
26
Simulability
Not simulable
Mathematical Formulation
Description
QAOA (Quantum Approximate Optimization Algorithm) encoding adapts the QAOA circuit structure for data encoding. It alternates between cost layers that encode features through data-dependent rotations and mixer layers that spread information across qubits via entangling gates. This structure is particularly well-suited for combinatorial optimization problems.
The circuit begins with Hadamard gates to create equal superposition, then repeats p layers of: (1) data rotation gates R_data(γ·x_i) encoding features as phase-like rotations, (2) entangling gates (CZ, CX, or RZZ) coupling qubits, and (3) mixer rotation gates R_mixer(β) for exploration. The γ and β parameters control the encoding strength and mixing, respectively.
The encoding supports both linear and quadratic feature maps: linear maps φ(x_i) = γ·x_i, while quadratic uses φ(x_i) = γ·x_i². An edge-coloring-based algorithm optimizes the circuit depth for the entanglement pattern, yielding near-optimal parallel gate scheduling.
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 | 7 | 12 | 2 |
| 4 | 4 | 9 | 26 | 6 |
| 8 | 8 | 9 | 54 | 14 |
| 16 | 16 | 9 | 110 | 30 |
Code Examples
QAOA encoding with PennyLane using linear entanglement and CZ gates.
from encoding_atlas import QAOAEncoding
import pennylane as qml
import numpy as np
enc = QAOAEncoding(n_features=4, reps=2, entanglement="linear")
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
- Encoding data for combinatorial optimization problems
- Graph-structured data encoding (e.g., MaxCut, TSP)
- QAOA-inspired variational classifiers
- Problems with natural cost-function structure
- Quantum optimization benchmarks
Pros & Cons
Advantages
- Natural fit for combinatorial optimization problems
- Flexible entangling gate choices (CX, CZ, RZZ)
- Edge-coloring optimized depth for parallel gate scheduling
- Supports both linear and quadratic feature maps
- Good trainability with linear entanglement
Limitations
- Specialized structure — may not be optimal for general ML tasks
- Full entanglement scales poorly for large feature counts
- Fixed γ and β parameters limit adaptability without optimization
- Barren plateau risk increases with reps > 10
- Not designed for continuous feature-intensive tasks
References
- [1]Farhi, E., Goldstone, J., & Gutmann, S. (2014). A Quantum Approximate Optimization Algorithm. arXiv:1411.4028.
- [2]Hadfield, S., et al. (2019). From the Quantum Approximate Optimization Algorithm to a Quantum Alternating Operator Ansatz. Algorithms, 12(2), 34.
- [3]Zhou, L., et al. (2020). Quantum Approximate Optimization Algorithm: Performance, Mechanism, and Implementation on Near-Term Devices. Physical Review X, 10(2), 021067.