Table of Contents
Fetching ...

ECG-RAMBA: Zero-Shot ECG Generalization by Morphology-Rhythm Disentanglement and Long-Range Modeling

Hai Duong Nguyen, Xuan-The Tran

TL;DR

ECG-RAMBA addresses cross-domain generalization in ECG classification by disentangling morphology and rhythm and integrating them through a context-aware Bi-Directional Mamba backbone. It combines deterministic morphology features from MiniRocket, explicit HRV rhythm descriptors, and a long-range contextual backbone with cross-modal attention, plus a numerically stable Power Mean pooling for slice-to-record aggregation. In protocol-faithful evaluations, it shows competitive in-distribution performance and strong zero-shot generalization across external datasets, with rhythm-driven signals transferring more reliably than morphology under domain shifts. Ablation and interpretability analyses confirm the necessity of rhythm modeling and long-range context, and lead-drop experiments validate physiologically grounded disentanglement, providing deployment-oriented insights for robust ECG AI.

Abstract

Deep learning has achieved strong performance for electrocardiogram (ECG) classification within individual datasets, yet dependable generalization across heterogeneous acquisition settings remains a major obstacle to clinical deployment and longitudinal monitoring. A key limitation of many model architectures is the implicit entanglement of morphological waveform patterns and rhythm dynamics, which can promote shortcut learning and amplify sensitivity to distribution shifts. We propose ECG-RAMBA, a framework that separates morphology and rhythm and then re-integrates them through context-aware fusion. ECG-RAMBA combines: (i) deterministic morphological features extracted by MiniRocket, (ii) global rhythm descriptors computed from heart-rate variability (HRV), and (iii) long-range contextual modeling via a bi-directional Mamba backbone. To improve sensitivity to transient abnormalities under windowed inference, we introduce a numerically stable Power Mean pooling operator ($Q=3$) that emphasizes high-evidence segments while avoiding the brittleness of max pooling and the dilution of averaging. We evaluate under a protocol-faithful setting with subject-level cross-validation, a fixed decision threshold, and no test-time adaptation. On the Chapman--Shaoxing dataset, ECG-RAMBA achieves a macro ROC-AUC $\approx 0.85$. In zero-shot transfer, it attains PR-AUC $=0.708$ for atrial fibrillation detection on the external CPSC-2021 dataset, substantially outperforming a comparable raw-signal Mamba baseline, and shows consistent cross-dataset performance on PTB-XL. Ablation studies indicate that deterministic morphology provides a strong foundation, while explicit rhythm modeling and long-range context are critical drivers of cross-domain robustness.

ECG-RAMBA: Zero-Shot ECG Generalization by Morphology-Rhythm Disentanglement and Long-Range Modeling

TL;DR

ECG-RAMBA addresses cross-domain generalization in ECG classification by disentangling morphology and rhythm and integrating them through a context-aware Bi-Directional Mamba backbone. It combines deterministic morphology features from MiniRocket, explicit HRV rhythm descriptors, and a long-range contextual backbone with cross-modal attention, plus a numerically stable Power Mean pooling for slice-to-record aggregation. In protocol-faithful evaluations, it shows competitive in-distribution performance and strong zero-shot generalization across external datasets, with rhythm-driven signals transferring more reliably than morphology under domain shifts. Ablation and interpretability analyses confirm the necessity of rhythm modeling and long-range context, and lead-drop experiments validate physiologically grounded disentanglement, providing deployment-oriented insights for robust ECG AI.

Abstract

Deep learning has achieved strong performance for electrocardiogram (ECG) classification within individual datasets, yet dependable generalization across heterogeneous acquisition settings remains a major obstacle to clinical deployment and longitudinal monitoring. A key limitation of many model architectures is the implicit entanglement of morphological waveform patterns and rhythm dynamics, which can promote shortcut learning and amplify sensitivity to distribution shifts. We propose ECG-RAMBA, a framework that separates morphology and rhythm and then re-integrates them through context-aware fusion. ECG-RAMBA combines: (i) deterministic morphological features extracted by MiniRocket, (ii) global rhythm descriptors computed from heart-rate variability (HRV), and (iii) long-range contextual modeling via a bi-directional Mamba backbone. To improve sensitivity to transient abnormalities under windowed inference, we introduce a numerically stable Power Mean pooling operator () that emphasizes high-evidence segments while avoiding the brittleness of max pooling and the dilution of averaging. We evaluate under a protocol-faithful setting with subject-level cross-validation, a fixed decision threshold, and no test-time adaptation. On the Chapman--Shaoxing dataset, ECG-RAMBA achieves a macro ROC-AUC . In zero-shot transfer, it attains PR-AUC for atrial fibrillation detection on the external CPSC-2021 dataset, substantially outperforming a comparable raw-signal Mamba baseline, and shows consistent cross-dataset performance on PTB-XL. Ablation studies indicate that deterministic morphology provides a strong foundation, while explicit rhythm modeling and long-range context are critical drivers of cross-domain robustness.
Paper Structure (39 sections, 6 equations, 7 figures, 2 tables)

This paper contains 39 sections, 6 equations, 7 figures, 2 tables.

Figures (7)

  • Figure 1: Overview of the proposed ECG-RAMBA architecture, illustrating the integration of deterministic morphological features (MiniRocket), rhythm-related descriptors (HRV), and bidirectional state-space modeling (BiMamba) within a unified, protocol-faithful framework.
  • Figure 2: Per-class performance comparison. The discrepancy between high ROC-AUC (orange) and conservative F1-scores (blue) highlights the model's safety-oriented ranking capability, particularly for morphological abnormalities.
  • Figure 3: Zero-shot generalization on CPSC-2021. The proposed method (Branch A) maintains robust AF detection, whereas the raw-signal baseline (Branch B) degrades significantly.
  • Figure 4: Zero-shot performance on PTB-XL. Global patterns (CD, STTC) transfer well, while localized pathologies (MI) are impacted by lead-set variations.
  • Figure 5: Impact of Lead Dropout on Morphology vs. Rhythm. Morphology classes (red) degrade significantly without spatial context (-12.0%), while Rhythm classes (green) remain robust (+2.1%), validating the physiological disentanglement hypothesis.
  • ...and 2 more figures