BixECG — Bi-mLSTM (2,522 parameters)
Official model weights for the paper "A Compact, Uncertainty-Aware mLSTM Model for Real-Time ECG Delineation on Edge Devices" (Lung et al., 2026; preprint).
BixECG performs per-sample ECG waveform delineation — classifying every sample of a single-lead ECG as No-Wave (NW), P-wave, QRS-complex, or T-wave — using a bidirectional matrix-memory LSTM (Bi-mLSTM), the mLSTM block of the xLSTM family. The selected model has only 2,522 parameters (≈10 kB), enabling real-time inference on microcontroller-class edge hardware (Arduino Portenta H7, Cortex-M7).
Model details
| Architecture | Bidirectional mLSTM, 3 blocks, embedding dim 8, 1 head, conv-stem kernel 11 |
| Parameters | 2,522 |
| Input | Single-lead ECG, 250 Hz, 300-sample R-peak-anchored window, per-window z-score |
| Output | Per-sample class logits over {NW, P, QRS, T} |
| Training data | QTDB (PhysioNet) |
| License | GPL-2.0-only (© Medical University of Vienna) |
Performance (tolerance-aware macro-F1)
| Dataset | Macro-F1 | Notes |
|---|---|---|
| LUDB (external) | 0.94 | κ 0.92; QRS F1 0.98 |
| LVAD-DB (external, pooled 2 raters) | 0.91 | 0.94 vs engineer, 0.88 vs cardiologist |
| D-Heart pilot (on-device, live) | 0.93 | κ 0.89; 128.6 ms/beat; 22 kB SRAM |
Boundary tolerances: P ±52 ms, QRS ±48 ms, T ±124 ms.
Usage
import torch
from bixecg.models.models import get_model # pip install git+https://github.com/CellularSyntax/BixECG
cfg = {"name": "bimlstm", "params": {
"input_dim": 1, "num_classes": 4, "embedding_dim": 8,
"num_blocks": 3, "num_heads": 1, "conv1d_kernel_size": 11, "dropout": 0.1}}
model = get_model(cfg)
sd = torch.load("bixecg_mlstm_2522.pt", map_location="cpu")
model.load_state_dict(sd.get("model_state_dict", sd))
model.eval()
# x: (batch, 300, 1) single-lead, 250 Hz, per-window z-scored, R-peak-anchored
# logits = model(x) -> (batch, 300, 4); labels = logits.argmax(-1)
See the code repository for preprocessing, R-peak anchoring, tolerance-aware evaluation, and uncertainty analysis.
Data availability
QTDB and LUDB are public (PhysioNet). The LVAD-DB and D-Heart pilot recordings are not distributed with this model — they are proprietary patient data under data-protection regulations, available from the corresponding author on reasonable request.
Citation
Lung D, Heute P, Marx M, Schlöglhofer T, Abart T, Moscato F, Riebandt J, Zimpfer D, Haberbusch M. A Compact, Uncertainty-Aware mLSTM Model for Real-Time ECG Delineation on Edge Devices. 2026. (Preprint; journal submission in preparation.)
- Downloads last month
- -