Reproduce “Generalized Attention Flow: Feature Attribution for Transformer Models via Maximum Flow” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Behrooz Azarkhalili, Maxwell Libbrecht

Generalized Attention Flow (GAF) introduces a feature attribution method for Transformer models that leverages a generalized information tensor and a regularized maximum flow formulation to provide unique, axiomatically sound Shapley value attributions. The Attention Attention Grad Flow variant consistently outperforms other state-of-the-art methods in identifying important tokens across various NLP sequence classification tasks.

Key insights

  • The log barrier regularization successfully resolves the non-uniqueness issue in optimal flow solutions, a critical theoretical advancement that validates the method's interpretability.
  • The unique optimal flow solutions derived from GAF are formally proven to correspond to Shapley values, ensuring the method's compliance with key axiomatic properties (efficiency, symmetry, nullity, linearity).
  • Combining both attention weights and their gradients (Attention Attention Grad Flow) in the information tensor provides a richer and more accurate representation of information circulation, leading to superior empirical performance.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.