Generalized Attention Flow: Feature Attribution for Transformer Models via Maximum Flow

Behrooz Azarkhalili, Maxwell Libbrecht
2/14/2025
cs.LGcs.AI

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

This paper introduces Generalized Attention Flow (GAF), a novel feature attribution method for Transformer-based models to address the limitations of current approaches. By extending Attention Flow and replacing attention weights with the generalized Information Tensor, GAF integrates attention weights, their gradients, the maximum flow problem, and the barrier method to enhance the performance of feature attributions. The proposed method exhibits key theoretical properties and mitigates the shortcomings of prior techniques that rely solely on simple aggregation of attention weights. Our comprehensive benchmarking on sequence classification tasks demonstrates that a specific variant of GAF consistently outperforms state-of-the-art feature attribution methods in most evaluation settings, providing a more reliable interpretation of Transformer model outputs.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{azarkhalili2025generalized,
  title  = {Generalized Attention Flow: Feature Attribution for Transformer Models via Maximum Flow},
  author = {Behrooz Azarkhalili and Maxwell Libbrecht},
  year   = {2025},
  eprint = {2502.15765},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.15765v1}
}

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/2502.15765.svg)](https://codeofpaper.com/paper/2502.15765)

Discussion