MS-ECG-FM: Towards a More Universal Electrocardiogram Foundation Model for Health Monitoring using Multi-source Contrastive Learning
Organizations: Massachusetts Institute of Technology (work done while at Apple). · Apple, Inc. · Division of Cardiology, Johns Hopkins Medicine. · Princeton University.
Abstract
Electrocardiography (ECG) records the electrical activity of the heart, aiding diagnosis by detecting abnormalities in cardiac function. ECG foundation models have demonstrated promising results, but are limited by a reliance on ECG interpretation reports as their sole supervision. Because interpretation reports only capture the subset of waveform information routinely recognized by clinicians, this constrains representation learning to overlook the broader diagnostic signals present in ECG. We introduce a new ECG foundation model --- MS-ECG-FM --- that is trained through contrastive alignment to multiple distinct clinical note types, including ECG, echocardiography, radiology, and discharge reports. We evaluate MS-ECG-FM on an extended set of ECG detection benchmarks, showing that it comprehensively outperforms existing methods on the full span of conditions that ECG can detect, including in reduced-lead configurations. Different reports improve representations for different diagnostic domains, while multi-source alignment captures their complementary information and produces consistently strong representations across clinically diverse tasks.
Figures & tables
| Single Lead | Lead Subsets | 12-lead | |||||||
| I (LCX) | II (RCA) | V2 (LAD) | I,II | All limb | I,II,V2 | I,II,III,V2 | 12-lead | ||
| All | Random | 76.4 | 77.7 | 73.7 | 81.1 | 81.7 | 81.0 | 82.3 | 83.6 |
| MERL | 63.5 | 66.6 | 68.5 | 69.7 | 63.5 | 75.8 | 79.0 | 88.8 | |
| D-BETA | 84.4 | 85.6 | 82.2 | 88.2 | 88.3 | 89.3 | 89.2 | 90.3 | |
| MELP | 84.9 | 86.0 | 81.9 | 89.1 | 89.2 | 90.6 | 90.7 | 91.2 | |
| ECGFounder | 86.2 | 86.4 | 83.1 | 89.0 | 88.9 | 90.0 | 90.8 | 91.5 | |
| AUROC | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| Group | Condition | Prevalence % (N) | Random | ECG-MR | ECG-CR | ECHO | Chest X-ray | Discharge | MS-ECG-FM |
| ARR | AFIB | 7.2% (152) | 93.2 | ∗ 98.4 | ∗ 98.5 | ∗ 98.0 | 97.9 | 97.9 | 98.7 |
| STACH | 3.9% (82) | 97.7 | ∗ 99.4 | 99.5 | 99.2 | 98.8 | 98.9 | ∗ 99.5 | |
| SARRH | 3.7% (77) | 58.2 | 89.8 | ∗ 94.1 | 74.0 | 75.0 | 78.7 | 94.4 | |
| SBRAD | 3.1% (64) | 93.5 | ∗ 96.5 | ∗ 96.6 | 95.8 | ∗ 95.4 | ∗ 96.4 | 96.7 | |
| SVARR | 0.7% (14) | 84.8 | ∗ 95.0 | 96.4 | ∗ 94.5 | 92.6 | ∗ 94.1 | ∗ 95.4 | |
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| MIMIC-IV data usage | Available | ||||||
|---|---|---|---|---|---|---|---|
| Model | Pre-training objective(s) | # Pretrain samples | ECG waveforms | Machine reports | Clinical notes | Code | Weights |
| ST-MEM Na et al. (2024) | Tokenizes 12-lead ECG recordings at spatio-temporal level (i.e., patches within individual leads). Then uses a modified masked-autoencoder (MAE) reconstruction objective. | 345,779 | ✗ | ✗ | ✗ | ✓ | ✓ |
| MERL Liu et al. (2024) | Multimodal contrastive ECG waveform & machine report objective ( InfoNCE ). Auxiliary unimodal contrastive ECG w/latent augmentation ( InfoNCE ). | 800,035 | ✓ | ✓ | ✗ | ✓ | ✓ |
| KED Tian et al. (2024) | Multimodal contrastive ECG waveform & LLM-augmented machine report objective, with concurrent use of labels from machine report. | 800,035 | ✓ | ✓ | ✗ | ✓ | ✓ |
| ECG-JEPA Kim (2024) | Uses Joint-Embedding Predictive Architecture ( JEPA ) self-distillation objective where masked latent representations of the ECG from the teacher network are predicted by the student network. | 174,140 | ✗ | ✗ | ✗ | ✓ | ✓ |
| ECG Founder Li et al. (2025) | Supervised multi-label classification with labels sourced from an ECG-machine analysis program. | 10,771,552 | ✗ | ✗ | ✗ | ✓ | ✓ |
| Methods | PTBXL-Super | PTBXL-Sub | PTBXL-Form | PTBXL-Rhythm | CPSC2018 | CSN | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | ||
| ST-MEM Na et al. (2024) | 61.12 | 66.87 | 71.36 | 54.12 | 57.86 | 63.59 | 55.71 | 59.99 | 66.07 | 51.12 | 65.44 | 74.85 | 56.69 | 63.32 | 70.39 | 59.77 | 66.87 | 71.36 | |
| HeartLang Jin et al. (2025) | 78.94 | 85.59 | 87.52 | 64.68 | 79.34 | 88.91 | 58.70 | 63.99 | 80.23 | 62.08 | 76.22 | 90.34 | 60.44 | 66.26 | 77.87 | 57.94 | 68.93 | 82.49 | |
| MERL Liu et al. (2024) | 82.39 | 86.27 | 88.67 | 64.90 | 80.56 | 84.72 | 58.26 | 72.43 | 79.65 | 53.33 | 82.88 | 88.34 | 70.33 | 85.32 | 90.57 | 66.60 | 82.74 | 87.95 | |
| D-BETA Hung et al. (2025) | 83.15 | 88.36 | 90.11 | 77.74 | 82.92 | 85.15 | 70.10 | 78.91 | 83.98 | 86.61 | 92.83 | 96.71 | 85.46 | 91.35 | 94.92 | 80.04 | 87.36 | 90.71 | |
| MELP Wang et al. (2025) | 85.82 | 87.61 | 87.87 | 79.22 | 84.40 | 87.46 | 63.41 | 76.71 | 83.30 | 88.83 | 94.65 | 96.91 | 88.54 | 91.75 | 94.32 | 78.25 | 84.83 | 90.17 | |
| ECG-FM | Number of ECG encoder parameters |
|---|---|
| Baselines | |
| MERL Liu et al. (2024) | M • tokenizer: M • transformer: M |
| D-BETA Hung et al. (2025) | M • tokenizer: M • transformer: M • class embedding, projection, and pooler: M |
| MELP Wang et al. (2025) | M • tokenizer: M • transformer: M • attentional pooler: M |
| ECGFounder Li et al. (2025) | M |
| MS-ECG-FM ECGViT | |
| Category | Diagnosis in clinical practice | ECG detection evidence | Evidence strength |
| Arrhythmias | |||
| Atrial fibrillation (AFib) | Diagnosed from standard ECG (12-lead, 10s) or ambulatory ECG (e.g., with Holter monitors) | Hannun et al. (2019) ; Ribeiro et al. (2020) | ★ |
| Silent or future atrial fibrillation | AFib is paroxysmal / episodic. No prototypical signatures in the ECG when AFib is not active. However, machine learning can be used to screen for AFib (future or latent) from normal sinus rhythm ECGs. | Attia et al. (2019c) ; Noseworthy et al. (2022) | ★ |
| Other supraventricular and ventricular arrhythmias | Diagnosed from standard ECG (12-lead, 10s) or ambulatory ECG (e.g., with Holter monitors) | Hannun et al. (2019) ; Ribeiro et al. (2020) | ★ |
| Conduction Disturbances | ECG-based diagnosis of atrioventricular and intraventricular conduction delays / blocks | Hannun et al. (2019) ; Ribeiro et al. (2020) | ★ |
| Ischemic Heart Disease |
| # | Diagnosis group | Dataset source and labels |
|---|---|---|
| 1 | All : all diagnostic labels | External model comparison: all labels from datasets (1) PTB-XL, (2) CPSC2018, (3) CSN, (4) EchoNext-Mini Internal model comparison: all labels from (1) PTB-XL, (2) CPSC2018, (3) CSN, (4) EchoNext-Mini, (5) MIMIC-IV-ECG-Ext-ICD |
| 2 | ARR : arrhythmias | PTB-XL Rhythm: atrial fibrillation (AFIB), sinus tachycardia (STACH), sinus arrhythmia (SARRH), sinus bradycardia (SBRAD), supraventricular arrhythmia (SVARR) |
| 3 | CD : conduction disturbances | PTB-XL Sub: left anterior/left posterior fascicular block (LAFB/LPFB), incomplete right bundle branch block (IRBBB), complete left bundle branch block (CLBBB), complete right bundle branch block (CRBBB), AV block (AVB), non-specific intraventricular conduction disturbance (block) (IVCD) |
| 4 | ECG-HYP : hypertrophy detected from ECG | PTB-XL Sub: left ventricular hypertrophy (LVH), right ventricular hypertrophy (RVH), left atrial overload/enlargement (LAO/LAE), right atrial overload/enlargement (RAO/RAE) |
| 5 | MI : myocardial infarction | PTB-XL Sub: anterior myocardial infarction (AMI), inferior myocardial infarction (IMI), lateral myocardial infarction (LMI) |
| 6 | ISC/STTC : ischemia and ST/T changes | PTB-XL Sub: ischemic in anterior leads (ISCA), ischemic in inferior leads (ISCI), non-specific ischemic (ISC_), ST-T changes (STTC), non-specific ST changes (NST_) |
| Code | Description |
|---|---|
| AFIB | Atrial fibrillation |
| STACH | Sinus tachycardia |
| SARRH | Sinus arrhythmia |
| SBRAD | Sinus bradycardia |
| SVARR | Supraventricular arrhythmia |
| LAF/LPF Blocks | Left anterior/left posterior fascicular block |
| Category | PTB-XL (21,837) | CPSC2018 (6,877) | CSN (23,026) | EchoNext-Mini (100,000) | MIMIC-IV-ECG-Ext-ICD (468,005) |
| Arrhythmias | ✓ | ✓ | ✓ | ✗ | ✓ |
| Conduction Disturbances | ✓ | ✓ | ✓ | ✗ | ✓ |
| Ischemic Heart Disease | |||||
| STE-ACS / STEMI | ✓ | ✗ | ✓ | ||
| NSTE-ACS / NSTEMI | ✗ | ✗ | ✗ | ✗ | ✓ |
| Chronic coronary syndrome (e.g., atherosclerosis, etc.) | ✗ | ✗ | ✗ | ✓ |
| Single Lead | Lead Subsets | 12-lead | ||||||||
| Group | Condition | Prevalence % (N) | I (LCX) | II (RCA) | V2 (LAD) | I,II | All limb | I,II,V2 | I,II,III,V2 | 12-lead |
| ARR | AFIB | 7.2% (152) | 97.7 | 98.5 | 97.3 | 98.5 | 98.7 | 98.5 | 98.5 | 98.7 |
| STACH | 3.9% (82) | 99.2 | 99.3 | 99.1 | 99.5 | 99.5 | 99.5 | 99.5 | 99.5 | |
| SARRH | 3.7% (77) | 90.0 | 92.7 | 89.3 | 94.1 | 93.4 | 93.5 | 93.4 | 94.4 | |
| SBRAD | 3.1% (64) | 96.1 | 96.1 | 95.9 | 96.3 | 96.1 | 96.1 | 96.0 | 96.7 | |
| SVARR | 0.7% (14) | 84.9 | 96.1 | 71.9 | 93.7 | 93.7 | 91.8 | 92.4 | 95.4 | |
| Single Lead | Lead Subsets | 12-lead | ||||||||
| Group | Condition | Prevalence % (N) | I (LCX) | II (RCA) | V2 (LAD) | I,II | All limb | I,II,V2 | I,II,III,V2 | 12-lead |
| ARR | AFIB | 7.2% (152) | 87.4 | 92.3 | 89.3 | 93.5 | 94.5 | 94.0 | 94.4 | 95.6 |
| STACH | 3.9% (82) | 86.5 | 84.8 | 86.2 | 85.7 | 86.7 | 89.0 | 89.8 | 89.5 | |
| SARRH | 3.7% (77) | 37.8 | 42.4 | 34.1 | 44.9 | 41.2 | 46.1 | 45.0 | 47.7 | |
| SBRAD | 3.1% (64) | 58.0 | 62.5 | 63.7 | 63.4 | 63.5 | 62.0 | 62.7 | 63.3 | |
| SVARR | 0.7% (14) | 5.9 | 30.8 | 2.6 | 28.5 | 25.6 | 34.7 | 32.2 | 48.7 | |
| AUPRC | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| Group | Condition | Prevalence % (N) | Random | ECG-MR | ECG-CR | ECHO | Chest X-ray | Discharge | MS-ECG-FM |
| ARR | AFIB | 7.2% (152) | 49.6 | 94.8 | ∗ 95.5 | 91.6 | 91.3 | 93.0 | 95.6 |
| STACH | 3.9% (82) | 61.8 | 90.0 | ∗ 88.0 | 83.0 | 80.7 | 83.6 | ∗ 89.5 | |
| SARRH | 3.7% (77) | 5.3 | 30.8 | ∗ 45.0 | 10.6 | 11.4 | 14.3 | 47.7 | |
| SBRAD | 3.1% (64) | 42.0 | 65.3 | ∗ 61.5 | 58.4 | ∗ 59.7 | 57.2 | ∗ 63.3 | |
| SVARR | 0.7% (14) | 2.4 | ∗ 35.4 | ∗ 32.5 | 28.8 | ∗ 36.7 | 32.6 | 48.7 | |
| 12-lead | Reduced-lead | ||||||||||||
| All | ARR | CD | ECG-HYP | MI | ISC/STTC | SHD | VC | MIMIC-EST | MIMIC-EXP | I | II | V2 | |
| MS-ECG-FM | 90.6 | 96.9 | 95.8 | 93.9 | 94.4 | 92.9 | 83.4 | 91.7 | 88.2 | 78.8 | 84.5 | 85.3 | 82.6 |
| Z-score waveform-level | 0.5 | 0.1 | 0.2 | 0.5 | 0.0 | 1.0 | 0.6 | 1.1 | 0.2 | 0.4 | 0.6 | 0.7 | 0.5 |
| Z-score lead-level | 0.7 | 0.2 | 0.2 | 2.4 | 0.8 | 1.1 | 1.3 | 2.8 | 0.3 | 0.4 | 0.6 | 0.8 | 0.2 |
| Single layer tokenizer | 0.3 | 0.5 | 0.3 | 1.0 | 1.0 | 0.3 | 1.0 | 0.5 | 0.6 | 1.2 | 0.5 | 0.3 | 0.3 |
| No RLM | 0.3 | 0.1 | 0.6 | 0.2 | 0.4 | 0.2 | 0.8 | 0.1 | 0.9 | 0.7 | 2.3 | 2.4 | 2.0 |
| All | ARR | CD | ECG-HYP | MI | ISC/STTC | SHD | VC | MIMIC-EST | MIMIC-EXP | |
|---|---|---|---|---|---|---|---|---|---|---|
| Stochastic pairing | 90.6 | 96.9 | 95.8 | 93.9 | 94.4 | 92.9 | 83.4 | 91.7 | 88.2 | 78.8 |
| Average embeddings | 90.4 | 97.2 | 95.5 | 94.6 | 94.4 | 92.6 | 83.3 | 91.5 | 88.0 | 78.7 |
| Report-specific batch | 90.3 | 96.7 | 95.5 | 94.5 | 93.7 | 92.5 | 83.9 | 91.8 | 88.0 | 78.5 |
| Report-specific projectors | 90.3 | 97.3 | 95.3 | 93.8 | 94.0 | 92.2 | 83.7 | 91.4 | 88.2 | 78.2 |
| Report | Text encoder | Checkpoint | All | ARR | CD | ECG-HYP | MI | ISC/STTC | SHD | VC | MIMIC-EST | MIMIC-EXP |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ECG-MR | Frozen | ER | 89.5 | 95.8 | 95.2 | 94.2 | 94.0 | 92.3 | 81.5 | 91.7 | 86.4 | 76.5 |
| ECG-MR | Frozen | ZS | 0.1 | 0.1 | 0.1 | 0.2 | 0.6 | 0.1 | 0.4 | 0.2 | 0.0 | 0.1 |
| ECG-MR | Online | ER | 3.9 | 5.8 | 1.4 | 2.6 | 4.3 | 3.3 | 2.5 | 3.3 | 1.9 | 2.2 |
| ECG-MR | Online | ZS | 24.7 | 26.1 | 24.5 | 20.6 | 26.1 | 24.3 | 21.8 | 24.1 | 20.2 | 15.5 |
| ECG-MR | Partially online | ER | 0.1 | 0.7 | 0.1 | 0.4 | 0.1 | 0.3 | 0.2 | 0.2 | 0.4 | 0.1 |
| ECG-MR | Partially online | ZS | 1.5 | 1.4 | 0.4 | 1.6 | 2.3 | 1.0 | 1.3 | 1.0 | 1.1 | 1.6 |
| # Total Notes (Patients) | Length (tokens) | |||||||
| Report | Description | Pre-processing / Cleaning | How to join to ECG | Raw | Clean | # Train ECGs w/Notes (Patients) | Median | Max |
| ECG Machine Report (ECG-MR) | Reports and summary measures generated by the ECG machine | Concatenate all statements together; remove one empty report | By study_id | 800,035 (161,352) | 800,034 (161,352) | 720,101 (144,545) | 17 | 125 |
| ECG Cardiologist Report (ECG-CR) | The ECG is read by a cardiologist who then writes a report. They may reference the machine report or ignore it. | (1) Remove clinical indications, (2) Exclude reports with no informative text (e.g., “ECG interpreted by ordering physician, please see corresponding note”) | Joined to waveform_note_links by study_id then to mimic_iv_note_ecg by note_id | 623,566 (105,365) | 490,780 (102,886) | 441,639 (92,377) | 33 | 256 |
| ECHO Cardiologist Report (ECHO-CR) | Ultrasound images of the heart. A cardiologist reviews ECHO images and writes a report. | None | ECG waveform is joined to the closest ECHO report in a 7-day window | 81,821 (34,147) | 81,821 (34,147) | 129,934 (26,944) | 442 | 1,128 |
| Chest X-ray Radiologist Report (ChXR-RR) | X-ray of the chest. Can show cardiomegaly, pulmonary edema, vascular congestion, and other secondary signs of cardiac dysfunction. Radiologist reviews and writes a report. | None | ECG waveform is joined to the closest ChXR report in a 7-day window | 715,465 (119,933) | 715,465 (119,933) | 415,589 (97,686) | 108 | 761 |
| Discharge Summary Physician Report (DS) | Report summarizing a patient’s hospitalization including the reason for admission, past medical history, their hospital course (including summaries of various scans and blood/microbiology tests), and any relevant discharge instructions | None | ECG joined to discharge summary for the corresponding hospital stay by hosp_hadm_id or ed_hadm_id | 331,793 (111,647) | 331,793 (111,647) | 326,779 (78,754) | 2,464 | 15,039 |
| Methods | PTBXL-Super | PTBXL-Sub | PTBXL-Form | PTBXL-Rhythm | CPSC2018 | CSN | |||||||||||||
| 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | 1% | 10% | 100% | ||
| ECG-MR | 88.7 | 91.5 | 92.3 | 77.0 | 87.4 | 88.9 | 64.9 | 79.1 | 86.7 | 81.5 | 96.3 | 97.3 | 83.9 | 90.8 | 92.9 | 81.5 | 89.8 | 94.5 | |
| ECG-CR | 88.9 | 92.0 | 93.1 | 80.3 | 87.8 | 90.3 | 67.5 | 80.4 | 88.3 | 91.2 | 96.4 | 98.3 | 86.9 | 92.3 | 94.0 | 79.9 | 91.8 | 97.0 | |
| ECHO-CR | 87.3 | 90.0 | 91.7 | 79.2 | 85.6 | 88.6 | 59.0 | 71.6 | 79.1 | 78.9 | 86.2 | 93.1 | 78.3 | 88.6 | 91.7 | 74.0 | 86.7 | 93.2 | |
| ChXR-RR | 87.1 | 89.7 | 91.2 | 77.8 | 84.2 | 87.9 | 62.7 | 74.0 | 82.2 | 77.0 | 87.8 | 94.1 | 75.7 | 88.4 | 92.3 | 74.2 | 86.3 | 92.0 | |
| DS | 86.5 | 89.9 | 91.6 | 78.3 | 85.7 | 89.1 | 62.9 | 75.9 | 81.8 | 79.8 | 91.5 | 95.7 | 76.7 | 88.8 | 93.3 | 74.3 | 86.4 | 93.5 | |
| Config | Value |
|---|---|
| Optimizer | AdamW |
| Batch size | 512 |
| Learning rate | 2e-4 |
| Weight decay | 0.2 |
| Optimizer momentum | |
| Learning rate schedule | Cosine annealing w/linear warm-up |
| Config | Value |
|---|---|
| Optimizer | AdamW |
| Batch size EchoNext-Mini | 1024 |
| Batch size MIMIC-IV-ECG-Ext-ICD | 1024 |
| Batch size PTBXL / CPSC2018 / CSN 1–10% | 16 |
| Batch size PTBXL / CPSC2018 / CSN 100% | 128 |
| Learning rate | 0.001 |