Lune

ICML2024Top-tier venue

What Improves the Generalization of Graph Transformers? A Theoretical Dive into the Self-attention and Positional Encoding

Hongkang Li, Meng Wang, Tengfei Ma, Sijia Liu, Zaixi Zhang, Pin-Yu Chen

Abstract

Graph Transformers, which incorporate self-attention and positional encoding, have recently emerged as a powerful architecture for various graph learning tasks. Despite their impressive performance, the complex non-convex interactions across layers and the recursive graph structure have made it challenging to establish a theoretical foundation for learning and generalization. This study introduces the first theoretical investigation of a shallow Graph Transformer for semi-supervised node classification, comprising a self-attention layer with relative positional encoding and a two-layer perceptron. Focusing on a graph data model with discriminative nodes that determine node labels and non-discriminative nodes that are class-irrelevant, we characterize the sample complexity required to achieve a desirable generalization error by training with stochastic gradient descent (SGD). This paper provides the quantitative characterization of the sample complexity and number of iterations for convergence dependent on the fraction of discriminative nodes, the dominant patterns, and the initial model errors. Furthermore, we demonstrate that self-attention and positional encoding enhance generalization by making the attention map sparse and promoting the core neighborhood during training, which explains the superior feature representation of Graph Transformers. Our theoretical results are supported by empirical experiments on synthetic and real-world benchmarks.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

11 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Generalizable Insights for Graph Transformers in Theory and Practice cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
  • Generalizable Insights for Graph Transformers in Theory and Practice cites Do Transformers Really Perform Badly for Graph Representation?
  • Generalizable Insights for Graph Transformers in Theory and Practice cites Language Models are Few-Shot Learners
  • Invariant Graph Transformer for Out-of-Distribution Generalization cites Do Transformers Really Perform Badly for Graph Representation?
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
  • Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
  • Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites Geom-GCN: Geometric Graph Convolutional Networks
  • Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites Do Transformers Really Perform Badly for Graph Representation?
  • How Does Label Noise Gradient Descent Improve Generalization in the Low SNR Regime? cites Language Models are Few-Shot Learners
  • Do Transformers Really Perform Badly for Graph Representation? cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
  • Do Transformers Really Perform Badly for Graph Representation? cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Do Transformers Really Perform Badly for Graph Representation? cites Language Models are Few-Shot Learners
  • A Theoretical Analysis of Mamba’s Training Dynamics: Filtering Relevant Features for Generalization in State Space Models cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • A Theoretical Analysis of Mamba’s Training Dynamics: Filtering Relevant Features for Generalization in State Space Models cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers11

  1. Enhancing Graph Transformers with Hierarchical Distance Structural EncodingYuankai Luo, Hongkang Li, Lei Shi, Xiao-Ming WuNeurIPS 2024 · 26 citations
  2. How Does Label Noise Gradient Descent Improve Generalization in the Low SNR Regime?Wei Huang, Andi Han, Yujin Song, Yilan Chen et al.NeurIPS 2025 · 4 citations
  3. A Theoretical Analysis of Mamba’s Training Dynamics: Filtering Relevant Features for Generalization in State Space ModelsMugunthan Shandirasegaran, Hongkang Li, Songyang Zhang, Meng Wang et al.ICLR 2026 · 3 citations
  4. Generalizable Insights for Graph Transformers in Theory and PracticeTimo Stoll, Luis Müller, Christopher MorrisNeurIPS 2025 · 2 citations
  5. Invariant Graph Transformer for Out-of-Distribution GeneralizationTianyin Liao, Ziwei Zhang, Yufei Sun, Chunyu Hu et al.KDD 2026 · 2 citations

Builds on42

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  3. Open Graph Benchmark: Datasets for Machine Learning on GraphsWeihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong et al.NeurIPS 2020 · 3,935 citations
  4. Do Transformers Really Perform Badly for Graph Representation?Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng et al.NeurIPS 2021 · 1,632 citations
  5. Geom-GCN: Geometric Graph Convolutional NetworksHongbin Pei, Bingzhe Wei, Kevin Chen-Chuan Chang, Yu Lei et al.ICLR 2020 · 1,445 citations

Related papers

  1. Generalization Guarantee of Training Graph Convolutional Networks with Graph Topology SamplingHongkang Li, Meng Wang, Sijia Liu, Pin-Yu Chen et al.ICML 2022 · 34 citations
  2. Recipe for a General, Powerful, Scalable Graph TransformerLadislav Rampásek, Michael Galkin, Vijay Prakash Dwivedi, Anh Tuan Luu et al.NeurIPS 2022 · 1,216 citations
  3. VecFormer: Towards Efficient and Generalizable Graph Transformer with Graph Token AttentionJingbo Zhou, Jun Xia, Siyuan Li, Yunfan Liu et al.WWW 2026
  4. Are More Layers Beneficial to Graph Transformers?Haiteng Zhao, Shuming Ma, Dongdong Zhang, Zhi-Hong Deng et al.ICLR 2023 · 5 citations
  5. Graph Positional and Structural EncoderSemih Cantürk, Renming Liu, Olivier Lapointe-Gagné, Vincent Létourneau et al.ICML 2024 · 33 citations
Dusk over the sea between two cliffs drawn in fine vertical lines