arXiv:2502.12352cs.LGcs.AI2025-02被引 14

用注意力图分析图Transformer的信息流动,揭示模型如何学习图结构。

Towards Mechanistic Interpretability of Graph Transformers via Attention Graphs

  • 将注意力矩阵聚合为注意力图,追踪节点间信息传递路径。
  • 模型学习的注意力图与原始图结构无关,说明其能自主发现新结构。
  • 不同变体在异质图上表现相似但信息流模式各异,适合对比研究。

我们提出注意力图(Attention Graphs),一种用于图神经网络(GNNs)和图Transformer机制可解释性的新工具,基于消息传递与自注意力机制的数学等价性。注意力图通过聚合Transformer各层与注意力头的注意力矩阵,描述输入节点间的信息流动。在同质与异质节点分类任务上的实验表明:(1) 当图Transformer使用全连接注意力学习最优图结构时,模型学到的注意力图与原始图结构无显著相关性;(2) 在异质图上,不同图Transformer变体可达到相似性能,但采用截然不同的信息流模式。代码开源:https://github.com/batu-el/understanding-inductive-biases-of-gnns

原文摘要 · Abstract (English)

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

图神经网络注意力机制可解释性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。