ICML 2024

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

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

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.

Proposed method: GT

Benchmark Results

Tested on 2 datasets SOTA at publication on 1 Non-standard metric on 1 dataset

Tables show presented results in global context (best 3 papers + GCN + MLP).

Heterophilic Graphs

#ModelAccuracy ↑Paper
1
DiGGR
0.4535 ±0.0353
2
TRIGON
0.4402 ±0.0028
3
DoG
0.4320 ±0.0120
42
MLP
0.4026 ±0.0108
45
GT
actual #45 vs paper #45
0.4010
actual #45 vs paper #45
paper 0.4010
paper 0.4010 Δ at pub 0.0216
46
ZLHL
0.4010
This paper
68
GraphSAGE
0.3899 ±0.0085

LRGB

PascalVOC-SP

Global leaderboard →
Non-default metric. This paper reports fraction of nodes satisfying $\Delta_n(z_m)>0$; the dataset default is F1. Values below use fraction of nodes satisfying $\Delta_n(z_m)>0$ only.
#Modelfraction of nodes satisfying $\Delta_n(z_m)>0$ ↑Paper
1
GT
0.9854
This paper
SOTA performance (not significantly different from the best) Proposed method (this paper) Baseline / comparison (this paper) Global context (other papers) Best at pub — reported value improved over the best known when published