A Quantum Circuit That Diagnoses Why Classical AI Fails at Seizure Detection

The A-Gate architecture running on IBM quantum hardware revealed a hidden geometric structure in neural signals — one that explains a known limitation of classical methods and was invisible until a quantum circuit made it measurable.

Explore the Visualization → Read the Research ↓

17 qubits · IBM Heron · CHB-MIT dataset · 7 patients · LOSO validation

The Challenge

Seizure detection doesn't work the same for everyone

Epileptic seizures leave electrical signatures in brain activity. But those signatures look different from person to person — not just in intensity, but in direction. For some patients, a seizure pushes brain activity one way. For others, it pushes the opposite way.

Standard AI methods trained on many patients implicitly average these opposite signals together, canceling them out. The result is a model that performs poorly on anyone whose seizure pattern runs counter to the crowd.

This isn't a data problem or a model size problem. It's a geometry problem. The question is whether anyone was looking at it that way.

Cross-patient polarity on the SPD manifold

EEG covariance matrices live on the Symmetric Positive Definite (SPD) manifold. Cross-patient aggregation using Riemannian tangent space projection consistently underperforms simpler eigenvalue methods — a pattern attributed to inter-subject variability without a specific geometric mechanism.

We identify the mechanism: manifold polarity. Seizure-related covariance shifts point in opposite directions for different patients. Any method that preserves this directional information — Riemannian tangent space, quantum circuits with fixed measurement bases — suffers cross-patient degradation when opposing-polarity patients are aggregated without calibration.

Eigenvalue methods succeed by discarding directional information entirely (sorted eigenvalues are polarity-invariant). This implicit polarity invariance, not superior feature extraction, explains their consistent cross-patient performance advantage.

The quantum circuit didn't solve the problem. It made the problem visible.

A classical classifier learns to accommodate polarity silently — it adjusts its decision boundary per patient during training. The A-Gate quantum circuit uses a fixed measurement basis. There is no accommodation. For a patient whose seizure states sit on the wrong side of that basis, the circuit outputs AUC below 0.5 — below random chance. That sub-chance result is not failure. It is a signal. It tells you exactly which side of the manifold that patient's seizures occupy.

Polarity is a continuous strength

For a given measurement basis and channel configuration, each patient shows a stable polarity direction with varying strength (AUC 0.28–0.68). Polarity is not binary — it is a geometric signal whose magnitude depends on circuit depth, channel count, and coherence budget.

Polarity is basis-dependent

Quantum hardware, quantum simulation, and Riemannian methods each impose different reference orientations on the same manifold. Their polarity maps agree 57–71% of the time — more than chance, less than identical. Same brain, different measurement geometry.

Simulation is wrong in a useful way

Statevector simulation of the same circuit that achieves 0.637 calibrated AUC on hardware produces 0.460 raw AUC — below chance. Longer windows make it worse (0.386 at 20s). Exact amplitude computation causes opposing-polarity patients to cancel precisely. Hardware shot noise breaks the cancellation.

The Inversion

Hardware outperforms its own simulation

Statevector simulation of the A-Gate circuit consistently underperforms the noisy hardware execution — and the gap widens as input data quality improves.

Mode 1.95s window 20s window
Statevector simulation 0.460 AUC 0.386 AUC
IBM Heron hardware 0.524 raw · 0.637 calibrated pending

At 20-second windows, 6 of 7 patients become polarity-inverted in simulation. More data, worse result.

The mechanism: exact arithmetic causes the contributions of opposing-polarity patients to cancel precisely. The circuit becomes blind to the structure it was built to detect. Hardware shot noise breaks that cancellation stochastically — the imprecision is what preserves the signal.

This inverts the standard assumption in quantum ML, where noiseless simulation is treated as an upper bound on hardware performance. Here it is a lower bound.

Architecture

Quantum Dynamic Neural Unit

A QDNU is a quantum circuit that encodes sensory data as quantum states and processes them through an architecture inspired by excitatory-inhibitory neuron dynamics. The Positive-Negative (PN) neuron structure uses paired qubits — one tracking excitatory balance, one inhibitory — connected by entangling gates that mix information across channels the way neurons mix signals across brain regions.

The A-Gate encodes EEG phase synchrony (PLV theta-alpha, 4–13 Hz) as RZ rotation angles on 17 physical qubits on IBM Heron. The circuit applies 97 CZ entangling gates at transpiled depth 114. Phase-locking values between channel pairs encode the excitatory-inhibitory balance state. The measurement outputs a binary classification: the probability of the seizure state conditioned on the quantum state geometry.

EEG Channels
8 channels (M=8)
PLV Encoding
theta-alpha
RZ Gates
17 qubits
CZ Entangling
97 gates (native)
Measurement
binary out
AUC
0.637 calibrated

Key distinction: The A-Gate is not designed to outperform classical methods at classification. It is designed to expose geometric structure that classical methods absorb silently. The contribution is interpretability, not accuracy.

Empirical Results

CHB-MIT Seizure Detection — Cross-Patient LOSO

Leave-One-Subject-Out · IBM Heron r1 (ibm_torino) · 1024 shots

Note: Tier 2/3 classical results from 22-patient LOSO cohort. A-Gate quantum results from 7-patient subset.

Method Window AUC (raw) AUC (calibrated) Notes
Tier 2 — Eigenvalues + XGBoost 20s 0.873 0.873 Polarity-invariant by design
Tier 2 — Eigenvalues + XGBoost 1.95s 0.723 0.723 No calibration lift
Tier 3 — Riemannian + LDA 30s 0.490 0.724 Matches Tier 2 after calibration
A-Gate — IBM Heron hardware 1.95s 0.524 0.637 3/7 patients inverted
A-Gate — Statevector simulation 1.95s 0.460 0.540 Below chance without calibration
A-Gate — Statevector simulation 20s 0.386 0.630 More inversion, better calibrated

The calibration operation is a single sign bit per patient. Riemannian methods go from 0.490 → 0.724. Quantum hardware goes from 0.524 → 0.637. Both improve by the same mechanism. The quantum circuit exposes what was already there.

Per-patient hardware AUC
Patient Raw AUC Calibrated AUC Polarity
chb01 0.686 0.686 Standard
chb03 0.436 0.564 Inverted
chb05 0.610 0.610 Standard
chb07 0.667 0.667 Standard
chb11 0.283 0.717 Inverted
chb14 0.600 0.600 Standard
chb21 0.388 0.613 Inverted

Watch the Quantum Circuit Process Brain Signals in Real Time

Gate-by-gate animation of the A-Gate circuit on the SPD covariance manifold. Two patients — standard and inverted polarity — on the same circuit, trajectories diverging in opposite directions.

chb01 ictal
chb11 ictal
chb01 interictal
chb11 interictal
Launch Interactive Visualization →

Three.js · Web Audio API · IBM Heron Topology · No Install Required

More Visualizations

Research

Publication & Data

Manifold Polarity in EEG Classification

Under Review — Quantum Information Processing

Cross-patient EEG seizure detection using Riemannian geometry on the SPD manifold consistently underperforms simpler eigenvalue methods. We identify the mechanism: patient-specific manifold polarity. A quantum circuit with a fixed measurement basis makes this polarity an explicit observable — patients with sub-chance AUC are simply inverted, not unclassifiable.

IBM Quantum

Experiments run on IBM Heron r1 (ibm_torino), 133-qubit processor. 17 physical qubits active, 97 CZ gates, circuit depth 114. 1024 shots per circuit, no error mitigation.

Dataset

CHB-MIT Scalp EEG Database, 7 of 23 patients. Leave-One-Subject-Out cross-validation throughout. Window sizes tested: 1–30 seconds.

Pending

Hardware at 20s windows · 12-channel / 16-channel qubit scaling experiments