Angle and Amplitude Encoding
Every quantum machine learning (QML) algorithm must begin by loading classical data into a quantum state. The choice of encoding determines how the data's structure is represented, what circuits are needed, and — ultimately — whether any quantum advantage is achievable. Two strategies appear in almost every QML paper: angle encoding and amplitude encoding.
Angle encoding
In angle encoding each feature is stored in the rotation angle of a single qubit. Applying to gives
A feature vector is loaded into qubits with one gate per feature:
The resulting state is a product state — no entanglement is introduced during the encoding step itself. The circuit depth is and each gate acts on a single qubit, making angle encoding hardware-friendly and straightforward to implement.
The cost is that you need one qubit per feature. For a dataset with features you need a 100-qubit device.
Amplitude encoding
Amplitude encoding takes a different approach: it packs an entire classical vector into the amplitudes of a single quantum state. Given a normalised vector with , the encoded state is
Here amplitudes fit into qubits, so amplitude encoding is exponentially more compact in qubit count: 100 features need only qubits.
The catch is preparation cost. Building an arbitrary -qubit state from generally requires a circuit of depth — the exponential saving in qubits can be cancelled by an exponential overhead in gates unless the data vector has special structure (e.g. a quantum random-access memory is available).
Side-by-side comparison
| Property | Angle encoding | Amplitude encoding | |---|---|---| | Qubits required | (one per feature) | | | Circuit depth | | in general | | Entanglement during load | None (product state) | Required | | Normalisation needed | No (per-feature) | Yes () | | Hardware-friendly | Yes | Challenging on NISQ |
Neither strategy is universally superior. For near-term devices with limited depth, angle encoding is practical. For future fault-tolerant processors where state preparation is cheap, amplitude encoding can exploit the exponential compression.
Try it
Angle-encode the feature vector into a 2-qubit circuit by applying to qubit 0 and to qubit 1. The grader checks the resulting statevector.
After running, inspect the amplitudes. Qubit 0 has on and on ; qubit 1 has and . The full two-qubit product state combines these via the tensor product.
Sign in on the full site to ask questions and join the discussion.