Generative counterfactual framework for explainable artificial intelligence-ECG predictions

European Heart Journal - Digital Health

12 January 2026
Organised by: Logo
ESC Journals

Abstract

AbstractBackground

Explainability is critical for clinical adoption of artificial intelligence-enabled ECG (AI-ECG), yet common explainable AI (XAI) methods highlight important ECG segments without clarifying how waveform or rhythm alterations drive model outputs.

Purpose

We introduce a generative counterfactual explainability (GCX) framework that simulates specific ECG changes ("what-if" waveforms) to reveal how AI-ECG models arrive at their predictions.

Methods

Eight AI-ECG models were trained on PTB-XL and MIMIC-IV data: six regression models (P-, R-, T-wave amplitudes; PR, RR intervals; RR variability), one serum potassium regression, and one atrial fibrillation classifier. (Figure 2) Using StyleGAN2, GCX generated paired "positive" and "negative" counterfactual ECGs by nudging each model’s output upward or downward. (Figure 1) We quantified feature shifts, such as wave amplitudes, intervals, between original and counterfactual ECGs and assessed significance via paired t-tests.

Results

Feature regressions consistently yielded counterfactuals with increased P/R/T amplitudes, longer RR intervals, and greater RR variability for positive outputs—and the reverse for negative outputs. Potassium counterfactuals simulating hyperkalaemia demonstrated increased T-wave amplitude, PR prolongation, and QRS widening; hypokalaemic counterfactuals showed reduced T-wave amplitude, increased P-wave amplitude, ST depression, and prominent U waves. AF counterfactuals progressively lost P-waves and exhibited greater rhythm irregularity. All feature differences between original and counterfactual ECGs were statistically significant (p < 0.01).

Conclusion

GCX elucidates the reasoning of AI-ECG models by mapping output perturbations to concrete ECG morphology and rhythm changes, aligning with known electrophysiology. This framework affords clinicians a transparent, clinically meaningful tool for safer deployment of AI-ECG.

Overview of study flow

Visualization of CF ECGs for each AI-ECG

Contributors

M Lee
M Lee

Author

H S Lee
H S Lee

Author

Sejong general hospital Seoul , Korea (Republic of)

J M Son
J M Son

Author

J H Jang
J H Jang

Author

Y Y Jo
Y Y Jo

Author

J M Kwon
J M Kwon

Author

ESC 365 is supported by