Attention-based Interpretability with Concept Transformers

Mattia Rigotti, Christoph Miksovic, Ioana Giurgiu, Thomas Gschwind, Paolo ScottonICLR 2022

In the quest to open the "black box" of deep learning, researchers often face a trade-off: do you want a high-performing model that no one understands, or a simple model that is easy to explain but performs poorly? A new paper from IBM Research suggests we don't have to choose. By rethinking how attention mechanisms work, the authors introduce the Concept Transformer (CT)—a module that forces models to "think" in terms of high-level, human-understandable concepts.

TL;DR

The Concept Transformer is a drop-in replacement for standard classifier heads that uses cross-attention to link input features to high-level, user-defined concepts. By design, it ensures that model explanations are both faithful (truly reflecting the model's logic) and plausible (making sense to humans), while actually boosting accuracy in data-scarce scenarios.

The Problem: Opaque Models and the Attention Debate

Most modern deep learning models are notoriously opaque. While techniques like Grad-CAM or LIME provide "post-hoc" explanations, they usually highlight low-level features—like a specific cluster of pixels—that don't necessarily correspond to how a human expert would describe a decision.

Furthermore, there is a heated debate in the AI community about whether "attention is explanation." Often, attention weights are processed by so many downstream layers that their original meaning is lost by the time the model makes a final prediction. The authors address this by creating an architecture where the attention is the final decision logic, ensuring the explanation isn't just a visualization added after the fact, but the actual engine of the prediction.

Methods: The Concept Transformer

The core innovation is the Concept Transformer module. Instead of a standard fully connected layer at the end of a network, the CT uses a cross-attention mechanism.

Concept Transformer Architecture
  1. Concept Embeddings: The user defines a set of high-level concepts (e.g., "yellow beak," "wing shape"). These are represented as learnable embeddings.
  2. Cross-Attention: The model calculates attention scores between the input features (like image patches) and these concept embeddings.
  3. Faithfulness by Design: The final output is a linear combination of these concept contributions. If the model identifies a bird based on "red feathers," you can mathematically prove that the "red feathers" concept drove the log-probability.
  4. Plausibility by Construction: During training, the authors add an "explanation cost" to the loss function. This supervises the attention heads, encouraging them to align with known domain knowledge.

Because it is differentiable, the CT can be plugged into almost any backbone (ResNet, ViT, etc.) and trained end-to-end.

Key Insights and Results

The authors validated their approach on three distinct benchmarks: MNIST Even/Odd, CUB-200-2011 (birds), and aPY (objects and attributes).

  • Interpretability as a Regularizer: One of the most striking findings is that "forcing" the model to be interpretable actually makes it a better learner. In low-data regimes, the domain knowledge injected through concepts acts as a powerful guide, helping the model generalize faster.
Sample Efficiency on MNIST
  • Sample Efficiency: As shown above, using concepts provided a significant performance boost when training on very small samples (e.g., 100–500 images on the MNIST dataset).
  • Accuracy Boost: On the CUB bird dataset, the Concept Transformer achieved 88.0% accuracy, a massive jump from the 76.9% achieved by the same architecture without concept supervision.
  • Diagnostic Power: When the model fails, the CT explains why. For example, it might misclassify a bird because a key differentiating concept was obscured in the photo. This allows users to trust the model's "thought process" even when it's wrong.

Limitations and Future Work

To get the full benefit of "plausibility," the model requires concept-level annotations during training. While many specialized fields (like medicine) have this data, it isn't always available for general tasks. Currently, the model treats concepts as independent contributions. Future work could involve modeling the relationships between concepts—for instance, using First-Order Logic to define that "if it has a trunk and tusks, it must be an elephant." Finally, while tested on images, the versatility of the Transformer architecture suggests this could be applied to NLP or multimodal data.

Summary updated

BibTeX
@inproceedings{rigotti2022attention,
  author = {Mattia Rigotti and Christoph Miksovic and Ioana Giurgiu and Thomas Gschwind and Paolo Scotton},
  title = {{Attention-based Interpretability with Concept Transformers}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=tYcpKX-505E},
}
Figure