Gradformer: Graph Transformer with Exponential Decay

Chuang Liu, Zelin Yao, Yibing Zhan, Xueqi Ma, Shirui Pan +1 more
4/24/2024
cs.LG

Official code: LiuChuang0059/Gradformer (55 stars, last commit 2024-12-10).

Abstract

Graph Transformers (GTs) have demonstrated their advantages across a wide range of tasks. However, the self-attention mechanism in GTs overlooks the graph's inductive biases, particularly biases related to structure, which are crucial for the graph tasks. Although some methods utilize positional encoding and attention bias to model inductive biases, their effectiveness is still suboptimal analytically. Therefore, this paper presents Gradformer, a method innovatively integrating GT with the intrinsic inductive bias by applying an exponential decay mask to the attention matrix. Specifically, the values in the decay mask matrix diminish exponentially, correlating with the decreasing node proximities within the graph structure. This design enables Gradformer to retain its ability to capture information from distant nodes while focusing on the graph's local details. Furthermore, Gradformer introduces a learnable constraint into the decay mask, allowing different attention heads to learn distinct decay masks. Such an design diversifies the attention heads, enabling a more effective assimilation of diverse structural information within the graph. Extensive experiments on various benchmarks demonstrate that Gradformer consistently outperforms the Graph Neural Network and GT baseline models in various graph classification and regression tasks. Additionally, Gradformer has proven to be an effective method for training deep GT models, maintaining or even enhancing accuracy compared to shallow models as the network deepens, in contrast to the significant accuracy drop observed in other GT models.Codes are available at \url{https://github.com/LiuChuang0059/Gradformer}.

View on arXivView PDF

Code Implementations(1)

Code for IJCAI'24 paper: Gradformer: Graph Transformer with Exponential Decay

555Shell, CythonApr 23, 20241 years ago

Similar Papers

Cite this paper

@article{liu2024gradformer,
  title  = {Gradformer: Graph Transformer with Exponential Decay},
  author = {Chuang Liu and Zelin Yao and Yibing Zhan and Xueqi Ma and Shirui Pan and Wenbin Hu},
  year   = {2024},
  eprint = {2404.15729},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.15729v1}
}

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

Discussion