Manuscript Offprint

arXiv:2608.30367

Beat-Synchronous Tokenization for ECG Transformers

Ahmed Sameh, Nolan Wilson, Max Enderlein, Yogatheesan Varatharajah

ABSTRACT

Transformer-based electrocardiogram (ECG) models commonly tokenize waveforms into fixed temporal patches. Though convenient, fixed patching can split heartbeat structures across token boundaries. We study beat-synchronous tokenization as a physiologically grounded alternative, comparing fixed patches with three beat-aligned strategies: resampled beats, adaptive pooled beats, and resampled beats augmented with R–R interval information. Experiments span two settings: 10-second 12-lead diagnostic classification on PTB-XL after MIMIC-IV-ECG masked pretraining, and 60-second single-lead rhythm classification on Icentia11k after patient-level contrastive pretraining. On PTB-XL, resampled beat tokens achieve the highest mean macro Area Under the ROC Curve (AUROC; 0.8945) and nearly match the best fixed-patch macro Area Under the Precision-Recall Curve (AUPRC; 0.7414), reducing average sequence length from 100 to 11.2 tokens. On Icentia11k, beat-synchronous tokenizers obtain comparable AUPRC to fixed patching with better stability across runs. These results suggest morphology-preserving beat tokenization is a compact, competitive alternative to fixed temporal patching.

Index Terms— Electrocardiography, ECG Transformers, tokenization, beat-synchronous tokenization, self-supervised learning, representation learning, token efficiency

1. INTRODUCTION

Electrocardiography (ECG) provides a compact, non-invasive view of cardiac electrical activity and remains central to cardiovascular screening, diagnosis, and monitoring. Deep learning has substantially improved automated ECG analysis across clinical prediction tasks [1, 2, 3]. However, fully supervised ECG models often depend on large expert-labeled datasets, which are costly to curate and difficult to scale across institutions, devices, and patient populations. Self-supervised learning (SSL) addresses this bottleneck by pretraining ECG encoders on unlabeled recordings and transferring the learned representations to downstream tasks [4, 5]. This direction has recently expanded toward ECG foundation models trained at large scale for broad transfer across clinical settings [6, 7].

Despite these advances, many Transformer-based ECG models still represent the waveform as a sequence of fixed temporal patches. Fixed patching is simple and compatible with common SSL objectives such as masked reconstruction [8] or contrastive learning [9, 4], but it treats ECGs as generic time series rather than structured cardiac recordings. A fixed patch may split a cardiac cycle across token boundaries or mix adjacent beats, even though ECG interpretation often depends on beat morphology, inter-beat timing, and rhythm-level organization. Since heart rate varies across patients and recording conditions, the same patch length can correspond to different physiological content across examples.

Recent ECG models have begun to replace fixed temporal patches with beat-aware or physiologically structured representations [10, 11, 12, 13, 14]. These studies support the value of aligning ECG representations with cardiac structure, but tokenization is often introduced together with other modeling changes, such as specialized architectures, discrete vocabularies, or ECG-text training. However, the effect of tokenization alone on performance and efficiency remains unclear.

In this work, we test the hypothesis that beat-synchronous tokens are more efficient alternatives to fixed temporal patches under matched Transformer pretraining and downstream evaluation protocols. We compare fixed temporal patches with three beat-synchronous tokenizers: resampled beat tokens, adaptive pooled beat tokens, and resampled beat tokens augmented with R–R interval information. This setup allows us to evaluate whether cardiac-cycle alignment improves the performance–efficiency tradeoff while keeping the encoder family and evaluation protocol controlled.

We evaluate our hypothesis in two complementary settings. First, we pretrain 12-lead ECG Transformers on MIMIC-IV-ECG [15] using the masked reconstruction SSL objective and evaluate transfer to PTB-XL [16] diagnostic classification on five superclasses. Second, we pretrain single-lead models on the Icentia11k dataset using a contrastive learning objective and evaluate 60-second dominant rhythm classification [17]. These settings test beat-synchronous tokenization on both standard 10-second clinical ECGs and longer-term ambulatory recordings.

Our results show that beat-synchronous tokenization can retain strong downstream performance while using substantially shorter token sequences. On PTB-XL, the resampled beat tokenizer achieves the highest mean macro AUROC,

1^{1} Computer Science & Engineering, University of Minnesota Twin Cities, Minneapolis, MN 55455, USA. {sameh002, wils2744, ender121, yvaratha}@umn.edu

© 2026 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works.

while the R–R augmented tokenizer remains close to the strongest fine-patch baseline; both use only 11.2 tokens on average compared with 100 tokens for the finest fixed-patch tokenizer. The adaptive-pooling variant performs substantially worse, indicating that beat alignment alone is insufficient without a morphology-preserving beat encoder. On Icentia11k, where atrial fibrillation/atrial flutter (AFib/AFL) windows are rare, beat-synchronous tokenizers obtain comparable AUPRC to fixed patching and show lower run-to-run AUPRC variability, while using approximately 68 beat tokens on average compared with 93 fixed tokens. Overall, these findings suggest that beat-synchronous tokenization can be an effective and token-efficient alternative to fixed temporal patching, but the design of the beat encoder is critical.

References (20)