Skip to content
Quantum.world

Research

Watching Quantum Models Think: Hilbert-Space Interpretability in Quantum Transformer Blocks

Overview Research area: Quantum machine learning, specifically interpretability of variational quantum circuits and quantum transformer architectures, with experimental validation on superconducting q

Watching Quantum Models Think: Hilbert-Space Interpretability in Quantum Transformer Blocks
arXiv
2609.23016
Published
2026-09-19
Authors
Diego Iacopetta, Andrea Gasparini

AI summary

Overview

Research area: Quantum machine learning, specifically interpretability of variational quantum circuits and quantum transformer architectures, with experimental validation on superconducting quantum hardware.

Technical level: Advanced. The paper assumes familiarity with quantum information concepts (von Neumann entropy, entanglement, reduced density matrices, statevectors) and with transformer architectures, though the prose is written to be accessible to readers with a quantum-computing background.

Scope: The paper proposes and empirically tests a Hilbert-space interpretability framework — built on quantum mutual information, entanglement entropy, participation ratio, and inter-layer state fidelity — for a fully coherent Quantum Transformer Block evaluated on four small synthetic sequence-to-sequence tasks in simulation and on IBM Quantum hardware.

What This Paper Is About

Deep learning models are powerful but opaque, and the authors argue that quantum machine learning faces a defining choice between building quantum models that are equally opaque or exploiting quantum mechanics' mathematical structure to make them inherently interpretable. They pursue the second path by designing a Quantum Transformer Block (QTB) — a single coherent circuit containing quantum analogues of both attention (inter-register entangling gates) and feedforward processing (intra-register variational gates) with no classical bypass — so that every input-output relationship is mediated by entanglement and can be measured directly from the quantum state. The goal is to show that tracking quantum information metrics through the circuit reveals what the model attends to, when correlations form, and why predictions fail, and that these signals survive on real hardware.

Key Contributions

  1. A Hilbert-space interpretability framework for quantum neural networks based on quantum mutual information, entanglement entropy, participation ratio, and inter-layer fidelity, validated on four sequence-to-sequence tasks with known dependency structure (copy k, lookup, conditional, and repeat as a negative control).

  2. Causal evidence that entanglement is the computational mechanism: disabling the inter-register attention gates collapses accuracy from 100% to 15% while mutual information goes to zero, reproduced in simulation and on hardware with a 98.6% MI reduction on ibm_kingston.

  3. Demonstration that MI co-evolves with performance during training (Spearman ρ = 0.92 on lookup, with every seed individually significant at p < 10⁻³) and that per-sample MI predicts prediction correctness on the conditional task (ROC AUC = 0.84), establishing MI as a reliable interpretability signal.

  4. Hardware validation of the full framework on IBM Quantum's Heron r2 processor (ibm_kingston, 156 qubits), showing that the circuit's reasoning process — from product state through structured entanglement — is directly observable on a superconducting processor.

Main Findings

  • MI aligns with ground-truth task structure on lookup: using MI as a binary classifier for which position pairs the task requires to be entangled yields AUC = 0.69 (3-seed range 0.65–0.76) on lookup, with MI on relevant pairs of 0.82 versus 0.60 on other pairs. Copy k reaches only AUC 0.65 because MI is diffuse across all pairs (0.59 relevant vs. 0.53 other). The conditional task shows AUC of 0.19, below chance, which the authors interpret as evidence that MI encodes a richer computational strategy than a binary pair-labelling captures, given the model still reaches 89% accuracy there.

  • Attention is data-dependent: on lookup, conditioning on the instruction stored at position 0 shows the MI matrix shifting toward the instructed target. The steering ratio (MI on the instructed pair divided by the mean on other pairs) reaches 3.27 on the illustrative seed and 4.25 averaged over three seeds, up from a near-flat 1.02 under earlier configurations. Per-sample selectivity is 0.65, significantly above chance (p ≈ 10⁻⁴ by a permutation test with 10,000 permutations) and consistent with 67% lookup accuracy on that seed.

  • Routing is learned gradually: correct-group MI curves separate from off-target curves by epoch ~50 for x₀ = 1, 2 and later for x₀ = 3, plateauing near 0.6–1.2 versus 0.2–0.6. Per-epoch group selectivity rises from the 1/3 chance floor to near 78% while validation accuracy plateaus near 83%.

  • Correct predictions carry stronger correlations: on the conditional task, mean MI discriminates correct from incorrect predictions with ROC AUC = 0.84 and logistic regression coefficient β = +1.23, with quartile accuracy rising monotonically from 26% to 42% to 78% to 98%. On lookup the effect is +0.066 bits on task-relevant pairs (Mann–Whitney U, p ≈ 10⁻³) but is seed-dependent and treated as illustrative.

  • Failure modes are diagnostic: on the illustrative lookup seed, 80% of errors arise from diffuse MI where entanglement is spread across too many pairs, and 20% from MI peaking at the wrong pair. No failures show absent entanglement.

  • Entanglement is causally necessary: with identical parameters, training procedure, and MLP readout, disabling inter-register entangling gates drops conditional accuracy from 99.8% to 39.8% and copy k from 100% to 15%, with MI collapsing to 0.000 in both cases.

  • Layers do qualitatively distinct work: encoding produces a near-product state (entropy ≈ 0, participation ratio ≈ 1). The first variational layer drops inter-stage fidelity to 0.04–0.11 but leaves entropy and inter-register MI near zero, while the second drops fidelity by a further factor of ≈0.03–0.10 and raises entropy to 0.85–1.07, building the entanglement. Lookup uses a larger effective Hilbert-space dimension (participation ratio ≈ 132) than the fixed-pattern tasks (40–50).

  • The negative control reveals a second signal source: repeat, which requires no inter-position communication, develops non-zero mean MI of 0.645 ± 0.101 across three seeds at 100% accuracy. The authors attribute this to basis-rotation work the circuit performs to compensate for the constrained readout rather than inter-position routing, noting that task-driven MI co-moves with accuracy while repeat MI continues building after accuracy saturates.

  • Hardware preserves the qualitative picture: on ibm_kingston, hardware MI values are compressed by noise (~10× smaller than simulation) but the formation trajectory holds — MI of 0.0005 after encoding (1.1% of full-circuit value), 0.0415 after layer 0 (83.1%), and 0.0499 for the full circuit, with the matched simulation companion showing 0.000 → 0.023 → 0.477. Pearson correlation between hardware and shot-simulated MI is ≥ 0.96 on the three signal-bearing tasks for the seed shown and exceeds 0.88 across all seeds, with ordinal pair ranking preserved.

  • Shot-based estimation converges quickly: both Pearson r with exact MI and ground-truth AUC plateau by ~1,000 shots; copy k reaches r ≈ 0.97 while other tasks settle between 0.73 and 0.78. Hardware experiments use 4,096 shots.

  • Hardware ablation and selectivity reproduce in part: disabling attention on hardware collapses MI from 0.073 to 0.001 (98.6% reduction). Hardware data-dependent attention selects the correct target in 2 of 3 conditions, with the x₀ = 3 miss attributed to the smallest per-condition sample count (8/32) and gate-decomposition overhead on the (0,3) pair.

Methodology in Plain English

The authors build a single quantum circuit that acts like a miniature transformer: input tokens are embedded into rotation angles on 12 qubits split into 4 position registers of 3 qubits each, and each of 2 circuit layers first processes each register internally and then applies entangling gates between causally connected register pairs (j < i) to move information between positions. Gate-level details are withheld for intellectual-property reasons, but the register topology, layer structure, causal entangling pattern, parameter counts, and post-transpilation depth (~125–229 two-qubit gates) are disclosed, and all interpretability metrics are defined on reduced density matrices independent of gate decomposition.

Because a transformer's opacity comes from not knowing what it should be doing, the authors design four tiny tasks over a vocabulary of 5 tokens and sequences of length 4 where the correct dependency structure is known in advance. In copy k, every output position copies position 1. In lookup, position 0 holds an index telling the model which position to broadcast. In conditional, position 0 selects between a left-shift and a reverse transformation. In repeat, each position copies itself and no communication is needed.

They then compute metrics directly from the statevector at each layer boundary: mutual information between registers (a physics-grounded attention map), entanglement entropy per register, participation ratio (how much of the 4096-dimensional Hilbert space is actually used), and fidelity between successive layer states. To check causality rather than mere correlation, they retrain variants with the inter-register entangling gates switched off while keeping parameter counts and readout fixed. Models are trained with cross-entropy loss using Adam at a learning rate of 5×10⁻³ for 300 epochs, with bootstrap 95% confidence intervals (1000 resamples) and permutation tests (10,000 permutations). Finally, they translate every exact metric into a shot-count estimator — Shannon MI with Miller–Madow bias correction, Rényi-2 purity, empirical participation ratio, and SWAP-test or shadow-tomography fidelity — and run the circuits on IBM's 156-qubit Heron r2 processor using 3 seeds × 128 circuits × 4,096 shots (2.18 minutes of QPU time per seed).

Why This Matters

Impact on research: The paper reframes quantum machine learning's value proposition. Rather than arguing only for computational speedup, it argues that quantum models offer structural interpretability advantages classical models lack, because correlations in a circuit are mediated by entanglement — a scarce, deliberately allocated resource — and quantum information theory provides exact, basis-independent measures of them. It also supplies a methodological template: design tasks with known dependency structure so that interpretability claims can be validated against ground truth, and use gate-level ablations to establish causation rather than correlation. The finding that a negative control (repeat) develops non-zero MI for reasons unrelated to task structure is a caution that MI alone is not a clean readout of task-relevant computation.

Potential real-world applications:

  • Auditing and compliance for high-stakes AI: the EU AI Act is cited as motivation; intrinsic, physics-based interpretability signals could support regulatory scrutiny of models in safety-critical settings.
  • Debugging quantum models during development: the failure-mode breakdown (diffuse versus misrouted MI) points directly at architectural fixes such as deeper circuits or more structured entangling topologies.
  • Hardware-aware quantum software engineering: shot-count convergence results indicate how much sampling budget is needed before interpretability signals stabilize, informing experiment design on near-term processors.
  • Quantum architecture search and benchmarking: MI matrices act as task fingerprints whose pairwise separations reflect distinct computational demands, offering a diagnostic beyond raw accuracy.

Industry relevance: The work is directly relevant to quantum cloud providers and hardware vendors (the validation is on IBM hardware and reports explicit QPU time), to teams building quantum machine learning applications who need assurance that their circuits compute what they intend, and to organizations facing AI governance requirements who are evaluating whether quantum-enhanced models can be made more auditable than their classical counterparts. The authors are affiliated with Query Machines B.V.

Future Directions

  • Scaling beyond small synthetic tasks: the authors explicitly frame their results as proof-of-concept on small synthetic tasks and call for study of whether the interpretability advantage persists at scale; sequence length, vocabulary, register count, and circuit depth are all far below practical workloads.

  • Sharper per-sample routing: the residual gap between group-level selectivity (~78%) and accuracy (~83%), and the 80% share of errors from diffuse MI, point to more selective routing as a concrete architectural target — via deeper circuits or more structured entangling topologies.

  • Closing the simulation-to-hardware gap: absolute MI values are not comparable between simulation and hardware because shot-based MI is Shannon MI over measurement outcomes rather than von Neumann MI over the state, and decoherence compresses values further. Only ordinal structure is preserved. Larger per-condition samples and backends exposing the attention entangler natively are proposed as remedies for the specific x₀ = 3 hardware miss.

  • Separating task-driven from readout-driven MI: the repeat-task result shows that readout basis constraints generate MI unrelated to inter-position routing. Distinguishing these two sources in general, and understanding how readout design shapes what interpretability metrics report, remains an open question the paper raises but does not resolve.

Target Audience

Researchers and practitioners in quantum machine learning and variational quantum algorithms who want to understand what a trained circuit has actually learned; quantum information theorists interested in applying entropy and fidelity measures as diagnostic tools; interpretability researchers in classical machine learning curious about a physically grounded alternative to post-hoc attribution methods; and quantum hardware and cloud teams evaluating realistic sampling budgets and noise effects for interpretability workloads. Readers without a quantum information background will find the conceptual framing accessible but the metrics and experimental design demanding.

Authors’ abstract

Deep learning models are powerful but opaque. As quantum machine learning matures, the field faces a defining choice: build quantum models that are equally opaque, or exploit the mathematical structure of quantum mechanics to make them inherently interpretable. We show that the latter is possible. By tracking quantum mutual information~(MI), entanglement entropy, and state fidelity through the layers of a Quantum Transformer Block (\qtb{}), a fully-coherent variational circuit with quantum analogues of both attention and feedforward, we gain direct insight into how the model processes information: which tokens it attends to, when correlations form, and why predictions fail. On four tasks with known dependency structure we show that (i)~learned MI matrices align with ground-truth task structure (AUC$\,{=}\,0.69$ on lookup), (ii)~disabling entangling gates collapses accuracy from 100\% to 15\% while MI$\to 0$, proving entanglement is the mechanism, (iii)~accuracy and MI co-evolve during training ($ρ\,{=}\,0.92$ on lookup), and (iv)~per-sample MI predicts prediction correctness on the conditional task with ROC AUC$\,{=}\,0.84$. All results are validated on IBM Quantum hardware (ibm\_kingston, Heron~r2): the circuit's reasoning process, from product state through structured entanglement, is directly observable on a superconducting processor. These proof-of-concept results, obtained on small synthetic tasks, suggest that the physics of quantum computation can provide intrinsic interpretability signals with no direct classical counterpart, motivating study of whether this advantage persists at scale.

Read the original paper