A Vision Transformer for ECG-Based Detection of Left Ventricular Systolic Dysfunction Across Multiple Clinical Sites
Authors: Burcu Ozek, Aruna Mohan, David Vorchheimer, Daniel Weiss, Eyal Kedar, Tamar Sobol, Or Zilbershot, Fatemeh Afghah
Organizations: Walkky LLC, Boston, MA, USA · Northwell Cardiovascular Institute, Lenox Hill Hospital, New York, NY, USA · Weiss Consulting Groups, Boca Raton, FL, USA · St. Lawrence Health, Canton, NY, USA · Clemson University, Clemson, SC, USA
Reduced left ventricular ejection fraction (LVEF) is frequently asymptomatic and often detected only after advanced heart failure develops. Electrocardiograms are recorded routinely yet underused for this condition, because reduced LVEF has no single diagnostic waveform. We trained an ensemble of vision transformers from scratch to detect reduced LVEF (≤40%) from 12-lead ECGs, analyzing each heartbeat individually, using 10,142 patients across seven sites in three US health systems. In a held-out external cohort of 4,092 patients from three geographically independent US clinical sites at a real-world reduced-LVEF prevalence of 8.72%, the model achieved an AUROC of 0.88 (95% CI 0.86-0.89), sensitivity 81.2%, specificity 81.0%, and negative predictive value 97.8%. Sensitivity remained high across sex, race, ethnicity, and comorbidity subgroups, while specificity was lower in older patients and those with atrial fibrillation or cardiomyopathy. Beat-level attention maps provided interpretability into the model's predictions, showing consistent focus on the QRS complex rather than the P wave. These findings support the potential of routine ECGs as a scalable first-pass triage step to identify patients who should undergo echocardiography for reduced ejection fraction across diverse patient populations.
Figures & tables
Characteristic
Internal Validation
External Validation
(n = 3,295)
(n = 4,092)
LVEF ≤40% , % (n)
8.71% (287)
8.72% (357)
Age, mean (SD), years
66.5 (15.8)
65.2 (16.6)
Female, %
51.1%
50.1%
Race/ethnicity, %
White, non-Hispanic
51.1%
62.3%
Table 1: Patient characteristics of the internal and external validation sets.
Metric
Internal Validation
External Validation
(n = 3,295)
(n = 4,092)
AUROC
0.880 (0.859–0.897)
0.878 (0.858–0.894)
Sensitivity
82.9% (78.2–87.0)
81.2% (76.9–85.0)
Specificity
80.4% (78.9–81.8)
81.0% (79.8–82.3)
PPV
28.7% (25.7–31.8)
29.1% (26.3–32.0)
NPV
98.0% (97.4–98.5)
97.8% (97.3–98.3)
Table 2: ViT ensemble performance on internal and external validation sets. All metrics computed at threshold = 0.45. 95% CIs from BCa bootstrap (10,000 resamples).
Figure 1: Calibration of the ViT ensemble on the external validation set (n = 4,092). The raw ensemble (orange) overestimated risk, falling below the diagonal. Post-hoc Platt scaling (blue), fit on the internal validation set and applied to the external set, restored calibration to the diagonal without affecting discrimination (AUROC) or the binary operating point.
Category
Subgroup
n
Prev (%)
Sens (%)
Spec (%)
AUC
Sex
Male
2,042
11.3
81.4
79.1
0.873
Female
2,050
6.1
81.0
82.8
0.879
Age
< 60 years
1,349
8.2
80.0
89.3
0.918
60–75 years
1,465
8.7
77.3
81.0
0.863
> 75 years
1,278
9.3
86.6
72.3
0.850
Race/Ethnicity
White, non-Hispanic
2,548
8.2
77.5
79.6
0.849
Table 3: Subgroup performance on the external validation set. All metrics computed at threshold = 0.45. Prev = LVEF ≤40% prevalence within subgroup. Sens = sensitivity; Spec = specificity; AUC = AUROC. ∗ Fewer than 10 positive cases; estimates should be interpreted with caution.
Figure 2: Attention maps of the 12-lead ViT by prediction category. These maps show which parts of each heartbeat the model learned to focus on, rather than relying on predefined rules. Attention weights were extracted from the final transformer encoder layer, averaged across 4 attention heads, 3 ensemble models, and all patients per category. The Lead II signal (mean ± 1 SD) is overlaid on the attention heatmap (red intensity). Attention weights are derived from the full 12-lead input; the Lead II signal is shown for display purposes only. TP = true positive; TN = true negative; FN = false negative; FP = false positive.
Figure 3: Decision curve analysis for the ViT-ECG ensemble (external validation, n = 4,092). Panel (A) shows the standard DCA: net benefit across threshold probabilities from 5% to 16% for the ViT-ECG model (blue), treat-all (red dashed), and treat-none (green dotted). Panel (B) shows the net benefit gain: the improvement of the model over the best simple strategy at each threshold (treat-all where its net benefit is positive, treat-none otherwise).
Variant
CW
LS
L2
Aug
OSF
PS
Sens
Spec
AUC
Δ AUC
Full ensemble (reference)
✓
0.1
✓
0.15
2
50
81.2%
81.0%
0.8775
—
Label smoothing
✓
0.0
✓
0.15
2
50
76.8%
79.9%
0.8640
+ 1.35
L2 regularization
✓
0.1
×
0.15
2
50
79.3%
78.9%
0.8679
+ 0.96
Augmentation
✓
0.1
✓
0.0
2
50
79.8%
79.7%
0.8698
+ 0.77
Class weight
×
0.1
✓
0.15
2
50
73.7%
85.7%
0.8744
+ 0.31
Oversampling
✓
0.1
✓
0.15
1
50
75.6%
84.6%
0.8750
+ 0.25
Table 4: Ablation study: contribution of each training component. Δ AUC = AUC(full ensemble) − AUC(variant), expressed in AUROC percentage points, representing the benefit of including each component (positive = component improves performance). Each variant is a 3-model ensemble with one component removed. Threshold = 0.45. External validation set. CW = class weighting; LS = label smoothing; L2 = L2 regularization; Aug = augmentation ratio; OSF = oversampling factor; PS = patch size. A check mark indicates the component was included; a cross indicates it was removed.
Model
OSF
Aug
LS
External
Internal
Sens
Spec
AUC
Sens
Spec
AUC
CNN vanilla (5,000 signals)
1
0
0
77.3
51.7
0.726
76.3
50.7
0.688
CNN (1,500, best single model)
1
0
0
78.4
77.3
0.860
78.0
76.9
0.849
CNN (1,500, ensemble, ViT params)
2
0.15
0.1
95.8
40.4
0.867
96.5
40.7
0.868
CNN (1,500, best ensemble)
1
0
0
79.6
77.6
0.853
77.4
77.7
0.854
ViT (3-model ensemble)
2
0.15
0.1
81.2
81.0
0.878
82.9
80.4
0.880
Table 5: CNN baseline configurations vs. ViT ensemble. All metrics at threshold = 0.45. OSF = oversampling factor; Aug = augmentation ratio; LS = label smoothing.
Figure 4: Vision Transformer architecture for ECG-based LVEF classification. ECG beat windows are divided into patches and projected to embeddings. A learnable CLS token is prepended, and the sequence is processed by Transformer Encoder layers with pre-norm multi-head self-attention and residual connections. The CLS token representation is passed to an MLP head to predict LVEF ≤40% or >40% .
Figure 5: Ensemble training strategy. Three ViT models were trained on independent random subsamples of the training data and combined into an ensemble by averaging their predicted probabilities.
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
Figure S1: Mean attention maps stratified by atrial fibrillation status. Each row corresponds to a prediction category (true positive, false negative, false positive) and each column to AFib vs. non-AFib patients in the external validation set. The blue line and shaded band show the mean ± SD of the normalized RR-segmented ECG signal (Lead II); the red heatmap overlaid on each panel shows the normalized mean attention weight from the last transformer layer (4 heads, 3 models averaged). The number of patients ( n ) contributing to each panel is shown in the subplot title.
Figure S2: Mean attention maps stratified by age group ( <60 , 60 – 75 , >75 years). Each row corresponds to a prediction category; columns correspond to the three age groups. Layout otherwise identical to Figure S1 .
Figure S3: Mean attention maps stratified by sex (female vs. male). Layout identical to Figure S1 .
Low left ventricular ejection fraction (LEF) frequently remains undetected until progression to symptomatic heart failure, underscoring the need for scalable screening strategies. Although artificial intelligence-enabled electrocardiography (AI-ECG) has shown promise, existing approaches rely solely on end-to-end black-box models with limited interpretability or on tabular systems dependent on commercial ECG measurement algorithms with suboptimal performance. We introduced ECG-based Predictor-Driven LEF (ECGPD-LEF), a structured framework that integrates foundation model-derived diagnostic probabilities with interpretable modeling for detecting LEF from ECG. Trained on the benchmark EchoNext dataset comprising 72,475 ECG-echocardiogram pairs and evaluated in predefined independent internal (n=5,442) and external (n=16,017) cohorts, our framework achieved robust discrimination for moderate LEF (internal AUROC 88.4%, F1 64.5%; external AUROC 86.8%, F1 53.6%), consistently outperforming the official end-to-end baseline provided with the benchmark across demographic and clinical subgroups. Interpretability analyses identified high-impact predictors, including normal ECG, incomplete left bundle branch block, and subendocardial injury in anterolateral leads, driving LEF risk estimation. Notably, these predictors independently enabled zero-shot-like inference without task-specific retraining (internal AUROC 75.3-81.0%; external AUROC 71.6-78.6%), indicating that ventricular dysfunction is intrinsically encoded within structured diagnostic probability representations. This framework reconciles predictive performance with mechanistic transparency, supporting scalable enhancement through additional predictors and seamless integration with existing AI-ECG systems.
Ya Zhou, Tianxiang Hao, Ziyi Cai +5
Department of Information Center, Fuwai Hospital, Chinese Academy of Medical Sciences and Peking Union Medical College, Beijing, China · The Tsinghua Shenzhen International Graduate School, Tsinghua University, Shenzhen, China · Institute of Statistics and Big Data, Renmin University of China, Beijing, China +2
Left ventricular ejection fraction (LVEF) assessment depends on echocardiography, limiting access in primary care and resource-constrained settings. We developed a multimodal machine-learning framework that combines engineered 12-lead ECG timeseries features with structured EHR variables to classify LVEF into four clinically used strata: normal (>50%), mildly reduced (40-50%), moderately reduced (30-40%), and severely reduced (<30%). To support model explainability, we identified the most influential ECG and EHR features via SHAP attributions. Using retrospective data from Hartford HealthCare, we trained XGBoost models on 36,784 ECG-echocardiogram pairs from 30,952 outpatients and evaluated temporal generalizability on 19,966 ECGs from a subsequent period. The multimodal model achieved one-vs-rest AUROCs of 0.95 (severe), 0.92 (moderate), 0.82 (mild), and 0.91 (normal), outperforming ECG-only and EHR-only baselines, and maintained performance under temporal validation. This work supports ECG-based, multimodal LVEF stratification as a practical screening and triage aid to prioritize confirmatory imaging where resources are limited.
Catherine Ning, Yu Ma, Cindy Beini Wang +4
Operations Research Center, Massachusetts Institute of Technology, Cambridge, MA, USA · Wisconsin School of Business, University of Wisconsin–Madison, Madison, WI, USA · Heart and Vascular Institute, Hartford Hospital, Hartford, CT, USA
Left ventricular ejection fraction (LVEF) is a primary marker of cardiac function. However, routine estimation from endocardial measurements requires manual delineation at end-diastole (ED) and end-systole (ES), a process that is time-consuming and subject to inter-observer variability. Reliable automation is especially valuable for point-of-care ultrasound (POCUS), where computational resources are limited and acquisition quality varies. We propose Echo-E3Net, an anatomy-guided spatio-temporal network that explicitly embeds cardiac anatomy into LVEF prediction. A dual-phase Endocardial Border Detector (E2CBD) uses phase-specific cross-attention to localize ED/ES endocardial landmarks and produce phase-aware landmark embeddings, while an Endocardial Feature Aggregator (E2FA) fuses these embeddings with global statistical descriptors of deep feature maps to refine EF regression. Training is guided by a lightweight geometric loss that uses ED and ES endocardial landmarks to regularize EF prediction. On EchoNet-Dynamic and a PSAX subset of EchoNet-Pediatric, Echo-E3Net attains competitive performance using only 1.55M parameters and 8.05 GFLOPs, an order-of-magnitude compute reduction versus recent baselines, supporting real-time deployment. Our code is publicly available at https://github.com/moeinheidari7829/Echo-E3Net.
University of British Columbia, Vancouver, BC, Canada · University of Regensburg, Regensburg, Germany · Iran University of Science and Technology, Tehran, Iran +1