ProtoPFormer: Concentrating on Prototypical Parts in Vision Transformers for Interpretable Image Recognition

Mengqi Xue, Qihan Huang, Haofei Zhang, Jingwen Hu, Jie Song, Mingli Song, Canghong Jin

Abstract

Vision Transformers (ViTs) have achieved state-of-the-art performance in image classification but suffer from a lack of interpretability due to the "homogeneity" of their tokens. This leads to the "distraction problem," where prototypical part-based models focus on background noise rather than the object of interest. We present ProtoPFormer, a novel framework that introduces a global-local dual-branch architecture and a Prototypical Part Concentration (PPC) loss. These innovations allow the model to focus on discriminative object parts, significantly improving human-centric interpretability without sacrificing accuracy. On the CUB-200-2011 dataset, ProtoPFormer achieves 82.26% accuracy and nearly doubles the human agreement score compared to previous methods.

Introduction: The Interpretability Gap in Transformers

In the quest for "Explainable AI" (XAI), the Prototypical Part Network (ProtoPNet) has been a popular approach. It classifies images by comparing local patches to learned "prototypes" (e.g., "this is a bird because this part looks like a prototypical wing"). While successful with Convolutional Neural Networks (CNNs), these models struggle when paired with Vision Transformers (ViTs).

The root cause is the distraction problem: ViT tokens are highly globalized through self-attention, causing learned prototypes to activate on scattered background noise like grass or sky rather than the actual object. This makes the model's "explanation" nonsensical to a human observer.

Methodology: Focus through Concentration

ProtoPFormer addresses the distraction problem through two main architectural and functional innovations:

1. Global-Local Dual Branch Architecture

To separate the object from the background, ProtoPFormer utilizes a dual-branch system:

  • Global Branch: Uses the ViT's class token to capture a holistic view and generates a Foreground Preserving (FP) mask via attention rollout. This mask identifies the spatial boundaries of the primary object.
  • Local Branch: Processes image tokens to find specific parts. By applying the FP mask from the global branch, it forces the local branch to ignore background tokens entirely, ensuring prototypes are only matched against the object of interest.

2. Prototypical Part Concentration (PPC) Loss

To prevent prototypes from becoming blurry or overly broad, the authors model activations as a bivariate Gaussian distribution. The PPC loss optimizes two criteria:

  • Concentration: It minimizes the variance of the activation map, forcing the model to focus on a tight, specific anatomical feature.
  • Divergence: It encourages different prototypes to center on different parts of the object (e.g., head vs. wing), ensuring a diverse set of evidence for classification.

Key Insights: The Homogeneity Trap

The fundamental issue with standard ViTs is the "Homogeneity Trap." In a standard ViT, the similarity between tokens increases significantly in deeper layers, making it difficult for a prototype to latch onto a unique local feature without picking up global noise.

Token similarity matrices showing that standard ViT tokens (middle) become highly homogeneous compared to CNNs (left), while ProtoPFormer (right) maintains distinct part-based representations.

As shown in the similarity matrices above, ProtoPFormer's constraints help maintain the distinctiveness of local features, preventing the "blurring" effect seen in vanilla ViTs and allowing for more precise part localization.

Experimental Results

ProtoPFormer was evaluated on three fine-grained visual categorization benchmarks: CUB-200-2011 (birds), Stanford Cars, and Stanford Dogs.

Accuracy and Human-Centric Validation

ProtoPFormer consistently outperformed both "black-box" ViT baselines and previous interpretable models. On the CUB dataset, it achieved 82.26% accuracy, surpassing the vanilla ViT (80.57%). More importantly, it achieved a 66.88% HIVE agreement score, nearly doubling the interpretability performance of the original ProtoPNet (33.54%).

Qualitative comparison of part localization. ProtoPFormer (c) identifies tight, semantically meaningful parts of the bird, whereas CNN-based ProtoPNets (a) and vanilla ViTs (b) often produce noisy or overly broad activations.

The qualitative results demonstrate that ProtoPFormer's bounding boxes tightly hug actual anatomical features, providing a clear and human-understandable rationale for its predictions, unlike the scattered activations of previous methods.

Conclusion

ProtoPFormer demonstrates that interpretability does not have to come at the cost of performance. By explicitly supervising the "shape" of attention and leveraging a dual-branch structure to filter background noise, it bridges the gap between the powerful global representations of Transformers and the local, part-based reasoning required for human-centric AI. Future work will explore applying these concentration mechanisms to sensitive domains like medical imaging, where the "why" behind a diagnosis is as critical as the diagnosis itself.

Summary updated

BibTeX
@inproceedings{xue2024protopformer,
  author = {Mengqi Xue and Qihan Huang and Haofei Zhang and Jingwen Hu and Jie Song and Mingli Song and Canghong Jin},
  title = {{ProtoPFormer: Concentrating on Prototypical Parts in Vision Transformers for Interpretable Image Recognition}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2024},
}
Figure