AToP: An Explainability Framework for Transformer-Based EHR Predictions Using Attribution-Guided Temporal Pattern Mining
Objective: To develop and evaluate AToP (Attribution to Temporal Patterns), a post-hoc explainability framework that converts per-token Integrated Gradients (IG) from a Transformer into structured temporal pattern narratives. Materials and Methods: AToP was applied to a single-stream Transformer trained on MIMIC-IV v3.1 (218,196 patients; 12.6% unplanned 30-day readmission). It mines frequent episodes from salient-token subsequences in the training cohort, aggregates attribution among patients whose records contain each token or pattern, and collapses near-duplicates by patient overlap. Validation used masking, reversed-order analysis, token-level faithfulness tests, and KernelSHAP comparison. Results: The Transformer achieved AUROC 0.77 and PR-AUC 0.34. Population-weighted attribution emphasized high-prevalence codes with small per-patient impact. Carrier-conditional attribution, the mean among patients with the token, surfaced rare high-attribution psychiatric markers including psychosis, self-harm overdose, suicidal ideation (SI), and severe major depressive disorder (MDD). Pattern-level attribution identified within-visit co-occurrences and cross-visit trajectories not captured by token rankings. Risk-increasing patterns included psychiatric sequences ({MDD, SI} → SI) and oncologic progressions (cancer anemia → ascites). Obstetric and chest pain evaluation patterns were associated with lower predicted readmission. Discussion: The framework provides two complementary views of model predictions: carrier-conditional aggregation highlights rare, highly attributed clinical features, while temporal pattern analysis identifies within-visit combinations and cross-visit trajectories missed by token-level rankings. Masking and visit-order reversal provided evidence of correspondence with model behavior, but pattern attributions do not represent unique effects or establish clinical validity. Conclusion: AToP turns a Transformer's attributions into visit-anchored temporal pattern narratives, showing which events, in which order, contribute to its readmission predictions.
Authors
- Anas Belouali (ORCID: https://orcid.org/0000-0002-2780-2500)
- Hadi H.K. Kharrazi (ORCID: https://orcid.org/0000-0003-1481-4323)
Institutions
- Johns Hopkins University (US)
Publication Details
- Journal
- medRxiv
- Published
- 2026-11-12
- DOI
- https://doi.org/10.64898/2026.11.10.26367753
- Primary Topic
- Explainable Artificial Intelligence (XAI)
- Type
- preprint