VecFormer: Towards Efficient and Generalizable Graph Transformer with Graph Token Attention
Abstract
Graph Transformer has demonstrated impressive capabilities in the field of graph representation learning. However, existing approaches face two critical challenges: (1) most models suffer from exponentially increasing computational complexity, making it difficult to scale to large graphs; (2) attention mechanisms based on node-level operations limit the flexibility of the model and result in poor generalization performance in out-of-distribution (OOD) scenarios. To address these issues, we propose VecFormer (the Vector Quantized Graph Transformer), an efficient and highly generalizable model for node classification, particularly under OOD settings. VecFormer adopts a two-stage training paradigm. In the first stage, two codebooks are used to reconstruct the node features and the graph structure, aiming to learn the rich semantic Graph Codes. In the second stage, attention mechanisms are performed at the Graph Token level based on the transformed cross codebook, reducing computational complexity while enhancing the model's generalization capability. Extensive experiments on datasets of various sizes demonstrate that VecFormer outperforms the existing Graph Transformer in both performance and speed.
Benchmark Results
Tested on 4 datasets 23 baseline values reported too low
Tables show presented results in global context (best 3 papers + GCN + MLP).
Classic
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | LGTL | 0.9518
±0.0011 | |
| 2 | MixHop (LO) | 0.9513
±0.0038 | |
| 3 | GraphSAGE (LO) | 0.9511
±0.0036 | |
| 7 | NodeFormer | 0.9490
±0.0019 best reported | |
| 18 | GCN | 0.9296
±0.0015 best reported | |
| 20 | GAT | 0.9233
±0.0018 best reported | |
| 53 | Polynormer | 0.9044
±0.0021 | This paper |
| 56 | SGFormer | 0.9037
±0.0020 | |
| 91 | NAGphormer | 0.8939
±0.0013 best reported | best at pub: NTFormer: A Composite Node Tokenized Graph Transformer for Node Classification (2024) |
| 99 | GOAT | 0.8915
±0.0039 | This paper |
| 105 | Exphormer | 0.8906
±0.0024 | prev best: Diffusion on Graph: Augmentation of Graph Structure for Node Classification (TMLR 2025) |
| 106 | VQGraph | 0.8905
±0.0032 | prev best: Node Identifiers: Compact, Discrete Representations for Efficient Graph Learning (ICLR 2024) |
| 116 | SAGE | 0.8881
±0.0015 best reported | best at pub: Efficient Text-Attributed Graph Learning through Selective Annotation and Graph Alignment (TMLR 2025) |
| 125 | GraphSAGE | 0.8864
±0.0030 | |
| 172 | GraphGPS | 0.8772
±0.0030 | This paper |
| 210 | MLP | 0.8690
±0.0074 |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | GraphTARIF | 0.9703
±0.0019 | |
| 2 | GAT | 0.9669
±0.0014 best reported | |
| 3 | GAT+T | 0.9660
±0.0007 | |
| 4 | Polynormer | 0.9657
±0.0023 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) |
| 7 | SAGE | 0.9403
±0.0069 | prev best: Training MLPs on Graphs without Supervision (2024) best today: Graph Transductive Sharpening: Leveraging Unlabeled Predictions in Node Classification (2026) Improvement within reported uncertainty; not highlighted. |
| 8 | GCN | 0.9632
±0.0008 best reported | |
| 11 | NAGphormer | 0.9614
±0.0016 best reported | best at pub: NTFormer: A Composite Node Tokenized Graph Transformer for Node Classification (2024) best today: Graph Transductive Sharpening: Leveraging Unlabeled Predictions in Node Classification (2026) Difference within reported uncertainty; not counted as underperformance. |
| 16 | VecFormer | 0.9584
±0.0041 | This paper |
| 23 | Exphormer | 0.9569
±0.0039 best reported | best at pub: Even Sparser Graph Transformers (NeurIPS 2024) |
| 29 | SGFormer | 0.9481
±0.0043 | prev best: GrokFormer: Graph Fourier Kolmogorov-Arnold Transformers (ICML 2024) best today: Graph Transductive Sharpening: Leveraging Unlabeled Predictions in Node Classification (2026) Improvement within reported uncertainty; not highlighted. |
| 44 | NodeFormer | 0.9527
±0.0022 best reported | best at pub: SignGT: Signed Attention-based Graph Transformer for Graph Representation Learning (2023) best today: GrokFormer: Graph Fourier Kolmogorov-Arnold Transformers (ICML 2024) Difference within reported uncertainty; not counted as underperformance. |
| 56 | GraphSAGE | 0.9508
±0.0026 | |
| 57 | GraphGPS | 0.9506
±0.0013 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) best today: Can TabPFN Compete with GNNs for Node Classification via Graph Tabularization? (LoG 2025) Difference within reported uncertainty; not counted as underperformance. |
| 86 | GOAT | 0.9433
±0.0021 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) |
| 107 | VQGraph | 0.9390
±0.0030 best reported | best at pub: Training MLPs on Graphs without Supervision (2024) |
| 390 | MLP | 0.9128
±0.0063 |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | GraphTARIF | 0.9461
±0.0017 | |
| 2 | GCN | 0.9412
±0.0008 best reported | best at pub: Diss-l-ECT: Dissecting Graph Data with local Euler Characteristic Transforms (ICML 2024) |
| 3 | GAT | 0.9398
±0.0022 best reported | best at pub: Diss-l-ECT: Dissecting Graph Data with local Euler Characteristic Transforms (ICML 2024) |
| 6 | Polynormer | 0.9378
±0.0010 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) |
| 8 | SAGE | 0.9351
±0.0006 best reported | best at pub: Automatic Graph Topology-Aware Transformer (2024) |
| 16 | VecFormer | 0.9251
±0.0054 | This paper |
| 18 | SGFormer | 0.9075
±0.0034 | |
| 20 | GOAT | 0.9229
±0.0037 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) |
| 33 | Exphormer | 0.9180
±0.0035 best reported | best at pub: Revisiting the Necessity of Graph Learning and Common Graph Benchmarks (2024) |
| 34 | GraphGPS | 0.9179
±0.0063 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) |
| 38 | NAGphormer | 0.9169
±0.0030 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) |
| 46 | GraphSAGE | 0.9120
±0.0029 | |
| 48 | NodeFormer | 0.9112
±0.0043 best reported | |
| 237 | VQGraph | 0.8750
±0.0070 best reported | best at pub: Training MLPs on Graphs without Supervision (2024) |
| 320 | MLP | 0.8463 |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | GrokFormer | 0.9831
±0.0018 | |
| 2 | PolyFormer | 0.9808
±0.0027 | |
| 3 | SGFormer | 0.9796
±0.0081 best reported | best at pub: GrokFormer: Graph Fourier Kolmogorov-Arnold Transformers (ICML 2024) |
| 5 | NAGphormer | 0.9785
±0.0026 best reported | best at pub: GrokFormer: Graph Fourier Kolmogorov-Arnold Transformers (ICML 2024) |
| 6 | GAT | 0.9782
±0.0028 best reported | best at pub: GrokFormer: Graph Fourier Kolmogorov-Arnold Transformers (ICML 2024) |
| 9 | GCN | 0.9774
±0.0035 best reported | best at pub: GrokFormer: Graph Fourier Kolmogorov-Arnold Transformers (ICML 2024) |
| 13 | GraphGPS | 0.9760
±0.0005 best reported | best at pub: GrokFormer: Graph Fourier Kolmogorov-Arnold Transformers (ICML 2024) |
| 17 | SAGE | 0.9739
±0.0018 best reported | best at pub: Clarify Confused Nodes via Separated Learning (2023) |
| 26 | Polynormer | 0.9722
±0.0006 best reported | best at pub: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) |
| 27 | Exphormer | 0.9720
±0.0010 best reported | best at pub: Revisiting the Necessity of Graph Learning and Common Graph Benchmarks (2024) |
| 28 | VecFormer | 0.9717
±0.0024 | This paper |
| 34 | NodeFormer | 0.9680
±0.0063 | prev best: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) Improvement within reported uncertainty; not highlighted. |
| 43 | GraphSAGE | 0.9649
±0.0006 | |
| 44 | GOAT | 0.9627
±0.0030 | prev best: Polynormer: Polynomial-Expressive Graph Transformer in Linear Time (ICLR 2024) Improvement within reported uncertainty; not highlighted. |
| 45 | VQGraph | 0.9646
±0.0020 | This paper |
| 58 | MLP | 0.9597
±0.0007 |
