Representing Long-Range Context for Graph Neural Networks with Global Attention
Abstract
Graph neural networks are powerful architectures for structured datasets. However, current methods struggle to represent long-range dependencies. Scaling the depth or width of GNNs is insufficient to broaden receptive fields as larger GNNs encounter optimization instabilities such as vanishing gradients and representation oversmoothing, while pooling-based approaches have yet to become as universally useful as in computer vision. In this work, we propose the use of Transformer-based self-attention to learn long-range pairwise relationships, with a novel ``readout'' mechanism to obtain a global graph embedding. Inspired by recent computer vision results that find position-invariant attention performant in learning long-range relationships, our method, which we call GraphTrans, applies a permutation-invariant Transformer module after a standard GNN module. This simple architecture leads to state-of-the-art results on several graph classification tasks, outperforming methods that explicitly encode graph structure. Our results suggest that purely-learning-based approaches without graph structure may be suitable for learning high-level, long-range relationships on graphs. Code for GraphTrans is available at.
Benchmark Results
Tested on 2 datasets
Tables show presented results in global context (best 3 papers + GCN + MLP).
TU Dortmund
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | WL-MLP | 0.9954 | |
| 2 | GIN | 0.9934 | |
| 3 | GCN | 0.9727 | |
| 131 | GraphSAGE | 0.8200
±0.0100 | |
| 151 | alon_bottleneck_2021 | 0.8150
±0.0120 | This paper |
| 224 | Errica2020A | 0.8000
±0.0140 | This paper |
| 415 | SortPool | 0.7496
±0.0134 best reported | best at pub: CogDL: A Comprehensive Library for Graph Deep Learning (WWW 2021) best today: Graph Structure Prompt Learning: A Novel Methodology to Improve Performance of Graph Neural Networks (2024) Difference within reported uncertainty; not counted as underperformance. |
| 435 | SAGPool_g | 0.7420
±0.0120 | This paper |
| 463 | Set2Set | 0.7170
±0.0073 best reported | best at pub: Graph Convolutional Networks with EigenPooling (KDD 2019) |
| 509 | SAGPool_h | 0.6755
±0.0103 best reported | best today: SignGT: Signed Attention-based Graph Transformer for Graph Representation Learning (2023) Difference within reported uncertainty; not counted as underperformance. |
OGB
| # | Model | F1 ↑ | Paper |
|---|---|---|---|
| 1 | GMN | 0.2060
±0.0020 | |
| 2 | DirGraphSSM | 0.2050
±0.0023 | |
| 3 | Graph-Mamba | 0.2030
±0.0023 | |
| 21 | GraphTrans | 0.1830
±0.0024 | This paper |
| 23 | DAGNN (SOTA) | 0.1751
±0.0049 | This paper |
| 27 | Transformer | 0.1670
±0.0015 | This paper |
| 30 | GCN-virtual | 0.1595
±0.0018 | This paper |
| 31 | GIN-virtual | 0.1581
±0.0020 | This paper |
| 32 | PNA | 0.1570
±0.0032 | This paper |
| 35 | GCN | 0.1510
±0.0020 best reported | best today: State Space Models over Directed Graphs (2025) Difference within reported uncertainty; not counted as underperformance. |
| 37 | GIN | 0.1495
±0.0023 | This paper |
