Introduction
Deep learning has significantly advanced electrocardiogram (ECG) analysis, often matching or exceeding human performance in detecting arrhythmias. However, these models remain "black boxes." When an AI flags a life-threatening condition, a cardiologist needs to know why. Current tools like saliency maps (heatmaps) show where the model is looking, but they don't explain what features it sees. This paper introduces qLST (query-based Latent Space Traversal), a method that moves beyond heatmaps to provide generative, morphologically precise explanations for any ECG classifier.
The Interpretability Gap
The "black box" nature of deep neural networks is a major barrier to clinical adoption. In cardiology, an automated diagnosis must be verifiable. Existing interpretability methods mostly rely on saliency maps, which highlight segments of the ECG signal the model found important. However, saliency maps are often noisy and uninformative; they might point to a QRS complex but won't specify if the model is reacting to its width, height, or relationship to the T-wave. Furthermore, they cannot provide "counterfactual" explanations—showing what would have to change for a patient not to have a specific condition.
Methodology: The qLST Framework
The qLST framework consists of three main components: a pre-trained classifier (the model to be explained), a Variational Autoencoder (VAE) trained to compress and reconstruct ECG signals, and a novel attention-based qLST module.
Instead of analyzing gradients, qLST "queries" the model. By taking an encoded ECG ($z$) and a query value ($q$) representing a target probability, the qLST module calculates a perturbation ($\Delta z$) in the latent space. When the modified $z + \Delta z$ is passed through the VAE's decoder, it produces a synthetic ECG. The system is trained using a dual loss function: a Binary Cross-Entropy (BCE) loss to ensure the reconstructed ECG produces the target probability, and a Mean Squared Error (MSE) loss to ensure the new ECG remains "local"—preserving the patient's unique heart rhythm while only modifying specific pathological features.
Experimental Setup and Datasets
The models were trained on a massive dataset of over 800,000 ECGs from a large university hospital, covering 28 distinct physician-annotated abnormalities. Validation focused on 8 labels with clear morphological definitions, such as Left Bundle Branch Block (LBBB), Atrial Fibrillation (AFib), and First-degree AV block (AV1), to verify if generated changes matched medical standards.
Results: Morphological Precision
The most striking result is that the model "discovered" clinical definitions. As the query value ($q$) increased, the classifier's predicted probability for the target class followed suit. Visual inspections by medical professionals confirmed that qLST-generated traversals correctly modified known features.
For instance, when asked to increase the probability of a First-degree AV block, qLST physically lengthened the PR interval in the generated signal—exactly how a human doctor defines the condition. In cases of LBBB, the model widened the QRS complex and increased T-wave height. For Atrial Fibrillation, it successfully removed P-waves.
Conclusion
qLST represents a shift from discriminative to generative interpretability. By creating "what if" scenarios, it allows clinicians to see the physical evolution of disease features as perceived by the AI. This not only builds trust but also provides a tool for debugging models by identifying exactly which morphological features (or lack thereof) led to a specific classification. Future work aims to extend this to multi-label abnormalities and interactive clinical tools.
Summary updated