Explainable Transformer Prototypes for Medical Diagnoses

Ugur Demir, Debesh Jha, Zheyuan Zhang, Elif Keles, Bradley D. Allen, Aggelos K. Katsaggelos, Ulas Bagci

Introduction

Deep Learning (DL) has demonstrated remarkable potential in medical imaging, yet its clinical adoption is frequently hindered by the "black-box" nature of standard neural architectures. In high-stakes environments like radiology, clinicians require more than just a classification; they need to understand the underlying rationale for a diagnosis. Existing interpretability methods generally fall into two categories: ad-hoc post-processing tools like Grad-CAM, which often produce noisy or unstable heatmaps, and inherently interpretable models that frequently sacrifice predictive performance for transparency.

This research introduces a novel Transformer-based architecture designed to bridge this gap. By replacing standard self-attention with an interpretable mechanism grounded in prototype learning, the model moves from rigid grid-based attention to a flexible "region-to-region" approach. This allows the model to provide precise visual explanations for medical diagnoses, such as those found in chest X-rays, while maintaining high diagnostic accuracy.

Methodology

The core innovation of this work is the Interpretable Self-Attention Module, integrated into a Convolutional Vision Transformer (CvT) backbone. This module replaces the standard self-attention mechanism with a three-stage process designed for transparency:

  1. Mask and Query Generation: Unlike standard Transformers that divide images into fixed patches, this architecture utilizes a dedicated masking branch. This branch generates adaptive masks that identify specific regions of interest. These masks are used to pool convolutional features into "query" vectors, allowing the model to focus on anatomically relevant shapes rather than arbitrary squares.
  2. Region-to-Region (R2R) Self-Attention: In traditional self-attention, keys and values are derived directly from the input. In this model, the authors introduce parametric prototypes—learnable vectors that represent canonical patterns of specific diseases. The model compares the input queries (the regions identified in the first step) to these learned prototypes (keys) to determine similarity.
  3. Output Feature Reconstruction: The resulting similarity scores are used to weight the masks and combine them with prototype "value" vectors. This process reconstructs the features for subsequent layers while preserving a clear spatial map of which regions were most influential in the decision-making process.

By replacing all self-attention layers in the CvT with this module, the model generates explanation masks at multiple resolution levels, providing a hierarchical view of the diagnostic evidence.

Experimental Setup

The model was evaluated using the NIH Chest X-ray dataset, a large-scale public benchmark. The dataset consists of 112,120 frontal-view X-ray images from 30,805 unique patients, covering 14 distinct disease labels, including Atelectasis, Cardiomegaly, and Effusion. This dataset provides a rigorous testing ground for both the classification accuracy and the localization capabilities of the proposed interpretable module.

Key Insights and Results

Quantitative Performance

When trained from scratch, the proposed model achieved a mean AUC of 0.798, a significant improvement over the baseline CvT model, which achieved 0.682. While the model slightly trailed the state-of-the-art XprotoNet (0.822), it is important to note that XprotoNet utilizes a pre-trained DenseNet backbone, whereas the proposed model was evaluated based on training from scratch. This suggests that the interpretable architecture is highly effective even without the benefit of large-scale pre-training.

Qualitative Interpretability

Visual analysis of the generated R2R Masks demonstrated superior precision compared to standard attribution methods like Grad-CAM or Information Bottleneck Attribution (IBA). The R2R Masks were found to be cleaner and more anatomically relevant, effectively localizing lesions without the pixel-level noise common in post-hoc methods. Notably, in cases where multiple pathologies were present (e.g., both Cardiomegaly and Effusion), the model successfully generated distinct and accurate masks for each condition.

The Role of Prototypes

The use of parametric prototypes allows the model to develop an internal "atlas" of medical knowledge. Because these prototypes are learned across the entire dataset, they represent generalized patterns of disease. This makes the model's decision-making process more robust and its explanations more grounded in learned medical concepts.

Limitations and Future Work

Despite its success, the model currently faces a performance gap when compared to architectures that leverage ImageNet pre-trained backbones. The authors anticipate that pre-training the interpretable Transformer on larger datasets will likely bridge this gap. Additionally, while the current study focuses on chest X-rays, future research will explore the application of these interpretable prototypes to other modalities, such as MRI and CT scans, and investigate their utility in non-medical domains where transparency is a critical requirement. Finally, the resolution of the explanation masks remains tied to the spatial dimensions of the backbone's intermediate layers, a constraint that future iterations may seek to relax.

Summary updated

BibTeX
@inproceedings{demir2024explainable,
  author = {Ugur Demir and Debesh Jha and Zheyuan Zhang and Elif Keles and Bradley D. Allen and Aggelos K. Katsaggelos and Ulas Bagci},
  title = {{Explainable Transformer Prototypes for Medical Diagnoses}},
  booktitle = {ISBI},
  year = {2024},
  doi = {10.1109/isbi56570.2024.10635182},
}
Figure