An Explainable, Demographic-Aware ECG Transformer for Atrial Fibrillation Detection
- 1Institute of Biomedical Engineering, TU Dresden, Fetscherstrase 29,Dresden, Germany
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.
Related
- Neighborhood Disadvantage and Unequal Detection of Atrial Fibrillation
- A multicenter randomized controlled study to evaluate the efficacy of an artificial intelligence–based electrocardiography for the detection of atrial fibrillation in patients with suspected symptoms (DEEP-AF)
- 2026 Asia Pacific Heart Rhythm Society (APHRS) Guidelines (Part I) on Epidemiology, Detection/Screening and Integrated Patient Care in Atrial Fibrillation.
- Robust and generalizable atrial fibrillation detection from ECG using time-frequency fusion and supervised contrastive learning
- Atrial fibrillation detection using an implantable loop recorder after cryptogenic stroke.
BibTeX
@article{matteo2026explainable,
title = {{An Explainable, Demographic-Aware ECG Transformer for Atrial Fibrillation Detection}},
author = {Zannini Matteo and Malberg Hagen and Schmidt Martin},
journal = {Current Directions in Biomedical Engineering},
year = {2026},
month = oct,
doi = {10.1515/cdbme-2026-0266},
url = {https://doi.org/10.1515/cdbme-2026-0266},
note = {CC BY-NC-ND},
}
RIS
TY - JOUR
TI - An Explainable, Demographic-Aware ECG Transformer for Atrial Fibrillation Detection
AU - Zannini Matteo
AU - Malberg Hagen
AU - Schmidt Martin
PY - 2026
DA - 2026/10/26
JO - Current Directions in Biomedical Engineering
DO - 10.1515/cdbme-2026-0266
UR - https://doi.org/10.1515/cdbme-2026-0266
AB - 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.
SN - 2364-5504
ER -