Heterogeneous Excitable-Population Decoders for Estimating Blood Chemistry from the ECG

Deep networks can read abnormal blood values, such as high potassium, low albumin or rising urea, from a ten-second electrocardiogram (ECG). Nobody can say which physical property of the heart's electrical activity they are reading, so the estimates cannot be sanity-checked. They also cannot be compared across a patient's repeated recordings. This proposal forces the network to explain each heartbeat through a small biophysical simulator. That simulator is a "mean-field" model, borrowed from computational neuroscience, which describes a large population of excitable cells by a few aggregate quantities: average excitability, how spread out the cells' firing thresholds are, and a slow recovery variable. A sequence encoder reads the ECG and outputs these few numbers for each beat. The simulator turns them back into a synthetic multi-lead heartbeat that must match the recording. Laboratory values are then predicted from the recovered numbers.

The bet is that a handful of physically meaningful numbers per beat captures the part of the ECG that electrolytes and kidney function actually change. If so, those numbers should move in the right direction when the same patient's potassium moves, even when the recording conditions differ. A black-box network is not required to behave this way. The test that matters is therefore not a higher area under the ROC curve (AUROC) in the aggregate. It is whether within-patient changes in the inferred parameters track within-patient changes in blood chemistry, and whether this holds when leads are removed.

Core Claim

The claim is that the right place for neural mass modeling in ECG-based systemic sensing is as the decoder of an autoencoder, not as the whole predictor. It should also describe the myocardium, the heart's muscle tissue, not the brain. The file frames the opportunity differently. Its Gap 2 suggests coupling a brainstem autonomic model, like the vagus-nerve-stimulation network of Ingham et al., to ECG streams. That route is weak for this data: a 10-second MIMIC-IV-ECG strip holds roughly ten beats, far too few to identify slow autonomic loop dynamics.

The better-matched mechanism is the one the ECG literature already names. Serum potassium, calcium and magnesium shift the resting potential and action-potential duration of heart muscle cells (EKG-Diagnostik mit Hilfe künstlicher Intelligenz, Teil 2). In population terms, that is a shift in mean excitability and in the spread of excitability across tissue.

Exact mean-field reductions of heterogeneous spiking populations make that spread an explicit, fittable parameter. Gast et al. derived macroscopic equations for Izhikevich-type neurons whose thresholds follow a Lorentzian distribution with width $\Delta$. Gast, Solla and Kennedy showed that this width controls how synchronized the population fires. In cardiac terms, synchrony corresponds to how compressed or dispersed depolarization and repolarization are, which is roughly what QRS width and T-wave shape reflect. We reuse these equations as a caricature of ventricular tissue, not as a claim that heart cells are neurons.

The Model

The heart is represented as $K$ excitable populations; we start with $K=3$, loosely standing for septal, left and right ventricular mass. Each population $k$ follows a two-variable mean-field reduction of the kind used by Gast et al.: a population firing rate $r_k$ and mean membrane potential $v_k$. Following their Izhikevich formulation, we add a slow recovery variable $u_k$ that stands in for repolarization. In the quadratic integrate-and-fire form, with time constant $\tau$, mean excitability $\bar\eta_k$, threshold spread $\Delta_k$ and a pacing input $I_k(t)$, the fast part reads

$$\tau \dot r_k = \frac{\Delta_k}{\pi\tau} + 2 r_k v_k - \kappa u_k r_k, \qquad \tau \dot v_k = v_k^2 + \bar\eta_k + I_k(t) - (\pi \tau r_k)^2 - u_k,$$

where $\kappa$ scales how strongly recovery suppresses firing, and $u_k$ relaxes on a slower time constant toward a value set by $v_k$.

The body-surface signal on lead $\ell$ is modeled as $\hat x_\ell(t)=\sum_k L_{\ell k}\, \dot v_k(t)$. Here $L$ is a lead-field matrix initialized from the Frank vectorcardiogram transform, the fixed matrix that maps a single 3D heart vector onto the 12 leads. $L$ is then allowed to depart from that transform, with a penalty on the departure.

This directly generalizes the single-dipole assumption that LVCG acknowledges as its main physical simplification. We keep LVCG's geometric prior but let several populations with different timing contribute. The per-beat parameters $\theta=(\bar\eta_k,\Delta_k,\tau,\kappa, I_k \text{ timing})$ are the only channel through which the encoder may describe the beat, apart from a small, heavily penalized residual latent.

The encoder is a standard sequence feature extractor. We use the bidirectional structured state-space (S4) stack of Lopez Alcaraz and Strodthoff, a model that processes long signals through learned continuous-time linear dynamics. It reads the raw 12-lead strip and outputs $\theta$ for each detected beat. Training minimizes waveform reconstruction error through a differentiable ODE solver, plus prediction losses on continuous laboratory values. This is a change from the binary median cutoffs that the CardioLab papers themselves flag as a limitation. Demographics enter the prediction head, never the decoder, so that the physiological parameters cannot absorb age or sex directly.

Research Program

The first stage is a go/no-go test of expressiveness. The simulator must reconstruct real beats well enough to matter. We fit it beat by beat on PTB-XL healthy controls (PTB-XL, 9,528 normal records) and on MIMIC-IV-ECG. We report reconstruction error against the LVCG lead-reconstruction regime and against an unconstrained decoder of equal latent size. If the population model cannot reproduce T-wave morphology, which is plausible because the quadratic integrate-and-fire model has no plateau phase, the recovery variable must carry repolarization. If even that fails, we stop and report the negative result.

The second stage tests identifiability on synthetic data. We simulate beats from known $\theta$, add PTB-XL-style baseline drift and noise, and check whether the amortized encoder recovers $\bar\eta$ and $\Delta$ separately. If it confuses them, their clinical interpretation is empty.

The third stage is the systemic-sensing study on MIMIC-IV. We predict continuous and thresholded potassium, calcium, magnesium, urea nitrogen and creatinine, where a myocardial-excitability mechanism is plausible. We also predict NTproBNP and hemoglobin as mechanism-negative controls. For these we expect no advantage, since they reflect structural load and oxygen-carrying capacity rather than membrane excitability.

The fourth stage is the within-patient analysis. For patients with two or more ECG–lab pairs, we regress the change in predicted concentration on the change in measured concentration. We also test whether the inferred parameters move in the direction expected from membrane physiology; for potassium, $\bar\eta$ should shift and $\Delta$ should narrow as T waves peak. This stage targets the fixed-threshold, patient-agnostic framing criticized in CardioLab.

Baselines

The naive reference point predicts each lab value from demographics and vital signs alone, using the same MLP head. Every ECG-based model must beat it, or the ECG adds nothing. For the within-patient analysis the naive reference is stronger: carry forward the patient's previous lab value. Any real tracking claim must add information beyond it.

The strongest existing waveform method is the multimodal S4 model of Abnormality prediction and forecasting of laboratory values from electrocardiogram signals using multimodal deep learning: four bidirectional S4 blocks on the 10-second waveform, late-fused with a three-layer MLP on metadata. It reports AUROC 0.903 for NTproBNP ≥ 353 pg/mL and 0.870 for hemoglobin. The conference version ( CardioLab: Laboratory Values Estimation and Monitoring from Electrocardiogram Signals - A Multimodal Deep Learning Approach) reports 0.882 for NTproBNP, and we will reproduce rather than quote. For the electrolytes that are our primary targets, no reported result was found on Lacuna for potassium, calcium or magnesium. Those baseline numbers must therefore come from our own rerun.

We run this baseline with the identical encoder, identical patient-level splits, identical metadata, and the same hyperparameter search budget in GPU-hours. Beating it means matching its AUROC within bootstrap confidence on the mechanism-positive targets, not losing more than a small pre-registered margin on the controls, and clearly winning on the robustness and within-patient tests below. We do not claim the bottleneck will raise in-distribution AUROC.

The strongest tabular method is the XGBoost model of CardioLab: Laboratory Values Estimation from Electrocardiogram Features. It uses engineered intervals, axes, vitals and demographics, and reports AUROC 0.901 for albumin, 0.881 for hemoglobin and 0.73–0.75 for creatinine. We rerun it on the same splits. We add T-wave amplitude and QT features, the classical hyperkalemia markers, so that the baseline is not straw-manned, using feature definitions of the PTB-XL+ kind (PTB-XL+).

The geometric baseline is LVCG-style Frank projection plus a GRU encoder (LVCG). It reports reconstruction MSE 0.47 versus 1.56 for Nef-Net when reconstructing 9 leads from 3. It represents the claim that geometry alone buys robustness.

Two ablations isolate the key ingredient. The first swaps the mean-field decoder for an unconstrained neural ODE with the same number of latent variables per beat, so any gain from low dimensionality alone is credited to the ablation. The second fixes $\Delta_k=0$, the homogeneous single-cell limit, to test whether the heterogeneity parameter taken from Gast et al. is what carries the signal.

Why not just…?

Why not just run XGBoost on QT, QRS and T-wave amplitude? For hyperkalemia this is the real threat: the mechanistic parameters may simply re-encode those intervals. We will measure mutual information and linear predictability of $\theta$ from the engineered features. If the features explain nearly all of $\theta$ and XGBoost matches us on the within-patient test, the honest conclusion is that the simulator is an interpretable reparameterization of known intervals. The possible advantage lies in noisy recordings, where onset and offset detection fails, as the CardioLab authors note. We will test this on PTB-XL records flagged for baseline drift and static noise.

Why not just give the S4 model a small latent bottleneck? A generic low-dimensional bottleneck might deliver the same robustness without any physics. The equal-dimension neural-ODE ablation tests exactly this. If it matches the mean-field decoder on lead dropout and within-patient tracking, the biophysical structure is not earning its place, and we will say so.

Why not just apply mean-field theory to initialize the recurrent encoder? Can, Krishnamurthy and Schwab show that setting gate variances near the edge of chaos creates slow modes and speeds training on Sequential MNIST. That is a cheaper way to "use mean-field theory." It changes optimization, not the meaning of the representation, and a 10-second strip of about ten beats does not stress long memory. We include a GRU encoder initialized in their slow-mode regime as a secondary baseline. We expect it to affect convergence speed but not the within-patient tracking of electrolytes.

Why not just use the Frank vectorcardiogram and stop there? LVCG already reports more than 10% AUC gains in low-label regimes and stability from 12 to 3 leads. If our multi-population lead field does not beat it under lead dropout, the extra populations are unnecessary. The comparison is run at 12, 6 and 3 leads.

Proposed Experiments

The decisive checks are three.

The first is the within-patient test. On MIMIC-IV patients with repeated ECG–lab pairs, we check whether the change in inferred parameters predicts the change in potassium and calcium beyond carry-forward. The effect should be significantly larger for the mean-field model than for the S4 baseline's final-layer embedding, with both passed through the same linear probe. It should vanish for the mechanism-negative controls. A gain that appears equally on NTproBNP would suggest the bottleneck is acting as a generic regularizer rather than as physiology.

The second is the shift test. We train on 12-lead data and evaluate with 3 leads, and separately train on ICU encounters and evaluate on emergency-department encounters within MIMIC-IV. This probes the ICU-to-ambulatory generalization gap noted in the file without claiming outpatient validity. The mean-field model should degrade less than S4 and XGBoost.

The third is the heterogeneity ablation. Setting $\Delta_k=0$ should hurt reconstruction of QRS width and T-wave dispersion and hurt electrolyte prediction specifically. If it does not, the neuroscience ingredient is decorative.

All results are reported with patient-level bootstrap intervals. Failure of the first-stage expressiveness check ends the project with a publishable negative result about the limits of excitable-population caricatures of the heart.