CLEF: Clinically-Guided Contrastive Learning for Electrocardiogram Foundation Models

Yuxuan Shu, Peter H Charlton, Fahim Kawsar, Jussi Hernesniemi, Mohammad Malekzadeh · Submission to ICLR 2026 · Rejected

TL;DR

Current foundation models for electrocardiograms (ECGs) overlook the rich, routinely collected clinical metadata available alongside heart recordings. CLEF (Clinically-Guided Contrastive Learning for Electrocardiogram Foundation Models) bridges this gap by using established cardiovascular risk scores (such as SCORE2) to continuously modulate negative pair repulsion during contrastive pretraining. Evaluated across 18 classification and regression tasks on 7 datasets, CLEF substantially outperforms existing self-supervised methods and matches the performance of heavily annotated, supervised foundation models on single-lead wearable tasks.

What Problem Does This Paper Address?

Wearables like smartwatches and chest patches increasingly monitor heart health via single-lead ECGs. However, analyzing single-lead signals is notoriously difficult: they lack the spatial perspective of full 12-lead clinical ECGs and suffer heavily from motion artifacts and noise.

While pretraining foundation models on unlabeled 12-lead ECGs helps models generalize to single-lead settings, standard self-supervised methods (e.g., SimCLR, MoCo) treat all "negative" sample pairs identically—pushing any two patients’ signals apart with equal force. Meanwhile, existing methods incorporating metadata (e.g., patient age or blood pressure) simply treat it as an auxiliary prediction target or direct network input. They fail to exploit established clinical knowledge to structure the underlying latent space.

Methods

CLEF introduces clinically-guided contrastive learning, which maps ECG signals into an embedding space where geometric distances correspond to differences in patient cardiovascular risk:

Unlabeled 12-lead ECG ──► Random Lead + Noise Augmentations ──► ResNeXt1D Encoder
                                                                     │
Patient Metadata (Age, Sex, SBP) ──► SCORE2 Risk Score (r)          ▼
                                                │              Embeddings (z)
                                                ▼                    │
                          Pairwise Risk Dissimilarity (D)            │
                                       ×                             │
                         Missing-Data Multiplier (M)                 │
                                       ▼                             ▼
                            Adaptive Weights (W) ────► Contrastive Loss (Lʷ) +
                                                       Alignment Loss (Lᵈ)
  • Risk Score Dissimilarity ($D_{ik}$): For each patient, the authors calculate SCORE2, an established clinical score estimating 10-year risk of cardiovascular events. Dissimilarity between samples $i$ and $k$ is calculated as a normalized squared risk difference $\delta_{ik} = (r_i - r_k)^2$, bounded by a minimum offset $\alpha \in [0, 1]$.
  • Handling Missing Metadata ($M_{ik}$): Clinical records often omit attributes (e.g., cholesterol or smoking status). CLEF computes a reliability discount factor based on how many attributes were observed versus imputed. When metadata is largely missing, the pair weighting smoothly reverts toward uniform contrastive learning, preventing noisy imputations from corrupting representations.
  • Dual Pretraining Objectives:
  • Weighted Contrastive Loss ($L^w$): Modifies InfoNCE by weighting negative exp-similarities by $W_{ik} = D_{ik} \cdot M_{ik}$. Negatives with vastly different clinical risks are pushed further apart; clinically similar negatives are penalized gently.
  • Dissimilarity Alignment Loss ($L^d$): Directly aligns cosine similarity between embeddings with their risk weight via mean squared error.
  • Random Single-Lead Pretraining: Instead of training dedicated per-lead models, mini-batches randomly select one of the 12 leads per sample and apply realistic wearable noise (muscle artifacts, baseline wander, motion). This produces a single, lead-agnostic backbone flexible for any downstream device.

Datasets

  • Pretraining: MIMIC-IV-ECG (first recording from 161,352 unique patients, matched with MIMIC-IV clinical metadata).
  • Downstream Benchmarks (7 datasets, 18 tasks):
  • Standard in-clinic benchmarks: MIMIC-IV (LVEF classification & regression), PTB-XL (cardiac diagnosis, sub-diagnosis, super-diagnosis, waveform morphology, and rhythm), Chapman (arrhythmia classification).
  • Wearables & Emergency Care: MUSIC (sudden cardiac death prediction in chronic heart failure), Icentia11K (wearable single-lead beat and rhythm classification), MC-MED (emergency department triage acuity, emergency disposition, hospital discharge disposition, systolic/diastolic blood pressure), and Aurora BP (cuffless blood pressure regression).

Key Insights and Ideas

  • Continuous clinical distance over binary contrast: In physiology, two patients are rarely strictly "the same" or "different." Grounding contrastive repulsion in validated clinical risk scores transforms an arbitrary latent space into a clinically structured manifold.
  • Graceful degradation for incomplete records: Rather than discarding samples or blindly trusting mean-imputed variables, scaling negative weights via metadata completeness ($M_{ik}$) acts as a dynamic safety valve.
  • Better cross-lead generalizability than supervised models: Fully supervised models trained strictly on lead I (such as ECGFounder) experience significant performance drops (e.g., 3.8% drop) when deployed on lead II. CLEF’s randomized lead sampling preserves consistent performance across leads (within 0.0–0.3% variation).

Key Results

  • Lead I & II Classification: Across 7 clinical tasks, CLEF-M (30.7M parameters) significantly outperformed KED ($p = 0.010$), the top self-supervised foundation baseline, gaining an average of +2.6% AUROC on Lead I and +4.0% AUROC on Lead II.
  • Wearable & Acute Care Tasks: CLEF outperformed all semi-supervised baselines on wearable datasets (e.g., +1.9% AUROC on Icentia11K rhythm tasks).
  • Regression: On continuous targets (LVEF, systolic and diastolic blood pressure), CLEF-M reduced Mean Absolute Error (MAE) by 3.2% over ST-MEM and reduced error by 5.6% relative to the supervised model ECGFounder.
  • Matched-Lead Parity with Supervised FMs: When pretrained specifically on Lead I, CLEF performed virtually on par with ECGFounder (within 0.1–0.3% AUROC), despite ECGFounder having been trained on 10 million supervised labels.
  • Linear Probing: Frozen representations from the largest CLEF-L model exceeded the strongest baseline by +7.4% AUROC, demonstrating high-quality feature extraction without fine-tuning backbone weights.

Limitations and Future Work

  • Single-Center Cohort: Pretraining relied exclusively on hospital data from MIMIC-IV; models should be validated on diverse, multi-center, and ambulatory populations.
  • Partial Metadata Availability: Only 3 of the 7 variables required by SCORE2 were present in the source dataset, necessitating population-level imputation for cholesterol and smoking. Richer, fully populated metadata could yield even more precise embeddings.
  • Sensor Discrepancy: Evaluated single-lead datasets largely used clinical-grade chest electrodes rather than consumer smartwatch dry electrodes, which present harsher signal degradation.
  • Future Directions: Extending clinically-guided contrastive objectives to other continuous physiological signals (such as photoplethysmography [PPG] or respiratory waveforms) and utilizing the structured embedding space for prototype-based patient clustering.

Summary updated

BibTeX
@misc{shu2025clef,
  author = {Yuxuan Shu and Peter H Charlton and Fahim Kawsar and Jussi Hernesniemi and Mohammad Malekzadeh},
  title = {{CLEF: Clinically-Guided Contrastive Learning for Electrocardiogram Foundation Models}},
  year = {2025},
  eprint = {2512.02180},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.02180},
}
Figure