An Explainable, Demographic-Aware ECG Transformer for Atrial Fibrillation Detection
Matteo Zannini, Hagen Malberg, Martin Schmidt
Key points
From the paper's conclusion- We present a transformer architecture with cross-attention-based metadata conditioning for atrial fibrillation (AF) detection from single-lead ECGs, trained on a large classbalanced dataset including 77,261 patients.
Abstract
Deep learning models have demonstrated strong performance in electrocardiogram (ECG)-based cardiovascular disease detection, but face the challenge of systematic variation across individual patients. Patient-specific information, a cornerstone of precision medicine, may help models account for this variability, yet its integration into ECG analysis remains underexplored. We present a transformer architecture with cross-attention-based metadata conditioning for atrial fibrillation (AF) detection from single-lead ECGs, trained on a large classbalanced dataset including 77,261 patients. A systematic ablation study evaluated four metadata configurations including age, sex, ethnicity and AF-associated risk factors. All configurations achieved F1 scores between 96.7% and 96.8% on the held-out test set and between 92.7% and 93.4% on an independent multi-source dataset, confirming competitive performance and strong cross-dataset generalisation. Post-hoc explainability analysis revealed that age is the dominant demographic feature, while sex and ethnicity showed negligible contribution. QRS complexes and fibrillatory T-Q intervals were found to be the most highlighted segments, aligning with established clinical markers of AF. These findings provide a quantitative basis for evaluating when demographic conditioning is clinically justified, and establish an interpretable baseline for future patient-specific adaptive models.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- ECG foundation models share an age-related performance disparity that originates in the data, not the modelsmedRxiv · 2026
- A Fast and Generalizable Deep Neural Network for the Detection of Atrial Fibrillation.Bioengineering (Basel, Switzerland) · 2026
- An interpretable multi-scale hybrid attention network (MSHAN) for explainable ECG arrhythmia classification.Frontiers in artificial intelligence · 2026
- Multicenter validation of an artificial intelligence–enabled ECG model to predict 1-year risk of atrial fibrillation or flutterHeart Rhythm · 2026
- Generative recurrence analysis and metric learning for detection of atrial fibrillation from short ECG data.Chaos (Woodbury, N.Y.) · 2026
- Predicting incident atrial fibrillation from sinus rhythm electrocardiograms using deep learning: a meta-analysis with horizon stratificationEuropean Heart Journal · 2026