ICML 2022

Structure-Aware Transformer for Graph Representation Learning

Dexiong Chen, Leslie O’Bray, Karsten M. Borgwardt

Main figure for Structure-Aware Transformer for Graph Representation Learning

Abstract

The Transformer architecture has gained growing attention in graph representation learning recently, as it naturally overcomes several limitations of graph neural networks (GNNs) by avoiding their strict structural inductive biases and instead only encoding the graph structure via positional encoding. Here, we show that the node representations generated by the Transformer with positional encoding do not necessarily capture structural similarity between them. To address this issue, we propose the Structure-Aware Transformer, a class of simple and flexible graph Transformers built upon a new self-attention mechanism. This new self-attention incorporates structural information into the original self-attention by extracting a subgraph representation rooted at each node before computing the attention. We propose several methods for automatically generating the subgraph representation and show theoretically that the resulting representations are at least as expressive as the subgraph representations. Empirically, our method achieves state-of-the-art performance on five graph prediction benchmarks. Our structure-aware framework can leverage any existing GNN to extract the subgraph representation, and we show that it systematically improves performance relative to the base GNN model, successfully combining the advantages of GNNs and Transformers. Our code is available at https://github.com/BorgwardtLab/SAT.

Benchmark Results

Tested on 4 datasets

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

OGB

#ModelAccuracy ↑Paper
1
A-NLSF
0.8149 ±0.0067
2
differential encoding
0.8096 ±0.0029
3
MPNN + VN + NoPE
0.8055 ±0.0038
16
GatedGCN
0.7531 ±0.0083
20
k-subtree SAT-GCN
0.7522 ±0.0056
This paper
21
k-subtree SAT-PNA
0.7522 ±0.0056
This paper
22
k-subtree SAT-GIN
0.7306 ±0.0076
This paper
33
GIN
0.7037 ±0.0107
#ModelF1 ↑Paper
1
GMN
0.2060 ±0.0020
2
DirGraphSSM
0.2050 ±0.0023
3
Graph-Mamba
0.2030 ±0.0023
11
k-subtree SAT-PNA
0.1937 ±0.0028
This paper
13
k-subtree SAT-GCN
0.1934 ±0.0020
This paper
16
k-subtree SAT-GIN
0.1910 ±0.0023
This paper
35
GCN
0.1510 ±0.0020

GNNBenchmark

#ModelAccuracy ↑Paper
1
GRPE-Small
0.8159 ±0.0019
2
TANGO-GPS
0.8011 ±0.0014
3
GRIT
0.8003 ±0.0028
24
K-Subtree SAT
actual #24 vs paper #27 3 places worse
0.7786 ±0.0010
best reported
actual #24 vs paper #27 3 places worse
paper 0.7775 ±0.0012

Difference within reported uncertainty; not counted as underperformance.

paper 0.7775 ±0.0012 Δ today 0.0010
23
K-Subgraph SAT
0.7786 ±0.0010
This paper
54
GatedGCN
0.7608 ±0.0020
70
GCN
0.6903 ±0.0137
72
Base GNN
0.6850 ±0.0098
This paper
114
MLP
0.2097 ±0.0000
#ModelAccuracy ↑Paper
1
DeepGraph (48)
0.9066 ±0.0006
2
GRIT (our run)
0.9041 ±0.0023
3
GRIT 2-QiQRW
0.9016 ±0.0045
17
K-Subtree SAT
0.8687 ±0.0004
This paper
21
K-Subgraph SAT
0.8685 ±0.0004
This paper
61
Base GNN
0.8657 ±0.0008
This paper
66
GatedGCN
0.8651 ±0.0008
88
GCN
0.8561 ±0.0003
123
MLP
0.5052
SOTA performance (not significantly different from the best) Baseline / comparison (this paper) Global context (other papers)