Attention Meets Post-hoc Interpretability: A Mathematical Perspective

Gianluigi Lopardo, Frederic Precioso, Damien Garreau
2/5/2024
stat.MLcs.CLcs.LG

No official code found. Best implementation: gianluigilopardo/attention_meets_xai (22 stars, last commit 2025-11-10).

Abstract

Attention-based architectures, in particular transformers, are at the heart of a technological revolution. Interestingly, in addition to helping obtain state-of-the-art results on a wide range of applications, the attention mechanism intrinsically provides meaningful insights on the internal behavior of the model. Can these insights be used as explanations? Debate rages on. In this paper, we mathematically study a simple attention-based architecture and pinpoint the differences between post-hoc and attention-based explanations. We show that they provide quite different results, and that, despite their limitations, post-hoc methods are capable of capturing more useful insights than merely examining the attention weights.

View on arXivView PDF

Code Implementations(1)

Code for the paper "Attention Meets Post-hoc Interpretability: A Mathematical Perspective", ICML 2024

223Python, Jupyter NotebookFeb 5, 202411 months ago

Similar Papers

Cite this paper

@article{lopardo2024attention,
  title  = {Attention Meets Post-hoc Interpretability: A Mathematical Perspective},
  author = {Gianluigi Lopardo and Frederic Precioso and Damien Garreau},
  year   = {2024},
  eprint = {2402.03485},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.03485v2},
  journal = {ICML 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.03485.svg)](https://codeofpaper.com/paper/2402.03485)

Discussion