GraphFM: A generalist graph transformer that learns transferable representations across diverse domains
Abstract
Graph neural networks (GNNs) are often trained on individual datasets, requiring specialized models and significant hyperparameter tuning due to the unique structures and features of each dataset. This approach limits the scalability and generalizability of GNNs, as models must be tailored for each specific graph type. To address these challenges, we introduce GraphFM, a scalable multi-graph pretraining approach designed for learning across diverse graph datasets. GraphFM uses a Perceiver-based encoder with learned latent tokens to compress domain-specific features into a shared latent space, enabling generalization across graph domains. We propose new techniques for scaling up graph training on datasets of different sizes, allowing us to train GraphFM on 152 distinct graph datasets, containing a total of 7.4 million nodes and 189 million edges. This allows us to study the effect of scale on pretraining across domains such as molecules, citation networks, and product graphs, and show that training on diverse datasets improves performance over single-source pretraining. Additionally, pretraining with a mixture of synthetic and real graphs enhances adaptability and stability, leading to competitive performance with state-of-the-art models across various node classification tasks. This approach reduces the burden of dataset-specific training and provides a single generalist model capable of performing across multiple diverse graph structures and tasks. Code is available at https://github.com/nerdslab/GraphFM.
Benchmark Results
Tested on 10 datasets 3 baseline values reported too low
Tables show presented results in global context (best 3 papers + GCN + MLP).
Classic
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | GraphTARIF | 0.9703
±0.0019 | |
| 2 | GAT | 0.9669
±0.0014 | |
| 3 | GAT+T | 0.9660
±0.0007 | |
| 7 | SAGE | 0.9643
±0.0027 | |
| 81 | GraphFM-NFT | 0.9437
±0.0035 | This paper |
| 220 | GraphFM-MFT | 0.9301
±0.0182 | This paper |
| 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: Clarify Confused Nodes via Separated Learning (2023) |
| 3 | GAT | 0.9398
±0.0022 best reported | |
| 8 | SAGE | 0.9351
±0.0006 | |
| 45 | NAG | 0.9122
±0.0014 | This paper |
| 99 | GraphFM-NFT | 0.9007
±0.0021 | This paper |
| 107 | GraphFM-MFT | 0.8995
±0.0083 | This paper |
| 114 | H2GCN | 0.8986
±0.0022 best reported | best at pub: Clarify Confused Nodes via Separated Learning (2023) |
| 116 | SAN | 0.8983
±0.0016 | This paper |
| 320 | MLP | 0.8463 | prev best: Clarify Confused Nodes via Separated Learning (2023) Improvement within reported uncertainty; not highlighted. |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | GrokFormer | 0.9831
±0.0018 | |
| 2 | PolyFormer | 0.9808
±0.0027 | |
| 3 | SGFormer | 0.9796
±0.0081 | |
| 9 | GCN | 0.9774
±0.0035 | |
| 35 | GraphFM-NFT | 0.9677
±0.0012 | This paper |
| 38 | GraphFM-MFT | 0.9664
±0.0017 | This paper |
| 58 | MLP | 0.9597
±0.0007 |
TU Dortmund
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | MSH-GNN | 0.9910
±0.0030 | |
| 2 | ID-GNN+BEC | 0.9830
±0.0360 | |
| 3 | SupCosine | 0.9830
±0.0250 | |
| 33 | GraphFM | 0.9380
±0.0660 | This paper |
| 39 | GIN | 0.9330
±0.0290 | |
| 56 | SAT | 0.9260
±0.0430 best reported | best at pub: SignGT: Signed Attention-based Graph Transformer for Graph Representation Learning (2023) best today: Graph Classification via Reference Distribution Learning: Theory and Practice (NeurIPS 2024) Difference within reported uncertainty; not counted as underperformance. |
| 158 | GraphSAGE | 0.9040
±0.0780 best reported | best at pub: Asynchronous Neural Networks for Learning in Graphs (2022) |
| 224 | Graphormer | 0.8960
±0.0620 best reported | best at pub: Incorporating Heterophily into Graph Neural Networks for Graph Classification (2022) best today: Graph Classification via Reference Distribution Learning: Theory and Practice (NeurIPS 2024) |
| 403 | MLP | 0.8660
±0.0495 | |
| 504 | Specformer | 0.8370
±0.0800 | This paper |
| 596 | GT | 0.8079
±0.0098 best reported | best at pub: SignGT: Signed Attention-based Graph Transformer for Graph Representation Learning (2023) Difference within reported uncertainty; not counted as underperformance. |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | MSH-GNN | 0.9410
±0.0330 | |
| 2 | GRDL | 0.8260
±0.0120 | |
| 3 | GMN | 0.8225 | |
| 32 | GIN | 0.7880
±0.0410 | |
| 55 | SAT | 0.7770
±0.0320 best reported | best today: Graph Classification via Reference Distribution Learning: Theory and Practice (NeurIPS 2024) |
| 122 | GraphFM | 0.7640
±0.0370 | This paper |
| 128 | Graphormer | 0.7630
±0.0270 best reported | best today: Graph Classification via Reference Distribution Learning: Theory and Practice (NeurIPS 2024) |
| 149 | MLP | 0.7600
±0.0320 | |
| 155 | GraphSAGE | 0.7590
±0.0320 best reported | best at pub: On Structural Expressive Power of Graph Transformers (KDD 2023) best today: Simplifying Graph Convolutional Networks with Redundancy-Free Neighbors (2025) Difference within reported uncertainty; not counted as underperformance. |
| 409 | Specformer | 0.7200
±0.0490 | This paper |
| 469 | GT | 0.6840
±0.0330 | This paper |
Heterophilic Graphs
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | P^2GNN | 0.9672
±0.0147 | |
| 2 | DoG | 0.9660
±0.0210 | |
| 3 | GPF-plus | 0.9583
±0.0419 | |
| 34 | MLP | 0.9230
±0.0070 | |
| 53 | GraphSAGE | 0.9000
±0.0365 | |
| 205 | GraphFM-NFT | 0.8216
±0.0324 | This paper |
| 232 | GraphFM-MFT | 0.8081
±0.0276 | This paper |
| 411 | NAG | 0.6837
±0.0527 | This paper |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | DiGGR | 0.4535
±0.0353 | |
| 2 | TRIGON | 0.4402
±0.0028 | |
| 3 | DoG | 0.4320
±0.0120 | |
| 42 | MLP | 0.4026
±0.0108 | |
| 68 | GraphSAGE | 0.3899
±0.0085 | |
| 89 | GraphFM-NFT | 0.3801
±0.0107 | This paper |
| 173 | GraphFM-MFT | 0.3629
±0.0063 | This paper |
| 256 | NAG | 0.3433
±0.0094 | This paper |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | Hetero-S (GAT 8-layer) | 0.8693 | |
| 2 | Dir-GNN+CNA | 0.8586
±0.0180 | |
| 3 | GAT | 0.8560 | |
| 52 | GCN | 0.7033 | |
| 142 | GraphFM-NFT | 0.5912
±0.0164 | This paper |
| 144 | GraphFM-MFT | 0.5864
±0.0124 | This paper |
| 155 | NAGphormer | 0.5739
±0.0002 | This paper |
| 162 | SAN | 0.5562
±0.0043 best reported | best at pub: Hierarchical Graph Transformer with Adaptive Node Sampling (NeurIPS 2022) |
| 169 | MLP | 0.5429 |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | IBG-NN | 0.7763
±0.0179 | |
| 2 | Dir-GNN+CNA | 0.7747
±0.0128 | |
| 3 | DHGNN | 0.7684
±0.0161 | |
| 46 | GCN | 0.6067 | |
| 91 | NAG | 0.4993
±0.0007 | This paper |
| 92 | NAGphormer | 0.4993
±0.0007 | This paper |
| 133 | GraphFM-NFT | 0.4298
±0.0162 | This paper |
| 135 | GraphFM-MFT | 0.4280
±0.0154 | This paper |
| 166 | SAN | 0.3992
±0.0214 | This paper |
| 172 | MLP | 0.3930
±0.0079 |
| # | Model | Accuracy ↑ | Paper |
|---|---|---|---|
| 1 | DMD++ | 0.9190
±0.0260 | |
| 2 | F-GREAD-BS | 0.9059
±0.0380 | |
| 3 | APPNP | 0.9010
±0.0350 | |
| 37 | MLP | 0.8629
±0.0450 | |
| 59 | GraphFM-NFT | 0.8362
±0.0321 | This paper |
| 62 | GraphFM-MFT | 0.8313
±0.0235 | This paper |
| 63 | GCN | 0.8310
±0.0320 | |
| 137 | NAG | 0.6823
±0.0599 | This paper |
