Abstract
Graph Transformers (GTs) have emerged as a powerful alternative to traditional Graph Neural Networks (GNNs) by addressing the "neighborhood myopia" inherent in local message passing. However, the field has been characterized by fragmented implementations and inconsistent evaluation protocols. We introduce OpenGT, an open-source benchmark library that standardizes the evaluation of 16 state-of-the-art models. Our findings highlight that GTs significantly outperform GNNs on heterophilous graphs, though they face substantial bottlenecks related to positional encoding overhead and memory scalability.
Introduction
In graph machine learning, Graph Neural Networks (GNNs) have long been the standard. However, their reliance on local neighborhood aggregation limits their ability to capture long-range dependencies. Graph Transformers (GTs) utilize self-attention to enable global node interactions, but the lack of a unified framework has made it difficult to discern which architectural choices drive performance. OpenGT provides a reproducible environment to evaluate these models fairly across diverse datasets.
Taxonomy of Graph Transformers
The OpenGT library categorizes GT innovations into three primary areas: Positional Encodings (PE), Attention Mechanisms, and Graph Preprocessing. By re-implementing 16 representative models—including Graphormer, GraphGPS, and CoBFormer—within the modular torch_geometric.graphgym framework, we ensure that all models are evaluated under identical training pipelines.
Experimental Evaluation
We evaluated the models across 14 datasets, ranging from classic citation networks to complex molecular graphs and long-range benchmarks. These datasets vary significantly in scale and homophily, allowing for a robust assessment of model generalization.
Performance on Heterophilous Graphs
A key finding is that GTs excel on heterophilous graphs (e.g., Squirrel, Chameleon), where connected nodes often belong to different classes. Unlike GNNs, which are constrained by local neighborhoods, GTs can identify relevant global patterns. As shown in the benchmarking results, models like SpecFormer achieve substantial performance gains over vanilla GNNs in these scenarios.
The Efficiency-Effectiveness Trade-off
While complex Positional Encodings (PE) can enhance accuracy, they often incur a significant "preprocessing tax." For instance, calculating all-pairs shortest paths on larger graphs can take hours, exceeding the actual training time. Furthermore, "pure" global attention models frequently encounter Out-of-Memory (OOM) errors on large-scale datasets. Hybrid models that utilize graph partitioning or localized attention mechanisms, such as CoBFormer, offer a more scalable and efficient alternative.
Conclusion
OpenGT brings much-needed order to the evaluation of Graph Transformers. Our benchmark reveals that while GTs offer superior performance on specific graph types, significant challenges remain in scaling structural encodings and managing computational costs. OpenGT serves as a foundation for future research into more efficient and generalizable graph foundation models.
The code and benchmark results are publicly available at https://github.com/eaglelab-zju/OpenGT.
Summary updated