Data Encoding Strategies
Getting classical data into a quantum state is a modeling decision with deep consequences for capacity, cost, and whether any speedup survives.
The first and hardest step
Every quantum machine learning model on classical data must first load that data into qubits. The encoding is not a preprocessing detail; it fixes the geometry of the feature map, sets which functions the model can represent, and often determines whether a claimed advantage is real or an artifact of ignoring loading cost. Three schemes dominate.
The three main schemes
- Basis encoding: bitstrings become basis states; cheap gates, many qubits, discrete data.
- Angle encoding: features become rotation angles; shallow circuits, one qubit per feature, differentiable, the near-term default.
- Amplitude encoding: a length-2^n vector becomes n qubits' amplitudes; exponential compression, exponential preparation cost in general.
The loading bottleneck
The recurring trap is that a quantum algorithm may run in time logarithmic in the input size, but only if the input is already available as a quantum state. Preparing an arbitrary state from scratch can cost as much as the classical dimension, erasing the speedup. Honest complexity accounting includes state preparation. This is a central reason the field distinguishes classical-data QML from quantum-native-data QML, where loading is free.
Encoding shapes expressivity
The encoding also determines model capacity. Through the Fourier picture, the set of encoding gates fixes which frequencies of the input the model can access; repeating the encoding via data re-uploading enlarges that set. A poor encoding can make a task unlearnable no matter how the trainable layers are tuned.
# Rough decision guide
def choose_encoding(data):
if data.is_discrete_bitstrings:
return 'basis' # arithmetic / oracle algorithms
if data.dim <= n_qubits_available:
return 'angle' # shallow, differentiable, robust
if data.is_sparse or data.has_efficient_prep:
return 'amplitude' # exponential compression when preparable
return 'angle + data-reuploading'
The practical verdict
On current hardware, angle encoding with a few re-upload layers is the pragmatic choice: it is shallow, differentiable, and noise-tolerant. Amplitude encoding is reserved for structured or already-quantum data. Whatever the scheme, the honest question is whether the total cost, including loading, still beats the best classical baseline.