Source-linked AI summary

A Vision Transformer for ECG-Based Detection of Left Ventricular Systolic Dysfunction Across Multiple Clinical Sites

Burcu Ozek, Aruna Mohan, David Vorchheimer, Daniel Weiss, Eyal Kedar, Tamar Sobol, Or Zilbershot, Fatemeh Afghah

arXiv:2608.14723v1cs.CVcs.LG

TL;DR

Reduced LVEF is often asymptomatic and difficult to identify using routine ECGs. This study trained a vision-transformer ensemble on 12-lead ECG heartbeats and found 81.2% sensitivity, 81.0% specificity, and 97.8% negative predictive value in external validation.

  • Problem

    Reduced LVEF is frequently asymptomatic, while echocardiography remains constrained as a broad screening tool, limiting evidence for scalable detection from routine ECGs.

  • Method

    The study trained a vision-transformer ensemble from scratch on individual heartbeats from 12-lead ECGs across multiple health systems and evaluated it at held-out clinical sites.

  • Results

    81.2% sensitivity, 81.0% specificity, and 97.8% negative predictive value were achieved for detecting LVEF ≤40% in 4,092 external patients.

  • Takeaways & Limitations

    The findings support routine ECGs as a scalable first-pass triage step for identifying patients who should undergo echocardiographic evaluation for reduced LVEF.

  • Takeaways & Limitations

    Validation was retrospective, and prospective evaluation in a real clinical workflow remains an important next step.

Abstract

from arXiv · show

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 ($\leq$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.

Introduction

LVSD is often asymptomatic and detected only after progression to overt heart failure, motivating scalable ECG-based screening for reduced LVEF. This study developed and evaluated a from-scratch vision-transformer ensemble across multiple clinical settings and held-out sites.

  • Clinical motivation: LVSD, defined as LVEF ≤40%, affects an estimated 3–6% of the general population and often remains undetected until symptomatic heart failure develops.Early LVSD may be asymptomatic or present with nonspecific symptoms.
  • Prior work: Artificial intelligence can extract latent ECG signatures and flag patients for echocardiographic evaluation of reduced LVEF from routinely acquired 12-lead recordings.Prior convolutional neural network studies showed that routine ECGs contain clinically meaningful information for detecting reduced ejection fraction.
  • Study contribution: A from-scratch vision-transformer ensemble was developed to detect reduced LVEF (≤40%) from individual heartbeats using 10,142 patients with paired ECG and echocardiography.Patients were drawn from multiple care settings across three US health systems.
  • Study contribution: The model was internally validated on 3,295 patients and externally validated on 4,092 patients from three fully held-out sites with a real-world reduced-LVEF prevalence of 8.72%.The external validation sites were geographically distinct clinical sites described in the study context.
  • Study contribution: Under identical training data and splits, the vision-transformer ensemble outperformed a reimplementation of an established CNN architecture for ECG-based LVEF detection.Beat-level attention maps also provided interpretability into the ECG features driving model predictions.

Results

The ViT ensemble maintained strong discrimination and operating performance on internal and geographically independent external validation, with high external negative predictive value. Calibration, subgroup, attention-map, decision-curve, and ablation analyses further characterized clinical utility, model focus, and training effects.

  • Overall performance: 0.880 AUROC, 82.9% sensitivity, and 80.4% specificity were achieved on internal validation at the prespecified threshold of 0.45.These metrics were computed with bootstrap 95% confidence intervals.
  • Calibration: 8.6% mean predicted probability and 0.061 Brier score after Platt scaling corrected the external set's raw risk overestimation while preserving 0.878 AUROC and the same flagged patients.The calibrated slope was 0.99 and calibration-in-the-large was 0.02.
  • Subgroup performance: 89.3% specificity in patients under 60 versus 72.3% in those over 75, while sensitivity was highest in the oldest group at 86.6%.Sensitivity was similar between males and females, at 81.4% and 81.0%, respectively.
  • Subgroup performance: 79.6%–85.9% sensitivity across comorbidity subgroups indicated reliable detection, but specificity fell to 57.0% in cardiomyopathy and 70.2% in atrial fibrillation.Specificity was also reduced in heart failure and myocardial infarction, at 66.0% and 69.0%, respectively.
  • Interpretability: Attention concentrated on QRS complexes in true-positive and false-negative cases, with weaker secondary attention extending into adjacent ST-T segments in true-positive cases.The averaged Lead II signal showed broader QRS complexes in true-positive and false-positive cases, while false-negative cases had taller, narrower R peaks.

Discussion

A vision transformer trained from scratch detected reduced LVEF across independent clinical sites and patient subgroups, with strong rule-out performance and better discrimination than an established CNN baseline. Attention patterns and error analyses provided clinically meaningful explanations, while calibration, decision-curve, and retrospective-validation findings defined implementation opportunities and limitations.

  • External performance: 81.2% sensitivity, 81.0% specificity, and AUROC 0.878 were achieved across 4,092 patients from three geographically independent clinical sites.The observed reduced-LVEF prevalence was 8.72%, with a PPV of 29.1%.
  • Clinical utility: 97.8% NPV supported using the model as a rule-out tool, while internal validation produced a consistent AUROC of 0.880.The proposed clinical role was first-pass ECG triage to identify patients for echocardiographic evaluation.
  • Subgroup performance: AUROC ranged from 0.849 in White, non-Hispanic patients to 0.918 in Black or African American patients, while sensitivity remained 100% in several small racial and ethnic subgroups.Asian, American Indian or Alaska Native, Native Hawaiian or Other Pacific Islander, and Other or Multiple Race groups each had fewer than 10 positive cases.
  • Limitations and variation: Specificity declined from 89.3% in patients under 60 to 72.3% in those over 75, whereas sensitivity reached 86.6% in the oldest group.Age-related ECG changes may overlap with reduced-LVEF patterns and increase false-positive echocardiography referrals.
  • Interpretability and errors: Attention concentrated on the QRS complex in true-positive and false-negative cases, while false positives showed patterns resembling true positives and reflected structural cardiac disease.False negatives had conduction abnormalities in 7% versus 27% of true positives; false positives had heart failure in 55% versus 25% of true negatives and atrial fibrillation in 45% versus 25%.
  • Model comparison: The ViT ensemble exceeded the best CNN ensemble by 2.5 AUROC points, achieving 0.878 versus 0.853 on external validation.The CNN matched the ViT only at 95.8% sensitivity and 40.4% specificity, an operating point at which 6 in 10 patients without reduced LVEF would be referred unnecessarily.

Methods · Study Design and Data Use · Dataset

This retrospective observational cohort used de-identified ECG and echocardiographic data from three US health systems, selecting temporally paired studies to define left ventricular systolic dysfunction by quantitative LVEF.

  • Study Design and Data Use: The retrospective observational cohort analyzed de-identified clinical data from Dandelion Health’s consortium of US health systems.Data were de-identified before extraction using privacy-preserving methodologies approved by expert determination under the HIPAA Privacy Rule.
  • Dataset: ECG and echocardiographic data came from three US health systems comprising 10 acquisition sites.Sources included Sharp HealthCare, Sanford Health, and Texas Health Resources, accessed through the Dandelion Health platform.
  • Dataset: Data covered inpatient, outpatient, and observation encounters from 2016 onward, with waveforms recorded using GE Healthcare and Philips systems.
  • Dataset: Eligible patients were aged 22 years or older and had a standard 12-lead digital ECG paired with a quantitative-LVEF TTE within 30 calendar days.The ECG had to precede the echocardiogram, and only one ECG–TTE pair per patient was retained, selecting the earliest qualifying echocardiogram when necessary.
  • Dataset: Patients with LVEF ≤40% were classified as having left ventricular systolic dysfunction, measured by the biplane method of disks from two-dimensional apical views.Board-certified cardiologists at each site interpreted echocardiograms during routine clinical care.
  • Dataset: The dataset was split at the patient level into training, internal validation, and external validation sets without patient overlap.The training set included 10,142 patients; three independent 80% subsamples each trained one model, producing a three-model ensemble.

ECG Preprocessing

ECGs were filtered, normalized, and segmented into non-overlapping beat-level windows after deriving augmented leads and detecting R-peaks. Recordings without detectable R-peaks were excluded.

  • Acquisition and lead derivation: 500-Hz ECGs lasted at least 10 seconds and contained 8 acquired leads, with 4 augmented limb leads derived using standard formulas.The acquired leads were I, II, and V1–V6; derived leads were III, aVR, aVL, and aVF.
  • Signal filtering: A 0.5-Hz fifth-order Butterworth high-pass filter removed baseline wander, followed by a 50-Hz notch filter suppressing powerline interference.
  • R-peak detection: R-peaks were detected in Lead II with NeuroKit2, falling back to Lead I when fewer than two valid peaks were found; recordings lacking peaks in both leads were excluded.
  • Normalization: Each lead was z-score normalized across the full recording to zero mean and unit variance before beat-window extraction.This normalization addressed inter-patient amplitude variability.
  • Beat-level RR segmentation: Non-overlapping windows advanced every 2 detected R-peaks, spanning two consecutive RR intervals, with a 1,500-time-step maximum and beginning zero-padding when shorter.This defined model analysis at the individual-beat level rather than across the full recording.

Model Architecture

The model adapts a Vision Transformer for one-dimensional, 12-lead ECG beat classification by patching each beat into embedded tokens and processing them with pre-norm transformer encoders. A CLS-token representation is used to predict whether LVEF is ≤40% or >40%.

  • Input representation: Each input was a single ECG beat window represented as a 1500 × 12 matrix of time steps × leads.
  • Patch embedding: Thirty non-overlapping 50-time-step patches were projected into 64-dimensional embeddings, with a prepended CLS token producing 31 tokens.Learnable positional embeddings were added to every token.
  • Transformer encoder: Three transformer encoder layers used four-head self-attention with key dimension 16, GELU feed-forward networks, and pre-norm layer normalization.L2 regularization with λ = 10^-4 was applied to feed-forward and classifier weights.

Training Strategy

Training used weighted and oversampled cross-entropy to address class imbalance, augmentation to improve generalization, and Adam with adaptive learning-rate scheduling and early stopping. Three independently trained ViT models were combined by averaging predicted positive-class probabilities.

  • Class imbalance: Positive-class weighting of 1.52 and minority-class oversampling by 2 addressed the 22.5% versus 77.5% training-class imbalance.Models used categorical cross-entropy loss; positive beats were copied during each epoch.
  • Data augmentation: 15% of training beats were augmented with Gaussian noise (standard deviation 0.01) and amplitude scaling uniformly sampled from [0.9, 1.1].Augmented beats were added as copies while original beats were retained.
  • Optimization and regularization: Adam optimization used learning rate 10^-4 and gradient clipping at 0.5, with plateau-triggered reduction by 0.3 to minimum lr 10^-6.The learning rate was reduced after 5 validation-loss plateau epochs.
  • Ensemble: Three ViT models were trained on independent patient-level subsamples of 80% of training patients and ensembled by averaging predicted positive-class probabilities.Subsamples were label-stratified, and early stopping used the internal validation set.

CNN Baseline

The study benchmarked the vision transformer against a reimplemented six-block convolutional neural network and evaluated four CNN input and training configurations. Configurations varied by waveform format, beat-level aggregation, and training adjustments.

  • Architecture: The CNN baseline used six temporal convolutional blocks, one spatial convolutional block, and two fully connected layers.Temporal blocks operated across time, while the spatial block operated across leads.
  • Configurations: Four CNN configurations were evaluated, including a full 12-lead waveform with 5,000 time steps per patient and three beat-level configurations.The full-waveform configuration matched the format of Attia et al.; the remaining configurations used 1,500-step RR-segmented inputs matching the ViT.
  • Configurations: The full-waveform CNN used no class weighting, oversampling, augmentation, or label smoothing and was trained as a single model.Beat-level configurations produced patient-level predictions by averaging per-beat probabilities.

Threshold Selection · Statistical Analysis

The ensemble threshold was locked at 0.45 after internal validation, while patient-level performance used standard discrimination metrics with BCa bootstrap confidence intervals. Calibration, post-hoc probability recalibration, and decision curve analysis further assessed probability reliability and clinical net benefit.

  • Threshold Selection: 0.45 was selected by maximizing the Youden index on the internal validation set and locked before external validation analysis.The Youden index was defined as sensitivity + specificity −1.
  • Statistical Analysis: Seven performance metrics were computed at the patient level using ensemble probabilities at the pre-specified threshold of 0.45.Metrics included sensitivity, specificity, AUROC, accuracy, PPV, NPV, and F1 score.
  • Statistical Analysis: 95% confidence intervals were estimated using bias-corrected and accelerated bootstrap resampling with 10,000 iterations.The supplied passage specifies patient-level sampling but is truncated thereafter.
  • Statistical Analysis: Calibration was assessed on both validation sets using the Brier score, calibration curves with 10 quantile bins, calibration slope, and calibration-in-the-large.Raw probabilities were expected to overestimate absolute risk because training used minority oversampling and class weighting.
  • Statistical Analysis: Platt scaling mapped ensemble-probability logits to observed labels using internal validation data before application to external validation data.Because Platt scaling is monotonic, it changes probability scale but not AUROC or binary classification at any threshold.
  • Statistical Analysis: Decision curve analysis compared model net clinical benefit with treat-all and treat-none strategies across threshold probabilities of 5–16%.Net benefit gain was additionally calculated against the best simple strategy at each threshold.
  • Statistical Analysis: Net benefit used true positives, false positives, total patients, and the threshold-dependent harm weight assigned to false positives relative to false negatives.The harm weight was represented as pt/(1 −pt).

Attention Map Analysis

Attention maps were extracted from the final transformer layer to characterize the model’s spatial focus at the beat level. Profiles were averaged across ensemble models and presented as exploratory, post-hoc analyses rather than causal explanations.

  • Attention-map extraction: CLS-token attention scores from the final transformer encoder layer were averaged across four heads, resized to the original signal length, cropped, and interpolated to 1,500 time steps.The procedure was applied to each beat and repeated across the three ensemble models.
  • Attention-map aggregation: Attention profiles were averaged across the three ensemble models, with displayed signals from Lead II but attention weights derived from the full 12-lead input.
  • Interpretation: Attention maps were presented as an exploratory, post-hoc analysis and do not constitute mechanistic causal attribution.

Subgroup Analysis

Subgroup analyses evaluated whether model performance was consistent across clinically relevant partitions in the external validation set, including demographic, clinical, encounter, and acquisition-site groups.

  • Analysis scope: Subgroup analyses were conducted on the external validation set to assess consistency of model performance across clinically relevant partitions.The analysis examined sex, age, race and ethnicity, encounter setting, acquisition site, and selected comorbidities.
  • Demographic subgroups: Demographic partitions included sex, age group, race, and ethnicity.Age groups were defined as <60, 60–75, and >75 years.
  • Clinical and site subgroups: Clinical and data-collection partitions included encounter setting, acquisition site, and comorbidity presence or absence.Comorbidities included atrial fibrillation, hypertension, type 2 diabetes, coronary artery disease, acute myocardial infarction, and cardiomyopathy.

Supplementary Material

Supplementary analyses examined model attention across clinically relevant subgroups in the external validation set. Mean attention maps were stratified by atrial fibrillation status, age group, and sex across prediction categories.

  • Attention-map analysis: Mean attention maps were generated separately for each subgroup in the external validation set and averaged within prediction category.Prediction categories were true positive, false negative, and false positive; darker red indicated greater attention to regions of the normalized RR segment.
  • Atrial fibrillation: Atrial fibrillation analyses compared AFib and non-AFib patients across true-positive, false-negative, and false-positive predictions.The maps overlaid normalized mean attention from the last transformer layer on the mean ± SD Lead II signal.
  • Age: Age-stratified analyses compared patients younger than 60, aged 60–75, and older than 75 years across prediction categories.The attention-map layout matched the atrial-fibrillation analysis.
  • Sex: Sex-stratified analyses compared female and male patients using the same attention-map layout.The analysis retained the prediction-category rows used in the other subgroup figures.
Loading 2608.14723v1…