Manuscript Offprint

arXiv:2610.35593

SAP-ViT: A Self-Attributing Patch Vision Transformer for Medical Image Classification

Wei Zhang, Wolfgang Nejdl, Ming Tang

WEI ZHANG, WOLFGANG NEJDL, MING TANG

L3S Research Center, Leibniz University Hannover, 30167 Hannover, Germany

Corresponding author: Wei Zhang (wei.zhang@l3s.de).

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.

INDEX TERMS Interpretability, Vision transformer, Medical image classification.

arXiv:2610.3593v1

1. INTRODUCTION

Transformer-based models have recently been explored across diverse medical imaging tasks [1]. In medical image classification, models are increasingly expected not only to make accurate predictions but also to provide interpretable evidence for those predictions. This requirement is especially important in clinical settings, where model outputs may support high-stakes decisions and where clinicians need to inspect whether the model relies on medically meaningful image regions.

Vision Transformer (ViT) [2] classifiers have shown strong performance in image classification, but standard ViT classifiers usually rely on a global classification (CLS) token for prediction. The CLS token aggregates information across patch tokens and produces an image-level representation, which is effective for classification but poorly aligned with local interpretability. In medical imaging, where disease evidence is often spatially localized, it is desirable to understand how individual image regions contribute to the prediction.

A natural solution is to make the prediction itself patch-decomposable. However, patch-level attribution in ViT is non-trivial because self-attention [3] mixes information across patch tokens. As a result, an influential last-layer patch embedding may contain information not only from its corresponding input patch but also from other regions of the image. Therefore, patch-level attribution in ViT requires both a decomposable prediction mechanism and a way to relate influential output patch embeddings back to input-space evidence.

In this work, we propose SAP-ViT, a Self-Attributing Patch Vision Transformer for medical image classification. SAP-ViT replaces CLS-based classification with direct aggregation of last-layer patch embeddings. Each patch embedding is assigned a learned aggregation weight, allowing the class prediction to be decomposed into patch-level contributions as part of the forward pass. We use the term self-attributing because attribution is built into the prediction mechanism itself, rather than being produced only by an external post-hoc explainer.

To encourage concise and readable explanations, SAP-ViT applies sparsity regularization to the patch-weight distribution. This encourages the model to rely on a compact set of informative patches rather than distributing evidence diffusely across the entire image. Since self-attention mixes information across tokens, SAP-ViT further introduces an input-space back-mapping mechanism. This module estimates which input patches contribute to influential output patch embeddings, providing an approximate input-space attribution of the model's patch-level decision evidence.

Our contributions are threefold:

First, we propose a patch-additive ViT classifier that predicts directly from last-layer patch embeddings rather than the final CLS representation, enabling explicit decomposition of class predictions into patch-level contributions.

Second, we introduce sparsity regularization on patch weights to encourage the model to rely on a compact set of informative image regions.

Third, we propose an input-space back-mapping mechanism that estimates which input patches contribute to influential output patch embeddings, addressing the token-mixing effect of self-attention.

References (38)