Quantum machine learning has an attention problem. Everyone fixates on the word “quantum” and files quantum data encoding under preprocessing, something to sort out later. I have spent more than 14 years refactoring legacy systems and wiring AI into them, and the rule has not changed: if the data representation is bad, the model is bad, quantum or not.
I have watched people shove wide tabular data into a circuit with no plan for it, then blame decoherence and noise when the quantum advantage never shows up. If you are building hybrid models, the awkward part is almost always the handoff between classical bits and qubits. My earlier piece on what quantum machine learning actually is from an architect’s perspective covers the ground underneath this one.
Hybrid QML workflows and where the cost lands
Almost nothing running in production today is fully quantum. It is hybrid. Classical hardware handles the optimization and the data cleaning, then hands one specific representation to the circuit. That makes the encoding step the expensive one, in circuit depth and in gate error.
A hybrid run usually goes like this:
- Classical input, your ordinary feature vector x.
- The encoding step, mapping x into a quantum state |ψ(x)⟩.
- Running your parameterized quantum circuit (PQC).
- Measurement, pulling expectation values back out as classical numbers.
- A classical optimizer such as Adam or COBYLA updates the parameters.
Four quantum data encoding techniques
Which one you reach for depends on the shape of your data. None of them is correct in general. You are trading qubit count against circuit depth and deciding where you would rather take the hit.
1. Basis encoding
The naive option. Classical binary strings map straight onto qubit states, so for the bitstring 101 you apply X gates to the first and third qubits. It is easy to reason about and it uses none of the superposition you came for. It also costs one qubit per feature, which rules it out for anything that looks like a real enterprise dataset.
2. Angle encoding
Here you use rotations rather than 0s and 1s: each feature value becomes an angle on an Ry or Rx gate. Continuous data fits without any preprocessing gymnastics. The catch is that the representation stays close to linear until you add entangling layers further into the circuit.
# Example of Angle Encoding in Qiskit
from qiskit import QuantumCircuit
import numpy as np
features = [0.5, 1.2] # Normalized data
qc = QuantumCircuit(2)
qc.ry(features[0], 0)
qc.ry(features[1], 1)
# Result: Data is encoded in the rotation of the qubits
3. Amplitude encoding
Amplitude encoding puts the whole feature vector into the amplitudes of a quantum state, so n qubits carry 2^n features. The exponential compression is why people want it. State preparation is why they give up on it: building a non-trivial state can push circuit depth far enough that noise has wrecked the result before your model logic runs at all. The official IBM Qiskit documentation works through this in detail.
4. Feature maps and Hilbert space
This is the kernel trick from SVMs, moved into a circuit. You are not really loading data, you are pushing it into a high-dimensional Hilbert space where a linear boundary can separate it. Entangling gates such as CNOTs are what pick up non-linear relationships between features that a classical model can miss. The theory behind quantum-enhanced feature spaces is in the Havlíček et al. paper.
If the encoding work is eating your sprint, this is the sort of thing I take on. I have been dealing with WordPress and awkward backend integrations since the 4.x days, and pipeline performance is most of what I do.
How I would choose
Do not pick an encoding because it sounds more quantum. Plain categorical data is often fine with basis encoding. Complex image features want amplitude encoding, and then NISQ-era hardware pushes you back to a simpler feature map anyway. Classical ML lets you throw RAM at a bad decision. Here you have to weigh how much expressive power your quantum data encoding buys against what the hardware can physically survive.
The encoding step is not a black box. Open the circuit, count the gates, and confirm your data is still intact by the time the first layer of the model runs.