arXiv:2608.23347cs.LGAug 2026

Manuscript Offprint

arXiv:2608.23347

Test-Time Adaptation for ECG Classification via SQI-Gated Self-Training and Beat-Rhythm Consistency

Wenhan Jiang, Zhipeng Deng, Jiale Zhou, Haolin Wang, Yafei Ou, Yefeng Zheng

Wenhan Jiang 1^{1}, Zhipeng Deng 1^{1} ⊗\otimes, Jiale Zhou 1^{1}, Haolin Wang 2^{2}, Yafei Ou 3^{3}, and Yefeng Zheng 1^{1} ⊗\otimes

1^{1} Westlake University, Hangzhou, China

2^{2} Hokkaido University, Sapporo, Japan

3^{3} RIKEN, Japan

{jiangwenhan, dengzhipeng, zhoujiale, zhengyefeng}@westlake.edu.cn; yafei.ou@riken.jp

Abstract. Deep learning models for electrocardiogram (ECG) classification often suffer from significant performance degradation when deployed in unseen domains due to shifts in acquisition devices and patient populations. Test-time adaptation (TTA) offers a practical solution by adapting models using only unlabeled data at inference time. However, existing TTA methods often underperform on ECG tasks, since naive online updates ignore the hierarchical beat-rhythm structure of cardiac cycles and are vulnerable to signal artifacts, which leads to unstable adaptation and model drift. We propose BeatRhythm-TTA, an ECG-tailored TTA framework that explicitly accounts for ECG's noisy observations and structured beat-rhythm semantics under domain shift. First, to handle pervasive ECG artifacts, we introduce a Signal Quality Index (SQI)-gated adaptation scheme that selectively filters out low-quality signals to prevent harmful updates. Second, to leverage ECG's beat-rhythm semantics, we enforce dual-level consistency so the model preserves beat morphology and rhythm dynamics while adapting to shifted acquisition conditions. Extensive experiments on multi-label ECG diagnosis across three adaptation protocols, using PTB-XL as the source domain and CPSC2018/Georgia as two target domains, demonstrate the effectiveness of our method, yielding an average +2.70% relative improvement in Macro-F1 over the best competing method. The code is available at https://github.com/Vincent-Wenhan/BeatRhythm-TTA.

Keywords: Test-Time Adaptation · ECG Classification · Domain Shift

1 Introduction

Although deep learning has achieved strong performance on electrocardiogram (ECG) interpretation [15,21], generalizing pretrained models to unseen clinical environments remains challenging due to distribution shifts introduced by heterogeneous hardware and patient cohorts [7,18]. Re-training or fine-tuning for

W. Jiang et al.

Figure

Fig. 1. Motivation of the proposed BeatRhythm-TTA. Comparison of TTA strategies. Generic TTA methods are brittle on ECG, while BeatRhythm-TTA leverages beat-rhythm semantics for robust adaptation. (AF denotes atrial fibrillation, a cardiac rhythm disorder.)

each new target domain is often impractical in clinical practice as it requires substantial expert annotation and repeated engineering effort [18]. This motivates adopting test-time adaptation (TTA) from the broader machine learning literature [25,26], a paradigm that adapts a deployed model using only unlabeled test data, without requiring target labels or retraining from scratch.

Most TTA methods have been developed and validated primarily on vision benchmarks [25,26]. These methods are usually based on normalization calibration (e.g., AdaBN [13], MemBN [9]), entropy minimization (e.g., TENT [25], SAR [17], DeYO [12]), or confidence- or energy-based objectives (e.g., COME [30], TEA [28]). Recent work has extended TTA beyond vision, showing promising performance in speech, audio, and AI-for-science under distribution shifts [10,11,29,31]. A closely related paradigm is source-free domain adaptation (SFDA) [8,14,27], which similarly addresses domain shifts without source data but is typically formulated as an offline adaptation stage before deployment. Despite progress in other modalities, ECG-specific TTA remains underexplored, as directly transferring existing methods raises modality-specific challenges. First, adapting models on continuous ECG streams corrupted by transient artifacts (e.g., baseline wander, motion artifacts) amplifies spurious correlations and triggers drift. Second, many existing TTA objectives (e.g., global entropy minimization) ignore the hierarchical beat-rhythm semantics that underlie ECG diagnosis [2,23].

To this end, we propose BeatRhythm-TTA, a semantically grounded TTA framework comprising two complementary components. First, SQI-gated adaptation selectively scales or blocks test-time updates based on a signal quality index (SQI) to avoid harmful adaptation on noisy segments. Second, dual-level consistency enforces beat- and rhythm-level agreement to preserve physiologically motivated semantics at two temporal scales [6]: local beat morphology (e.g., ST-segment changes [23]) and global rhythm irregularities (e.g., atrial fibrillation [2]). By coupling reliability-aware gating with physiologically grounded consistency, BeatRhythm-TTA reduces drift under real-world domain shifts. Ex-

Figure

Fig. 2. BeatRhythm-TTA Framework. Given an unlabeled target ECG, adaptation is driven by two complementary modules. (1) SQI-gated pseudo-labeling: Blocks self-training updates based on teacher confidence and beat-wise signal quality, where EMA (exponential moving average) maintains a slowly updated teacher for more stable pseudo-labels. (2) Dual-level consistency: Enforces rhythm- and beat-level agreement between clean and augmented views to stabilize adaptation.

tensive experiments on multi-label ECG classification across three adaptation protocols, using PTB-XL as the source domain and CPSC2018/Georgia as two target domains, validated the effectiveness of our approach. It outperforms the strongest competing methods with an average +2.70% relative improvement in Macro-F1 across protocols.

References (31)