Quantum language models have shown competitive performance on sequential tasks, yet whether trained quantum circuits exploit genuinely quantum resources -- or merely embed classical computation in quantum hardware -- remains unknown. Prior work has evaluated these models through endpoint metrics alone, without examining the memory strategies they actually learn internally. We introduce the first mechanistic interpretability study of quantum language models, combining causal gate ablation, entanglement tracking, and density-matrix interchange interventions on a controlled long-range dependency task. We find that single-qubit models are exactly classically simulable and converge to the same geometric strategy as matched classical baselines, while two-qubit models with entangling gates learn a representationally distinct strategy that encodes context in inter-qubit entanglement -- confirmed by three independent causal tests (p < 0.0001, d = 0.89). On real quantum hardware, only the classical geometric strategy survives device noise; the entanglement strategy degrades to chance. These findings open mechanistic interpretability as a tool for the science of quantum language models and reveal a noise-expressivity tradeoff governing which learned strategies survive deployment.
Figures & tables
Figure 1: Hemisphere separation distinguishes successful from failing quantum memory. Bloch sphere trajectories for 10-distractor sequences. Left: Shared-parameter model (MinimalQLM). Contexts A and B overlap after distractor tokens, causing misclassification (76% accuracy). Right: Decoupled model (DecoupledQLM). Contexts remain in opposite hemispheres throughout, achieving 100% generalization. A classical SO(3) baseline produces identical trajectories, confirming this mechanism is not inherently quantum.
Token
Encoding ( x )
Role
A
+π/3
Context → predict 0
B
−π/3
Context → predict 1
D
0.0
Distractor
Table 1: Parity-Switch Grammar token encodings. The task reduces long-range dependency to its minimal form: maintain context identity across arbitrarily many distractors.
Model
Type
Params
Distinguishing property
MinimalQLM
Quantum (1Q)
3
Shared context/distractor gate
DecoupledQLM
Quantum (1Q)
6
Separate context/distractor gates
TwoQubitQLM
Quantum (2Q)
24
CNOT entangling gate
ClassicalSO(3)
Classical
3/6
SO(3) rotation matrices
ClassicalRNN4
Classical
24
tanh-RNN, 4D hidden state
Table 2: Model zoo spanning the classical–quantum boundary. Parameter counts are exactly matched between quantum and classical counterparts to control for model capacity.
Model
Sim. Acc.
HW Acc.
Δz
Mechanism
MinimalQLM (1Q shared)
76%
–
0.36
Periodic recurrence
DecoupledQLM (1Q)
100%
100%
1.36
Z-preservation
ClassicalSO(3) (matched)
100%
–
1.36
Z-preservation
2Q + CNOT (30 seeds)
96.3 ± 9.1%
39 ± 7%
–
Entanglement
2Q + SWAP (10 seeds)
97.1 ± 5.7%
–
–
Z-preservation
2Q no CNOT (10 seeds)
100 ± 0%
41 ± 5%
–
Z-preservation
Table 3: Entanglement-based memory emerges exclusively with CNOT gates; the task is trivially classical. HW = IBM hardware (ibm_fez / ibm_marrakesh, 156 qubits, 1000 shots/circuit). Δz = Bloch Z-coordinate separation (max 2.0). 2Q+CNOT results: 30 seeds × 3 restarts. The classical RNN solves the task with Adam but fails under SPSA, confirming that the SPSA comparison is optimizer-confounded. The SWAP control (non-entangling inter-qubit coupling) achieves high accuracy via Z-preservation, isolating entanglement as the resource enabling the distinct strategy.
Figure 2: Z-coordinate preservation is robust across 100 distractors. Bloch-sphere Z-coordinate for Context A and Context B across 0–100 distractors (DecoupledQLM). Hemisphere separation grows slightly with length because distractor rotations push states toward the poles. The shared model loses separation after ∼ 5 distractors.
Figure 3: Entanglement entropy diverges by context, providing a representationally distinct memory channel. Von Neumann entanglement entropy S(ρ0) per timestep for the trained two-qubit model with CNOT gates on 10-distractor sequences. Context A and B traces diverge after the context token (timestep 0) and maintain distinct entanglement levels across all distractors. Ablating the CNOT eliminates this divergence, collapsing both traces to zero entropy; the model then reverts to Z-preservation.
Context
Distractors
P(∣1⟩)
Correct?
A
0
0.24
Yes
B
0
0.98
Yes
A
5
0.06
Yes
B
5
0.89
Yes
A
10
0.25
Yes
B
10
0.98
Yes
Table 4: The geometric strategy executes perfectly on quantum hardware. Single-qubit hardware results on ibm_fez (1000 shots per circuit). All predictions are correct with wide margins from the 0.5 decision boundary, confirming that the Z-preservation mechanism is fully noise-robust at current device fidelities.
Figure 4: A sharp phase transition separates viable from collapsed geometric memory. Distractor rotation θ2dist sweeps from 0 to π (10 distractors). (a) Classification accuracy: robust up to θ2dist≈0.83 rad, then drops to chance; recovery at π is period-2 recurrence. (b) Z-coordinate variance across timesteps; lower variance indicates more stable memory. (c) Heatmap of Bloch Z-coordinate per timestep (columns) at each θ2dist (rows). Blue = northern hemisphere, red = southern.
Model / Mechanism
p=0
p=0.06
p=0.12
1Q Decoupled / Z-Preservation
100%
100%
50%
2Q no CNOT / Z-Preservation
100%
100%
100%
2Q + CNOT / Entanglement
100%
50%
50%
Table 5: Entanglement-based memory is the least noise-robust strategy. Simulated depolarizing noise at rate p per gate. Entanglement degrades to chance at p=0.06 ; Z-preservation strategies survive until p=0.12 or beyond.