A Compact, Uncertainty-Aware mLSTM Model for Real-Time ECG Delineation on Edge Devices
DOI:
https://doi.org/10.31224/8818Keywords:
electrocardiogram waveform analysis, real-time signal processing, recurrent neural networks, wearable medical devices, predictive uncertaintyAbstract
Accurate electrocardiogram (ECG) waveform delineation underpins cardiac diagnosis and screening, yet the most accurate deep-learning models are too large for resource-constrained wearable and implantable systems. We present a compact, uncertainty-aware bidirectional matrix-memory LSTM (Bi-mLSTM) for per-sample P, QRS, and T delineation with only 2,522 parameters. The model operates on beat windows placed by automatic R-peak detection. It was selected and trained on the automatic annotations of the PhysioNet QT Database, frozen, and evaluated against expert annotations of the Lobachevsky University Database (LUDB, 200 subjects) and a clinical cohort of 25 patients with left ventricular assist devices (LVAD-DB). The tolerance-aware macro-F1 was 0.919 on LUDB and 0.875 on LVAD-DB (strict 0.850 and 0.761), the expected calibration error of the raw confidence was 0.054 and 0.041, and low confidence flagged the model’s own errors. Under tolerance-aware scoring, the model exceeded three published architectures with 0.3 to 1.4 million parameters, trained with the same windowing and procedure, on LUDB and matched the strongest of them on LVAD-DB with 119 times fewer parameters. Per record, model-derived QRS duration and QT exceeded the expert values by 12.7 and 11.3ms on LUDB, which supports trend monitoring rather than replacement of expert measurement. On an Arduino Portenta H7 microcontroller, a separately trained earlier version of the same architecture delineated a live recording in real time without quantization, with 128.6ms of processing per beat and 22 kB of memory. Accurate, calibrated, and uncertainty-aware ECG delineation is therefore feasible in real time on resource-constrained devices.
Downloads
Downloads
Additional Files
Posted
License
Copyright (c) 2026 David Lung, Philipp Heute, Manfred Marx, Thomas Schlöglhofer, Theodor Abart, Francesco Moscato, Julia Riebandt, Daniel Zimpfer, Max Haberbusch

This work is licensed under a Creative Commons Attribution 4.0 International License.