Interpretability-Aware Vision Transformer

Yao Qiang, Chengyin Li, Prashant Khanduri, Dongxiao Zhu · DOI

TL;DR

Vision Transformers (ViTs) are powerful but opaque. This paper introduces IA-ViT, a novel training approach that makes ViTs inherently more interpretable by adding a dedicated "interpreter" module trained alongside the standard predictor. IA-ViT achieves this by leveraging both the class token and image patch embeddings, leading to faithful and high-quality explanations without sacrificing predictive performance.

What Problem Does This Paper Address?

Vision Transformers (ViTs) have revolutionized computer vision, outperforming traditional Convolutional Neural Networks (CNNs) on many tasks. However, like many deep learning models, ViTs are often treated as "black boxes," making it difficult to understand why they make certain predictions. This lack of interpretability is a significant hurdle, especially in high-stakes applications like healthcare and autonomous driving. While "post hoc" explanation methods exist, they often struggle to generalize across different ViT architectures and downstream tasks, and their effectiveness can be limited if the ViT wasn't trained with interpretability in mind. This paper addresses the need for ViTs that are interpretable by design, rather than relying on external explanation tools after training.

Methods

The core innovation is the Interpretability-Aware Vision Transformer (IA-ViT) architecture and its associated training framework. IA-ViT builds upon the standard ViT by incorporating an additional component: an interpreter.

Here's a breakdown of the key components and techniques:

  • Feature Extractor (h): This is the standard ViT backbone (e.g., ViT-B/16) that processes input images into patch embeddings.
  • Predictor (f): This is the standard ViT classifier that uses the embedding of the special [CLS] token to make the final prediction.
  • Interpreter (g): This is the novel component. It takes the embeddings of the image patches (excluding the [CLS] token) and processes them through a single-head self-attention (SSA) mechanism and a linear head. The interpreter is designed to generate explanations.
  • Interpretability-Aware Training Objective: IA-ViT is trained with a multi-objective loss function:
  • Classification Objective (Lce): Standard cross-entropy loss for accurate prediction.
  • Simulation Objective (Lkd): Knowledge distillation is used to train the interpreter to mimic the predictor's behavior. This ensures the interpreter's explanations align with the predictor's decisions.
  • Attention Regularization (Lreg): This term uses Maximum Mean Discrepancy (MMD) to align the attention distributions from the ViT's multi-head self-attention (MSA) blocks in the feature extractor with the attention distribution from the interpreter's SSA block. This encourages both components to focus on similar discriminative features.

The overall training objective is a weighted sum of these three losses, allowing the model to learn both accurate predictions and faithful explanations simultaneously.

Datasets

The paper evaluates IA-ViT on several standard image classification datasets:

  • CIFAR10
  • STL10
  • Dog&Cat (likely a custom split or dataset focusing on these classes)
  • CelebA (used for both classification and fairness evaluation)

Key Insights and Ideas

  • Leveraging Neglected Patch Embeddings: A key insight is that ViTs often underutilize the feature embeddings from individual image patches, focusing primarily on the [CLS] token for prediction. IA-ViT demonstrates that these patch embeddings contain crucial discriminative information that can be effectively used for generating explanations.
  • Interpreter Mimicking Predictor: The simulation objective (knowledge distillation) is crucial. It forces the interpreter to learn how the predictor arrives at its decisions, ensuring that the generated explanations are not arbitrary but directly related to the model's predictive process.
  • Attention Alignment for Faithfulness: The attention regularization term is vital for ensuring that the explanations are faithful. By aligning attention distributions from the feature extractor and the interpreter, the model is encouraged to focus on high-density areas of information and ignore noisy or irrelevant features, leading to more focused and meaningful explanations.
  • Interpretability by Design: The paper advocates for integrating interpretability into the training process rather than relying solely on post hoc methods. This "learning with interpretation" approach leads to more robust and reliable explanations.

Key Results

  • Performance: IA-ViT achieves classification accuracies comparable to the vanilla ViT, with a minimal performance drop rate (PDR) of around 1.16% on average across datasets. The interpreter's accuracy is also on par with the predictor.
  • Quantitative Explanation Evaluation: IA-ViT's interpreter, when used for attribution maps, consistently outperforms baseline post hoc methods (RawAtt, Rollout, AttGrads, AGCAM) on deletion and insertion scores across multiple datasets. This indicates that IA-ViT's explanations are more precise and informative.
  • Qualitative Explanation Evaluation: Visualizations (attribution maps) show that IA-ViT's interpreter generates more focused heatmaps that highlight the target objects, while baselines often produce dispersed or irrelevant attention.
  • Fairness: On the CelebA dataset, IA-ViT demonstrates improved fairness metrics (reduced demographic parity and equality of odds) compared to vanilla ViT, suggesting that its interpretability-aware training helps extract "real" features rather than spurious ones correlated with sensitive attributes.
  • Ablation Studies: Removing the simulation objective (Lkd) significantly degrades the interpreter's accuracy and explanation quality. Removing attention regularization (Lreg) also negatively impacts explanation quality, though less severely than removing Lkd.

Limitations and Future Work

  • Limitations:
    • The paper acknowledges that while IA-ViT maintains strong predictive performance, there's always a potential trade-off with interpretability constraints.
  • The effectiveness of the attention regularization relies on the assumption that aligning attention distributions leads to better explanations, which is empirically supported but could be further explored.
  • Future Work:
    • The authors suggest further analysis of the attention regularization's impact.
  • The framework is designed to be general and could be extended to other downstream tasks beyond image classification.
  • Exploring more complex interpreter architectures or different regularization techniques could be future directions.

Summary updated

BibTeX
@inproceedings{qiang2023interpretability,
  author = {Yao Qiang and Chengyin Li and Prashant Khanduri and Dongxiao Zhu},
  title = {{Interpretability-Aware Vision Transformer}},
  booktitle = {IJCNN},
  year = {2023},
  doi = {10.1109/ijcnn64981.2025.11227842},
}
Figure