The electrocardiogram~(ECG) is a key diagnostic tool in cardiovascular health. Single-lead ECG recording is integrated into both clinical-grade and consumer wearables. We propose CLEF, the first foundation model for single-lead ECG, leveraging metadata–derived risk scores for each patient as guided supervisory signals. CLEF was pretrained on 161K patients from MIMIC-IV-ECG using 12-lead ECGs. We evaluated on 18 clinical classification and regression tasks across 7 held-out datasets, and benchmarked against 5 foundation model baselines and 3 self-supervised learning algorithms. Overall, out method achieves an ≥ 2.6% improvement in average AUROC for classification, and ≥ 3.2% reduction in MAE for regression, outperforming all self-supervised foundation model baselines. Beyond accuracy, CLEF advances multifacet and robust single-lead ECG analysis, enabling next-generation remote health monitoring and wearable intelligence.
- [Dec 2025] Paper released on arXiv
- [Nov 2025] Code and pretrained weights released
CLEF is an ECG foundation model trained with clinically-guided contrastive learning. This repository contains the implementation for our paper "CLEF: Clinically-Guided Contrastive Learning for Electrocardiogram Foundation Models".
Key features:
- Clinical-informed contrastive pretraining for better representation
- Pretrained models on 3 sizes: small, base, large
- Easy single-lead ECG representation extraction and downstream task evaluation
- Environment Setup — Docker and conda installation
- Pretraining — Run contrastive pretraining
- Downstream Tasks — Evaluation on diagnostic tasks
- Pretrained Weights — Download model checkpoints
- Dataset Preparation — Prepare PTB-XL, ICENTIA, etc.
- Example Notebooks — Jupyter tutorials
- Launch the interactive quickstart notebook:
notebooks/clef_quickstart.ipynb
| Model | Parameters | Download |
|---|---|---|
| CLEF-Small | 448K | Zenodo |
| CLEF-Medium | 30.7M | Zenodo |
| CLEF-Large | 296M | Zenodo |
We gratefully acknowledge the contributions of the following projects, which were instrumental in the evaluation of CLEF:
- Moment: moment-timeseries-foundation-model/moment
- Moirai: SalesforceAIResearch/uni2ts
- ECGFounder: PKUDigitalHealth/ECGFounder
- KED: control-spiderman/ECGFM-KED
- ST-MEM: bakqui/ST-MEM
- SimCLR: sthalles/SimCLR
- BYOL: lucidrains/byol-pytorch
- MoCo: facebookresearch/moco
If you use CLEF in your research, please cite:
@article{clef2024,
title={CLEF: Clinically-Guided Contrastive Learning for Electrocardiogram Foundation Models},
author={Yuxuan Shu, Peter Charlton, Fahim Kawsar, Jussi Hernesniemi, Mohammad Malekzadeh},
journal={arXiv preprint arXiv:2512.02180},
year={2025}
}
