Towards Mechanistic Interpretability of Graph Transformers via Attention Graphs

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: El, Batu, Choudhury, Deepro, Liò, Pietro, Joshi, Chaitanya K.
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866917935832891392
author El, Batu
Choudhury, Deepro
Liò, Pietro
Joshi, Chaitanya K.
author_facet El, Batu
Choudhury, Deepro
Liò, Pietro
Joshi, Chaitanya K.
contents We introduce Attention Graphs, a new tool for mechanistic interpretability of Graph Neural Networks (GNNs) and Graph Transformers based on the mathematical equivalence between message passing in GNNs and the self-attention mechanism in Transformers. Attention Graphs aggregate attention matrices across Transformer layers and heads to describe how information flows among input nodes. Through experiments on homophilous and heterophilous node classification tasks, we analyze Attention Graphs from a network science perspective and find that: (1) When Graph Transformers are allowed to learn the optimal graph structure using all-to-all attention among input nodes, the Attention Graphs learned by the model do not tend to correlate with the input/original graph structure; and (2) For heterophilous graphs, different Graph Transformer variants can achieve similar performance while utilising distinct information flow patterns. Open source code: https://github.com/batu-el/understanding-inductive-biases-of-gnns
format Preprint
id arxiv_https___arxiv_org_abs_2502_12352
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Towards Mechanistic Interpretability of Graph Transformers via Attention Graphs
El, Batu
Choudhury, Deepro
Liò, Pietro
Joshi, Chaitanya K.
Machine Learning
Artificial Intelligence
We introduce Attention Graphs, a new tool for mechanistic interpretability of Graph Neural Networks (GNNs) and Graph Transformers based on the mathematical equivalence between message passing in GNNs and the self-attention mechanism in Transformers. Attention Graphs aggregate attention matrices across Transformer layers and heads to describe how information flows among input nodes. Through experiments on homophilous and heterophilous node classification tasks, we analyze Attention Graphs from a network science perspective and find that: (1) When Graph Transformers are allowed to learn the optimal graph structure using all-to-all attention among input nodes, the Attention Graphs learned by the model do not tend to correlate with the input/original graph structure; and (2) For heterophilous graphs, different Graph Transformer variants can achieve similar performance while utilising distinct information flow patterns. Open source code: https://github.com/batu-el/understanding-inductive-biases-of-gnns
title Towards Mechanistic Interpretability of Graph Transformers via Attention Graphs
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2502.12352