Gophormer: Ego-Graph Transformer for Node Classification
Abstract
Transformers have achieved remarkable performance in a myriad of fields including natural language processing and computer vision. However, when it comes to the graph mining area, where graph neural network (GNN) has been the dominant paradigm, transformers haven't achieved competitive performance, especially on the node classification task. Existing graph transformer models typically adopt fully-connected attention mechanism on the whole input graph and thus suffer from severe scalability issues and are intractable to train in data insufficient cases. To alleviate these issues, we propose a novel Gophormer model which applies transformers on ego-graphs instead of full-graphs. Specifically, Node2Seq module is proposed to sample ego-graphs as the input of transformers, which alleviates the challenge of scalability and serves as an effective data augmentation technique to boost model performance. Moreover, different from the feature-based attention strategy in vanilla transformers, we propose a proximity-enhanced attention mechanism to capture the fine-grained structural bias. In order to handle the uncertainty introduced by the ego-graph sampling, we further propose a consistency regularization and a multi-sample inference strategy for stabilized training and testing, respectively. Extensive experiments on six benchmark datasets are conducted to demonstrate the superiority of Gophormer over existing graph transformers and popular GNNs, revealing the promising future of graph transformers.
Benchmark Results
Tested on 2 datasets 4 baseline values reported too low
Tables show presented results in global context (best 3 papers + GCN + MLP).
Classic
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | CNA | 0.9575
±0.0058 | |
| 2 | IS-GIB | 0.9390
±0.0187 | |
| 3 | EERM | 0.9112
±0.0145 | |
| 20 | APPNP | 0.8142
±0.0026 best reported | best at pub: Tackling Over-Smoothing for General Graph Convolutional Networks (2020) best today: Feature Expansion for Graph Neural Networks (ICML 2023) |
| 35 | GAT | 0.8013
±0.0062 | prev best: Tackling Over-Smoothing for General Graph Convolutional Networks (2020) |
| 44 | GCN | 0.7943
±0.0026 | prev best: Tackling Over-Smoothing for General Graph Convolutional Networks (2020) |
| 46 | Gophormer | 0.8023
±0.0009 | This paper |
| 61 | GraphSAGE | 0.7923
±0.0053 | prev best: Learned Low Precision Graph Neural Networks (2020) |
| 62 | JKNet | 0.7920 best reported | best at pub: Tackling Over-Smoothing for General Graph Convolutional Networks (2020) |
| 259 | SAGE | 0.7361
±0.0190 | |
| 350 | MLP | 0.7289
±0.0010 | |
| 582 | SAN | 0.7064
±0.0097 | This paper |
| 708 | GT-sparse | 0.6738
±0.0076 | This paper |
| 744 | Graphormer | 0.6621
±0.0083 | This paper |
| 839 | GT-full | 0.5875
±0.0106 | This paper |
Heterogeneous Graph Benchmarks
| # | Model | Micro-F1 ↑ | Paper |
|---|---|---|---|
| 1 | LMSPS | 0.9566
±0.0020 | |
| 2 | PSHGCN | 0.9561
±0.0012 | |
| 3 | RpHGNN | 0.9555
±0.0029 | |
| 21 | GCN | 0.9460
±0.0031 best reported | best at pub: Leveraging Meta-path Contexts for Classification in Heterogeneous Information Networks (2020) best today: Graph Neural Networks with a Distribution of Parametrized Graphs (ICML 2023) |
| 23 | GAT | 0.9448
±0.0022 best reported | best at pub: Heterogeneous Graph Benchmarks (KDD 2021) best today: Graph Neural Networks with a Distribution of Parametrized Graphs (ICML 2023) |
| 46 | GraphSAGE | 0.9306
±0.0047 best reported | best today: Efficient Heterogeneous Graph Learning via Random Projection (2023) |
| 88 | GIN | 0.8720 | |
| 104 | Gophormer | 0.8520
±0.0020 | This paper |
| 109 | JKNet | 0.8457
±0.0028 | This paper |
| 111 | APPNP | 0.8440
±0.0017 | This paper |
| 116 | SAN | 0.8311
±0.0032 | This paper |
| 127 | GT-sparse | 0.8104
±0.0027 | This paper |
| 128 | Graphormer | 0.8093
±0.0039 | This paper |
| 144 | GT-full | 0.7815
±0.0041 | This paper |
| 176 | MLP | 0.6447
±0.0136 |
