SAP-ViT: A Self-Attributing Patch Vision Transformer for Medical Image Classification
Organizations: L3S Research Center, Leibniz University Hannover, 30167 Hannover, Germany
Abstract
Vision Transformer (ViT) classifiers commonly rely on a global classification (CLS) token for image-level prediction, which is poorly aligned with local interpretability requirements in medical imaging. We propose SAP-ViT, a Self-Attributing Patch Vision Transformer that replaces CLS-based classification with direct aggregation of last-layer patch embeddings. This design makes class predictions decomposable into patch-level contributions as part of the forward pass. To encourage concise and readable evidence, SAP-ViT applies sparsity regularization to the patch-weight distribution. Since self-attention mixes information across patch tokens, we further introduce an input-space back-mapping mechanism to estimate which input patches contribute to influential output patch embeddings. We evaluate SAP-ViT qualitatively and quantitatively on multiple medical image classification datasets spanning different imaging modalities. The results show that SAP-ViT maintains strong classification performance while providing consistent and interpretable patch-level explanations across datasets. Ablation results further show that both sparsity regularization and the alignment component of input-space back-mapping contribute to the final explanation quality. Overall, SAP-ViT provides a favorable trade-off between predictive accuracy and interpretability for ViT-based medical image classification.
Figures & tables
| Dataset | Modality | # Classes | # Images |
| Brain tumor MRI | MRI | 4 | 7023 |
| COVID chest X-ray | Chest X-ray | 4 | 21165 |
| Pneumonia chest X-ray | Chest X-ray | 2 | 5856 |
| Breast ultrasound | Ultrasound | 3 | 780 |
| Dataset | Entropy norm | Gini |
| Brain tumor MRI | ||
| COVID chest X-ray | ||
| Pneumonia chest X-ray | ||
| Breast ultrasound |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Study | Model | Accuracy (%) |
| Disci et al. [ 39 ] | Xception | 98.73 |
| Haque et al. [ 38 ] | NeuroNet19 | 99.30 |
| Shahin [ 37 ] | Fine-tuned ResNet34 | 99.66 |
| SAP-ViT (ours) | SAP-ViT |
| Model | Precision | Sensitivity | F1 |
| Brain tumor MRI | |||
| SAP-ViT | |||
| IA-ViT | |||
| Vanilla ViT | |||
| COVID chest X-ray | |||
| SAP-ViT | |||
Explainable Image Classification
Explainable image classification develops ways to show which pixels, regions, concepts, or model features support an image classifier’s predictions.
See all 97 papers