Zhejiang University / University of Illinois Urbana-Champaign / Shanghai Jiao Tong University / Hong Kong University of Science and Technology
A two-stage pretrained ECG foundation model that learns discrete rhythm tokens for robust multitask cardiac analysis on noisy, real-world electrocardiograms.
Electrocardiograms (ECGs) are the most widely collected cardiac biosignal, but real-world recordings are noisy, vary in length and lead configuration, and span a wide range of clinical tasks that have historically required bespoke models. AnyECG is a self-supervised ECG foundation model designed to learn transferable representations directly from heterogeneous, real-world ECG data, so that a single pretrained backbone can be adapted to many downstream cardiac problems rather than training a new network for each.
Introduced in November 2024 by researchers at Zhejiang University, the University of Illinois Urbana-Champaign, Shanghai Jiao Tong University, and the Hong Kong University of Science and Technology (Guangzhou), AnyECG reframes ECG modeling around discrete, clinically meaningful "rhythm codes." Its central idea is a tokenizer that converts continuous, noisy waveforms into a compact vocabulary of local rhythm tokens capturing morphological, frequency, and demographic structure, which a masked-modeling encoder then learns to predict from context.
The result is a backbone that generalizes across four otherwise distinct tasks evaluated in the paper: anomaly detection, arrhythmia classification, corrupted-lead generation (signal restoration), and ultra-long ECG recognition. The authors report an average improvement of roughly 6% over task-specific baselines across these settings.
AnyECG is a Transformer-based model released in base, large, and extra-large configurations, with the largest variant (AnyECG-XL) reaching roughly 1.7B parameters. Stage one learns a vector-quantization codebook that maps ECG patches to discrete tokens using a combination of morphology, frequency, demography, codebook, and commitment losses; stage two masks random patches and trains the encoder to recover the missing code indices, with Cardio-Sparse Attention reducing the quadratic attention cost over long sequences. Pretraining draws on seven public ECG corpora—CPSC, CPSC-Extra, INCART, PTB, PTB-XL, the Georgia 12-lead challenge set, and an additional collection—totaling on the order of 50,000 recordings. On the four evaluation tasks, AnyECG-XL reports strong results including roughly 0.86 AUROC and 0.89 weighted F1 for anomaly detection and about 0.91 AUROC for ultra-long ECG analysis, while AnyECG-L achieves 32.74 dB PSNR and 0.874 SSIM on corrupted-lead reconstruction.
AnyECG is intended as a reusable backbone for cardiac signal analysis in research and, prospectively, clinical decision support. Its discrete tokenization and sparse attention make it well suited to settings where recordings are long, noisy, or inconsistently leaded—such as ambulatory and Holter monitoring, automated triage of 12-lead ECGs, and quality-control pipelines that must reconstruct corrupted leads. Because a single pretrained model transfers across anomaly detection, arrhythmia classification, restoration, and ultra-long recognition, it can reduce the per-task labeling and engineering burden for groups building ECG analysis tools.
AnyECG contributes to the growing effort to bring foundation-model methodology to physiological biosignals, where ECG is a natural early target given its scale and clinical importance. Its rhythm-tokenizer-plus-masked-modeling recipe and Cardio-Sparse Attention offer a concrete template for handling the length and noise of real-world cardiac data. Adoption is currently limited by openness: the companion repository (PKUDigitalHealth/AnyECG-Lab) is sparse, carries no declared license, and does not provide a confirmed pretrained-weight download, so independent reproduction and reuse of the released checkpoints are not yet straightforward.
Wang, Y., et al. (2024) AnyECG: Foundational Models for Multitask Cardiac Analysis in Real-World Settings.
DOI: 10.48550/arXiv.2411.17711Papers that recently cited this model.
The most-cited papers that cite this model.
Not enough data