Recipe for a General, Powerful, Scalable Graph Transformer
Abstract
We propose a recipe on how to build a general, powerful, scalable (GPS) graph Transformer with linear complexity and state-of-the-art results on a diverse set of benchmarks. Graph Transformers (GTs) have gained popularity in the field of graph representation learning with a variety of recent publications but they lack a common foundation about what constitutes a good positional or structural encoding, and what differentiates them. In this paper, we summarize the different types of encodings with a clearer definition and categorize them as being local, global or relative. The prior GTs are constrained to small graphs with a few hundred nodes, here we propose the first architecture with a complexity linear in the number of nodes and edges $O(N+E)$ by decoupling the local real-edge aggregation from the fully-connected Transformer. We argue that this decoupling does not negatively affect the expressivity, with our architecture being a universal function approximator on graphs. Our GPS recipe consists of choosing 3 main ingredients: (i) positional/structural encoding, (ii) local message-passing mechanism, and (iii) global attention mechanism. We provide a modular framework GraphGPS is available at:. that supports multiple types of encodings and that provides efficiency and scalability both in small and large graphs. We test our architecture on 16 benchmarks and show highly competitive results in all of them, show-casing the empirical benefits gained by the modularity and the combination of different strategies.
Benchmark Results
Tested on 7 datasets 3 baseline values reported too low
Tables show presented results in global context (best 3 papers + GCN + MLP).
OGB
| # | Model | MAE ↓ | Paper |
|---|---|---|---|
| 1 | DeMol | 0.0603 | |
| 2 | TGT-At | 0.0671 | |
| 3 | TGT-At (+RDKit) | 0.0683 | |
| 24 | GTs | 0.0858 | This paper |
| 29 | EGT | 0.0862 best reported | |
| 31 | Graphormer | 0.0864 | prev best: GRPE: Relative Positional Encoding for Graph Transformer (2022) |
| 35 | GRPE | 0.0876 best reported | |
| 50 | GPS-small | 0.0938 | This paper |
| 59 | GIN-virtual | 0.1083 | This paper |
| 61 | GCN-virtual | 0.1152 best reported | |
| 65 | GCN | 0.1379 | prev best: GRPE: Relative Positional Encoding for Graph Transformer (2022) best today: Enhancing Graph Neural Networks with Quantum Computed Encodings (2023) |
| 64 | GIN | 0.1195 | prev best: GRPE: Relative Positional Encoding for Graph Transformer (2022) |
LRGB
| # | Model | MRR ↑ | Paper |
|---|---|---|---|
| 1 | FloydNet | 0.6143 | |
| 2 | Exphormer | 0.4737
±0.0024 | |
| 3 | Exphormer + LapPE | 0.4737
±0.0024 | |
| 5 | GPS | 0.4703
±0.0014 best reported | best today: Learning Long Range Dependencies on Graphs via Random Walks (ICLR 2024) |
| 8 | GatedGCN | 0.4670
±0.0004 best reported | best today: Benchmarking Positional Encodings for GNNs and Graph Transformers (KDD 2024) |
| 15 | GINE | 0.4617
±0.0005 best reported | best today: Benchmarking Positional Encodings for GNNs and Graph Transformers (KDD 2024) |
| 16 | GIN | 0.4617
±0.0005 | |
| 28 | GCN | 0.4526
±0.0006 best reported | best today: Benchmarking Positional Encodings for GNNs and Graph Transformers (KDD 2024) |
| 61 | SAN+LapPE | 0.3350
±0.0003 | This paper |
| 62 | SAN+RWSE | 0.3341
±0.0006 | This paper |
| 75 | GatedGCN+RWSE | 0.3242
±0.0008 | This paper |
| 80 | Transformer+LapPE | 0.3174
±0.0020 | This paper |
GNNBenchmark
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | Schrödinger | 0.9913
±0.0004 | |
| 2 | CNN | 0.9907
±0.0007 | |
| 3 | MPNN | 0.9895
±0.0006 | |
| 11 | GatedGCN | 0.9855
±0.0002 | |
| 32 | GIN | 0.9833
±0.0011 | |
| 47 | EGT | 0.9817
±0.0009 | This paper |
| 59 | GPS | 0.9808
±0.0011 best reported | Difference within reported uncertainty; not counted as underperformance. |
| 73 | CRaWl | 0.9794
±0.0005 | This paper |
| 75 | PNA | 0.9794
±0.0012 | This paper |
| 126 | MLP | 0.9534
±0.0014 | |
| 135 | GCN | 0.9405
±0.0005 best reported | best at pub: Formatting Instructions for ICLR 2021 Conference Submissions (2020) |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | RandAlign | 0.7942
±0.0007 | |
| 2 | differential encoding | 0.7907
±0.0027 | |
| 3 | PPGT | 0.7856
±0.0070 | |
| 38 | PNA | 0.7311
±0.0011 best reported | best at pub: From Stars to Subgraphs: Uplifting Any GNN with Local Structure Awareness (ICLR 2021) |
| 46 | GPS | 0.7236
±0.0032 best reported | Difference within reported uncertainty; not counted as underperformance. |
| 62 | GatedGCN | 0.7133
±0.0039 | |
| 80 | CRaWl | 0.6901
±0.0026 | This paper |
| 82 | EGT | 0.6870
±0.0041 | This paper |
| 92 | GraphSAGE | 0.6690
±0.0020 | |
| 124 | GCN | 0.5839
±0.0073 best reported | best at pub: From Stars to Subgraphs: Uplifting Any GNN with Local Structure Awareness (ICLR 2021) |
| 126 | MLP | 0.5634
±0.0018 |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | GRPE-Small | 0.8159
±0.0019 | |
| 2 | TANGO-GPS | 0.8011
±0.0014 | |
| 3 | GRIT | 0.8003
±0.0028 | |
| 22 | GPS | 0.7802
±0.0018 | This paper |
| 54 | GatedGCN | 0.7608
±0.0020 | |
| 70 | GCN | 0.6903
±0.0137 | |
| 114 | MLP | 0.2097
±0.0000 |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | DeepGraph (48) | 0.9066
±0.0006 | |
| 2 | GRIT (our run) | 0.9041
±0.0023 | |
| 3 | GRIT 2-QiQRW | 0.9016
±0.0045 | |
| 19 | GIN-AK+ | 0.8685
±0.0006 | This paper |
| 24 | EGT | 0.8682
±0.0002 | This paper |
| 50 | GPS | 0.8669
±0.0006 | This paper |
| 51 | DGN | 0.8668
±0.0003 | This paper |
| 58 | SAN | 0.8658
±0.0004 | This paper |
| 66 | GatedGCN | 0.8651
±0.0008 | |
| 88 | GCN | 0.8561
±0.0003 | |
| 123 | MLP | 0.5052 |
Other Graph Benchmarks
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | GMN | 0.9415
±0.0020 | |
| 2 | DirGraphSSM | 0.9409
±0.0023 | |
| 3 | DAG+SAT-plus | 0.9407
±0.0020 | |
| 7 | Transformer | 0.9350
±0.0060 | This paper |
| 13 | Performer | 0.9264 | This paper |
| 16 | BigBird | 0.9234 | This paper |
| 22 | GIN | 0.8898
±0.0055 |
