Predicting mortality from an ECG, with no labels: what an autoencoder's "reconstruction error" really measures
A team at the Medical University of Innsbruck trained a masked autoencoder on 7.2 million Brazilian electrocardiograms, never showing it who would die. The idea: the more an ECG departs from the learned "normal", the larger its reconstruction error, and the higher the death risk. Validated on 1.6 million patients across three continents, the score predicts all-cause mortality well — but a careful look shows the word "self-supervised" hides a selection driven by labels, and that the headline figure never isolates what the ECG adds beyond age.
The context
Cardiovascular disease remains the leading cause of death worldwide, over 19 million deaths a year. We would like to flag high-risk people early, but classical clinical scores rely on variables (blood pressure, cholesterol, history) that are sometimes unavailable, poorly measured, or weakly discriminating at the individual level. The electrocardiogram (ECG), the recording of the heart's electrical activity through twelve leads placed on the skin, is by contrast near-universal, cheap and non-invasive — an ideal substrate for an automatable risk score.
For a few years, AI models have read the ECG to predict risk. Most are supervised: they are given a target (say, the patient's age) and the risk score becomes the gap between the model's prediction and the true value — the well-known "ECG age" higher than real age. The problem, the authors stress, is that this score depends on the choice of target: the model may learn artefacts specific to the training cohort or the intended outcome, rather than the cardiac signal itself. Hence their bet: build a score with no label, entirely intrinsic to the ECG. Two reading cues for what follows. The hazard ratio (HR) is a risk multiplier: an HR of 1.40 means the death risk rises by 40% for each notch of the score. The C-index measures the ability to correctly rank two patients by survival; 1.0 is perfect, 0.5 equals chance.
The method
At the heart of the work is a masked autoencoder. An autoencoder is a network that compresses an input then tries to reconstruct it identically; "masked" means part of the signal is hidden and the model is asked to guess it from the rest. This learning is called self-supervised: no human labels, the model learns only from the signal's structure. The chosen architecture is a Vision Transformer (ViT), a network that splits the input into tiles and weights their relative importance through an attention mechanism — here in a deliberately small "Tiny" version.
The model is pre-trained on 85% of the CODE dataset, i.e. 7,212,109 ECGs from a telehealth network in Minas Gerais State (Brazil), recorded mostly in primary care between 2010 and 2016. Each ECG is downsampled to 100 Hz, filtered and normalised lead by lead, then split into 36 tiles of which 80% are masked; the model learns to reconstruct the hidden portions. At inference, the reconstruction error is the mean gap between the real ECG and its reconstruction, averaged over five passes. The logic is simple: a "normal" trace, close to what the model saw en masse, reconstructs well (low error); an atypical trace reconstructs poorly (high error). That error becomes the risk score.
One methodological detail is decisive for critical reading: although training is label-free, the model's stopping point (2,600 steps, less than one epoch) and its size were chosen because they maximised mortality prediction on the internal cohort. In other words, death labels did enter somewhere in building the score. A counter-intuitive fact the authors report honestly: larger, better-trained models reconstruct the ECG better… yet predict mortality worse. A deliberately "mediocre" reconstruction model was the one kept.
The results
The validation is large: about 1.6 million participants, six cohorts across three continents — CODE-15% (Brazil, primary care, internal), MIMIC-IV-ECG (US, critical care), HEEDB (US, hospital), CHRIS (Italy, general population), Innsbruck (Austria, cardiology) and UK Biobank (UK). Median follow-up ranges from 1.4 to 11 years, and 5-year mortality from 1.0% (CHRIS) to 14.0% (MIMIC-IV-ECG). For each one-standard-deviation rise in reconstruction error, adjusted for age and sex, the death risk rises consistently: HR of 1.39 in CODE-15% (C-index 0.810), 1.39 in MIMIC (0.731), 1.41 in HEEDB (0.740), 1.23 in Innsbruck (0.741) and 1.25 in CHRIS (0.896). All confidence intervals clearly exclude chance.
The signal is markedly stronger short-term. In HEEDB, the HR rises from 1.46 at 5 years to 1.61 at 1 year and 2.00 at 30 days; the mean area under the curve (a time-dependent variant of the C-index) is 0.776 at 30 days but falls to 0.667 at 5 years. Clinical translation: a patient at the 90th percentile of error has about six times the 30-day death risk of one at the 10th percentile — an illustrative figure, extrapolated over 2.6 standard deviations assuming a log-linear relation. In binary form (threshold set one standard deviation above the Brazilian mean), "high-risk" patients have an HR of 2.00 in MIMIC, 1.95 in HEEDB, 1.53 in Innsbruck, down to 1.27 in UK Biobank. But the share classified high-risk varies hugely by cohort: from 1.8% (CHRIS) to 25.3% (MIMIC) — a sign the threshold does not transfer as-is from one population to another.
What is good
Open code, weights and data, with no industry money. The model's code and weights are published on GitHub under a CC BY 4.0 licence, and the large datasets (CODE, MIMIC-IV-ECG, HEEDB, CHRIS, UK Biobank) are available on request. Funding is entirely internal to the Medical University of Innsbruck, with no commercial sponsor, and no conflict of interest is declared. On a topic where proprietary scores proliferate, this transparency lets anyone replay and audit the analysis.
An external validation rare in scale and candour. Confronting the same score with six cohorts — Brazilian primary care, US intensive care, Italian general population, Austrian cardiology — over 1.6 million people is a generalisation effort well above the field's average. And the team does not hide the awkward heterogeneities: it notes, for instance, that CHRIS mortality, ascertained via obituaries and family contact, likely underestimates deaths and attenuates the HR.
An elegant idea, and a counter-intuitive result reported without smoothing. Basing risk on an ECG's mere "distance from normal", with no external target, is conceptually clean. Above all, discovering that a model reconstructing worse predicts mortality better is the kind of awkward result one is tempted to bury; here it is described and discussed, which says a lot about the analysis's maturity — even if, as we will see, it should also worry us.
What is less good
The word "self-supervised" hides a leak through model selection. The paper's selling point is a "label-free" score. But the stopping point and model size were chosen on their mortality performance in CODE-15%. Death labels therefore drive the score's construction, and CODE-15% is no longer a truly independent internal validation: its C-indices are optimistic. This is a form of data leakage through the model-selection door — subtle, barely mentioned, but weakening the central promise. The counter-intuitive "worse reconstruction = better prediction" result is in fact a warning sign: it suggests that what predicts is not the quality of cardiac modelling, but something else that degraded reconstruction lets through.
The headline metric never isolates the ECG's own contribution, and there is no real comparator. All reported C-indices (0.73 to 0.90) come from models that already include age and sex. Yet age alone is a massive mortality predictor — the 0.896 C-index in CHRIS is almost certainly carried by age, not the ECG. The paper provides neither a C-index gain nor a reclassification index for the score over age and sex alone: we therefore do not know what the reconstruction error really adds. Add the absence of a comparator: no head-to-head against an existing supervised AI-ECG score or an established clinical risk score. A high HR "on top of age" is no proof of usefulness until that test is done.
A likely shortcut: the score captures acute state, not just intrinsic risk. The reconstruction error may mainly be a marker of "sick right now" — noise, artefact, arrhythmia, pacemaker, ICU ECG — rather than baseline cardiac risk. Three clues converge: the signal is strongest at 30 days and weakens at 5 years; it is in intensive care (MIMIC) that the rate of patients labelled high-risk jumps to 25%; and the undertrained model produces near-zero reconstructions on lead III — a learning artefact, not physiology. This possible shortcut learning, combined with a non-transferable threshold (1.8% versus 25.3% of "high-risk" patients depending on cohort), the study's retrospective nature, the absence of cause-specific mortality (everything is "all-cause") and the not-yet-peer-reviewed preprint status, calls for caution.
What it changes
For the research community, the study is both a good idea and a textbook methodological case. Self-supervised risk scores are an attractive avenue — they escape the target-choice bias — but their evaluation must clear two bars this work does not yet clear: isolating the gain beyond age and sex (C-index gain, reclassification), and showing the signal is not a mere proxy for acute severity. That is the real work ahead: prospective validation, cause-specific endpoints, and model selection that does not lean on outcome labels.
For clinicians, nothing changes today, and that is the useful information: this is a research prototype, with no prospective validation, no comparison to an existing score, and a threshold that recalibrates from one population to another. No care decision should follow from it. The score's merit is heuristic — it might, eventually, flag "atypical" ECGs worth a second look — not decisional.
For patients and the public, the story is a good antidote to headlines of the "an AI reads your ECG and predicts your death" type. The question to ask is not "what is its success rate?" but "does it beat a simple age calculation, and was it tested in real conditions, prospectively?". Here the honest answer is: we do not know yet. That is precisely what the paper, to its credit, does not hide — and what its "self-supervised" packaging nonetheless tends to obscure.
To go further
The preprint is available on medRxiv (2026.07.10.26357749), posted in July 2026 by Angus Nicolson, Samuel Pröll, Riccardo Lunelli, Hagen Blankenburg, Peter Pramstaller, Christian Fuchsberger, Axel Bauer and Clemens Dlaska (Medical University Innsbruck; Eurac Research, Bolzano); it has not yet been peer-reviewed. Code and weights are on GitHub. On AI applied to the ECG and prognostic scores, see our decryptages on another self-supervised approach on the 12-lead ECG, on ICU mortality prediction on MIMIC-IV and the importance of calibration, and on atrial fibrillation prediction from a wearable ECG.
Editorial transparency: French version written and signed by the Tatakoto editorial team based on a reading of the preprint. English, Spanish and Chinese translations produced with AI assistance and reviewed.