NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

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 JinarXiv 2022 · DOI

TL;DR

ProtoPFormer is a novel interpretable image recognition framework that successfully adapts prototypical part learning to Vision Transformers (ViTs). By introducing a dual-branch architecture that combines global holistic views with localized part-based reasoning, it solves the "prototype distraction" problem where models mistakenly focus on background noise, achieving state-of-the-art accuracy alongside clear, human-like visual explanations.

What Problem Does This Paper Address?

Deep neural networks are often "black boxes," making decisions that are difficult for humans to trace. ProtoPNet (Prototypical Part Network) was a major step toward "Explainable AI" (XAI) by making classifications based on a "this looks like that" logic—comparing parts of an input image to learned prototypical parts of a class.

However, ProtoPNet was designed for Convolutional Neural Networks (CNNs). When researchers tried applying it to Vision Transformers (ViTs), they hit a wall called the "prototype distraction" problem. Because ViTs excel at modeling long-range dependencies, their learned prototypes often become activated by the background (like grass or sky) rather than the actual object. This results in fragmented, scattered activation maps that destroy the model's interpretability.

Methods

The authors propose ProtoPFormer, which leverages the unique architecture of ViTs to fix these distractions through a two-step concentration process:

  1. Global and Local Prototypes: The model splits into two branches. The Global Branch uses the ViT's class token ([CLS]) to capture holistic features of the target. The Local Branch uses image patch tokens to focus on specific parts (like a bird's beak or a dog's ear).
  2. Foreground Preserving (FP) Mask: To stop the model from looking at the background, the global branch uses "attention rollout" to identify which tokens belong to the foreground object. It then creates a binary mask that forces the local branch to ignore background tokens entirely.
  3. Prototypical Part Concentration (PPC) Loss: The authors introduce a new loss function that treats prototype activation maps as bivariate Gaussian distributions. This loss penalizes prototypes that are too spread out (encouraging small variance) and pushes the centers of different prototypes apart to ensure they capture diverse visual features.
Figure 2. Illustration of ProtoPFormer for image recognition interpretation. The global branch provides guidance for the local branch with the FP mask. The strategy of mutual correction and joint decision makes them contribute complementarily to final predictions, capitalizing on the built-in architectures in ViTs. The loss propagation of LCE is omitted for simplicity.

Datasets

The model was evaluated on three widely-used fine-grained image recognition benchmarks:

  • CUB-200-2011: 200 bird species (5,994 training images).
  • Stanford Dogs: 120 dog breeds (12,000 training images).
  • Stanford Cars: 196 car types (8,144 training images).

These datasets are ideal for testing interpretability because distinguishing between similar species or models requires focusing on very specific, subtle parts.

Key Insights and Ideas

  • Mutual Correction: A key "aha" moment is that the global and local branches can correct each other. As shown in the paper's reasoning examples, the global branch might mistakenly identify a bird based on its general silhouette, but the local branch can override this by identifying unique specific parts, leading to a correct joint decision.
  • Exploiting ViT Structure: Rather than fighting the ViT's global attention mechanism, ProtoPFormer uses it as a tool. The global attention provides the "where" (the FP mask), allowing the local prototypes to focus on the "what."
  • Gaussian Fitting for Focus: By modeling activations as Gaussians, the researchers provide a mathematical framework to enforce the "peaky" activations necessary for human-readable explanations.
Figure 1. Visual comparison of prototypes on an example im- age between a CNN-based ProtoPNet (ResNet34 [18]) and a ViT- based ProtoPNet (DeiT-Ti [42]), and our ProtoPFormer (DeiT-Ti).

Key Results

ProtoPFormer consistently outperformed both non-interpretable ViT baselines and previous state-of-the-art (SOTA) prototype-based methods:

  • Accuracy: On the CUB dataset, ProtoPFormer achieved 82.26% (DeiT-Ti) and 84.85% (DeiT-S), surpassing standard ProtoPNet and other variants like ProtoTree and TesNet.
  • Efficiency: It achieves these gains while adding very few parameters compared to other interpretable ViT variants like ViT-Net.
  • Qualitative Interpretability: Visualization results (see Figure 4 in the paper) show that ProtoPFormer's prototypes are tightly centered on meaningful parts (heads, bellies, wings) while baselines often fire on the surrounding grass or branches.
Figure 5. Heat maps of the same local prototypes on different examples from the training and test set with DeiT-S.

Limitations and Future Work

The authors note that the performance is somewhat sensitive to hyperparameters, such as the number of kept foreground tokens ($K$) and the weights of the PPC loss. While they found optimal values for their datasets, these might require tuning for new domains.

For future work, the team plans to apply ProtoPFormer to high-stakes fields like medical image diagnosis and model debugging, where understanding why a model made a specific prediction is just as important as the prediction itself.

Summary updated

BibTeX
@misc{xue2022protopformer,
  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}},
  year = {2022},
  eprint = {2208.10431},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.10431},
}
Figure