Skip to main content
QUICK REVIEW

[Paper Review] Holistically Explainable Vision Transformers

Moritz Böhle, Mario Fritz|arXiv (Cornell University)|Jan 20, 2023
Explainable Artificial Intelligence (XAI)Computer Science8 citations
TL;DR

The paper introduces B-cos transformers that are designed to provide holistic, model-inherent explanations for Vision Transformers by rendering each component dynamic linear, enabling a single input-dependent linear summary of the entire model.

ABSTRACT

Transformers increasingly dominate the machine learning landscape across many tasks and domains, which increases the importance for understanding their outputs. While their attention modules provide partial insight into their inner workings, the attention scores have been shown to be insufficient for explaining the models as a whole. To address this, we propose B-cos transformers, which inherently provide holistic explanations for their decisions. Specifically, we formulate each model component - such as the multi-layer perceptrons, attention layers, and the tokenisation module - to be dynamic linear, which allows us to faithfully summarise the entire transformer via a single linear transform. We apply our proposed design to Vision Transformers (ViTs) and show that the resulting models, dubbed Bcos-ViTs, are highly interpretable and perform competitively to baseline ViTs on ImageNet. Code will be made available soon.

Motivation & Objective

  • Motivate the need for holistic explanations in transformer models beyond attention maps.
  • Develop transformers whose components are dynamic linear to enable a single linear summary per input.
  • Design each ViT component (tokenisation, attention, MLPs, and classifier) to be interpretable within the B-cos framework.
  • Introduce a mechanism to learn attention priors that encode positional information without sacrificing interpretability.
  • Empirically evaluate classification performance and explanation quality on ImageNet.

Proposed method

  • Formulate each ViT component as a dynamic linear transform to obtain a per-input weight matrix W(x).
  • Replace standard ViT components with B-cos counterparts: B-cos Token, B-cos AttBlock, B-cos MLPBlock, and B-cos Classifier.
  • Modify attention to a B-cos Attention Block with bounded outputs and layer-normalization before attention scores.
  • Use MaxOut and B-cos transformations to create interpretable MLP blocks and classifier.
  • Introduce additive or multiplicative attention priors to encode positional information in a learnable bias B.
  • Provide model-inherent explanations via contribution maps c_k(x) = W(x)^T_k ⊙ x, linking weights to inputs.

Experimental results

Research questions

  • RQ1Can B-cos design yield holistic, interpretable explanations for all ViT components?
  • RQ2Do dynamic linear ViTs produce useful, class-specific contributions that explain their decisions?
  • RQ3What is the impact of learned attention priors on accuracy and interpretability?
  • RQ4How do B-cos ViTs compare to baseline ViTs in ImageNet accuracy and explanation quality?
  • RQ5How do different positional information strategies affect performance and interpretability?

Key findings

  • B-cos ViTs achieve competitive ImageNet accuracy across Tiny, Small, and Base sizes versus baseline ViTs.
  • Multiplicative attention bias priors consistently improve performance for B-cos ViTs.
  • Model-inherent explanations outperform post-hoc methods in localisation and perturbation metrics on evaluated configurations.
  • Contribution heatmaps derived from W(x) provide detailed, class-specific explanations that align with input patterns.
  • B-cos explanations significantly outperform Rollout-based post-hoc explanations on the same models in localisation metrics.
  • Qualitative visualizations show coherent, feature-aligned explanations that reflect model decisions.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.