ECG-FM: an open electrocardiogram foundation model

Kaden McKeen, Sameer Masood, Augustin Toma, Barry Rubin, Bo WangJAMIA 2025 · DOI

TL;DR

This paper introduces ECG-FM, a novel open-weight foundation model for electrocardiogram (ECG) analysis, trained using a hybrid self-supervised learning approach. ECG-FM demonstrates strong performance and label efficiency across various clinical tasks, significantly reducing the need for large, labeled datasets and paving the way for more accessible and reproducible ECG AI research.

What Problem Does This Paper Address?

Interpreting electrocardiograms (ECGs) is a crucial but complex task in healthcare. While AI has shown promise in automating this, most existing tools require massive amounts of expertly labeled ECG data. This creates a significant barrier to entry due to the cost and time involved in data annotation, hindering reproducibility and widespread adoption, especially in resource-constrained settings. Furthermore, the lack of standardized, open-weight foundation models makes it difficult to compare different approaches and build upon existing work. This paper aims to address these challenges by developing a powerful, generalizable, and openly accessible ECG foundation model.

Methods

The core of this work is ECG-FM, a transformer-based foundation model. It's pretrained using a hybrid self-supervised learning (SSL) strategy called WCR (wav2vec 2.0 + Contrastive Multi-Segment Coding + Random Lead Masking). This approach combines:

  • wav2vec 2.0's masked prediction: Similar to how language models mask words, this technique masks segments of the ECG signal, forcing the model to learn contextual representations to reconstruct them.
  • Contrastive Multi-Segment Coding (CMSC): This method treats temporally adjacent ECG segments as positive pairs, learning to make their representations similar while pushing apart representations of unrelated segments. This helps capture stable cardiac function over short intervals without relying on data augmentation.
  • Random Lead Masking (RLM): This technique randomly masks entire ECG leads during pretraining, encouraging the model to learn robust representations that are not overly dependent on any single lead. This also allows for finetuning on reduced lead sets.

The model architecture itself is based on wav2vec 2.0, featuring a CNN feature extractor followed by a BERT-like transformer encoder.

Datasets

The researchers utilized a combination of publicly available and private datasets:

  • Pretraining: The model was pretrained on a large corpus of approximately 1.5 million 12-lead ECGs, including data from PhysioNet 2021 (datasets: CPSC, CPSC-Extra, PTB-XL, Georgia, Ningbo, Chapman) and MIMIC-IV-ECG v1.0.
  • Downstream Tasks: For evaluation, they used:
  • UHN-ECG: A private, institutional dataset containing 622k ECG recordings, held out from pretraining to assess cross-dataset generalization.
  • MIMIC-IV-ECG: Used for evaluating machine-read ECG interpretations.
  • UHN-ECG reduced LVEF: A subset of the UHN-ECG dataset specifically curated for predicting reduced left ventricular ejection fraction.

A new benchmark on the MIMIC-IV-ECG dataset for machine-read ECG interpretation was introduced.

Key Insights and Ideas

  • Hybrid SSL is Key: The combination of masked reconstruction, contrastive learning, and lead masking proved highly effective, capturing both low-level signal patterns and high-level cardiac semantics.
  • Label Efficiency is a Game-Changer: ECG-FM significantly outperforms traditional models, especially in low-data regimes, demonstrating that foundation models can drastically reduce the need for extensive manual labeling.
  • Generalization is Strong: The model shows excellent cross-dataset generalizability, performing well on the UHN-ECG dataset, which was not part of the pretraining data.
  • Open-Weight Models Drive Progress: By releasing ECG-FM, the authors aim to democratize ECG AI research, fostering transparency, reproducibility, and faster innovation.
  • Latent Space Reveals Meaning: Visualizations of the model's latent space show meaningful clustering of ECGs based on rhythm, heart rate, and pathology, indicating that the learned representations are physiologically relevant.

Key Results

  • Task-Specific Performance: Finetuned ECG-FM models outperformed task-specific baselines, particularly in small-to-medium data regimes.
  • High AUROC Scores: Achieved high AUROC scores on salient labels, including 0.996 for atrial fibrillation and 0.929 for LVEF ≤40%.
  • Label Efficiency: Demonstrated strong label efficiency, with competitive performance achieved with significantly fewer training samples compared to baselines.
  • Data Scaling Benefits: Linear probing experiments confirmed that the pretrained embeddings encode rich, task-relevant information, with performance scaling effectively with increased training data.
  • Robustness to Data Quality: The model showed resilience to low-quality recordings, with a notable portion of the test set labeled as "Poor data quality."

Limitations and Future Work

  • Input Segment Length: The CMSC objective requires consecutive segments, meaning ECG-FM accepts 5-second ECG inputs, while some datasets provide 10-second recordings. This can lead to an input-to-label mismatch for focal patterns, though segment-aware evaluation partially mitigates this.
  • Label Space Rigidity: The current framework predicts a fixed set of binary labels. While a knowledge graph helps aggregate subtypes, it collapses heterogeneous phenotypes. Future work could explore text-conditioned frameworks or multimodal foundation models.
  • Hierarchical Labeling: The authors suggest that hierarchical labeling might better capture the nuances of clinician interpretation than the current composite labels.
  • Further Integration: Integrating ECG-FM into text-conditioned frameworks and multimodal foundation models as an ECG encoder is a promising future direction.

Summary updated

Abstract

ECG-FM is an open, rigorously validated ECG foundation model intended to accelerate transparent, comparable research in the ECG analysis subfield. It is designed for rapid integration and evaluation, especially for delivering practical gains in low-label settings. We release our code, model weights, tutorials, and benchmark at https://github.com/bowang-lab/ECG-FM/.
BibTeX
@inproceedings{mckeen2025ecg,
  author = {Kaden McKeen and Sameer Masood and Augustin Toma and Barry Rubin and Bo Wang},
  title = {{ECG-FM: an open electrocardiogram foundation model}},
  booktitle = {JAMIA},
  year = {2025},
  doi = {10.1093/jamiaopen/ooaf122},
}
Figure