Masked autoencoder for 12-lead ECGs whose reconstruction error serves as a label-free mortality risk score, validated across six cohorts.
No providers recorded yet. Browse all providers
Most AI-ECG risk scores are supervised: a network predicts something external, such as age, and the gap between prediction and truth becomes the risk marker, tying the score to the chosen target. This model asks a different question of the ECG: how surprising is it? A masked autoencoder trained on millions of routine recordings learns what ordinary cardiac electrical activity looks like, and its error when filling in hidden parts of a new recording measures how far that recording departs from the norm. No outcome label or demographic variable enters the score.
The masking has a physiological reading. Each of the twelve leads projects the heart's electrical dipole onto a different axis, and at inference the model hides 80% of the signal while ensuring every timepoint stays visible in at least one lead. Reconstruction therefore means predicting what the other leads should show given what one lead does show.
The model was developed by the Digital Cardiology Lab at the
Medical University of Innsbruck with
Eurac Research in Bolzano, and posted to medRxiv in July 2026.
The paper leaves it unnamed; code and weights are released as ecg-reconstruction-risk. The
same lab built xECG, a separate general-purpose ECG encoder.
The encoder is a ViT-Tiny (12 layers, width 192, three heads, four register tokens) with a four-layer decoder, 7.27M parameters in total, using spatio-temporal attention over patches. Each forward pass crops 7.68 s of a 12-lead ECG at 100 Hz and splits every lead into three 256-sample patches, giving 36 patches. Training masked 80% of patches at random and applied a mean-squared-error loss to the masked regions only, using AdamW (learning rate 5e-4, batch size 2,048) on 85% of the Brazilian CODE telehealth dataset, 7,212,109 ECGs. Across ViT-Tiny, ViT-Small and ViT-Base checkpoints, larger and longer-trained models reconstruct better but stratify risk worse; the checkpoint was selected on CODE-15% mortality.
Adjusted for age and sex, each one-SD increase in reconstruction error carried a hazard ratio for all-cause mortality of 1.39 in CODE-15% (C-index 0.810), 1.39 in MIMIC-IV-ECG, 1.41 in HEEDB, 1.23 in an Innsbruck cardiology cohort and 1.25 in the population-based CHRIS study. The binary threshold separated a high-risk group in all six cohorts, including the UK Biobank (HR 1.27), where only the binary analysis was available. The signal is strongest at short horizons: mean time-dependent AUCs were 0.776 at 30 days, 0.701 at one year and 0.667 at five years. It held after adjustment for machine-read ECG intervals and for comorbidities.
Because the score needs nothing beyond a raw 12-lead ECG, it can be computed at acquisition and attached to routine reports. The authors point to acute and hospital settings, where the short-term signal is strongest, and to opportunistic screening in primary care. The repository runs the model over a directory of WFDB-format ECGs, writes per-ECG error metrics, and includes Cox survival-analysis scripts, so researchers can test the score in their own cohorts. Because error can be broken down by lead and by waveform segment, a high score is inspectable: in the paper's analysis the QRS complex and T wave contribute most to the difference between risk groups.
The work reframes a masked autoencoder's training objective as a clinical measurement, and its finding that an undertrained, smallest-capacity model gives the best risk signal runs against the assumption that better pretraining yields better downstream use — which also makes it a narrow tool rather than a general ECG encoder. Code and weights are MIT-licensed; separately from the licence, the authors state the model is for research use only and is not a medical device. The study is a retrospective preprint: it assesses only all-cause mortality, makes no head-to-head comparison with supervised AI-ECG or clinical risk scores, and the fixed threshold labels 1.8% to 25.3% of patients high risk depending on cohort, so new populations may need recalibration. The CODE training data and most validation cohorts are available only on application; CODE-15% and the MIMIC-IV-ECG waveforms are openly downloadable, and the Innsbruck cohort cannot be shared.
Much of this page is generated or calculated automatically. Flag anything that looks off and we will re-run it.