Abstract
SGFormer challenges the conventional "deeper is better" paradigm in Graph Transformers (GTs) by demonstrating that multi-layer attention can be mathematically reduced to a single, highly efficient layer. By integrating a linear-complexity global attention mechanism with a shallow Local Graph Network, SGFormer achieves state-of-the-art performance on web-scale graphs—up to 100 million nodes—while providing 20x to 140x speedups over traditional deep architectures.
Introduction
While Transformers have transformed NLP and Computer Vision, their application to large-scale graphs faces two significant hurdles: quadratic complexity and architectural redundancy. Standard attention mechanisms scale at $O(N^2)$, making them impractical for graphs with millions of nodes. Furthermore, most current GTs stack deep layers of attention, mirroring LLM designs, which often leads to overfitting and high computational overhead in node-level tasks without clear gains in expressiveness. SGFormer addresses these issues by asking whether deep stacking is necessary, proposing a simplified, "flat" architecture instead.
Methodology
SGFormer is built on two primary pillars: a theoretical reduction of layers and a hybrid single-layer architecture.
Theoretical Reduction
Through the lens of graph signal denoising, the authors demonstrate that message-passing layers in GNNs and Transformers act as gradient descent steps minimizing a specific energy function. The "Reduction Theorem" proves that a $K$-layer model can be compressed into a single-layer hybrid model that yields nearly identical node embeddings. This perspective treats multi-layer models as optimization trajectories, where a single "steepest descent" step on a fixed objective can often reach a comparable result more efficiently.
The SGFormer Architecture
Instead of a deep stack, SGFormer utilizes a single-layer hybrid backbone consisting of:
- Simple Global Attention (AN): To bypass the $O(N^2)$ bottleneck, SGFormer employs a linear attention trick. By reordering matrix multiplications—computing $Q(K^\top V)$ instead of $(QK^\top)V$—it achieves $O(N)$ complexity. This method is approximation-free, considering all-pair interactions without the need for sampling or random features.
- Local Graph Network (GN): A shallow GCN (1-3 layers) runs in parallel to capture the inductive bias of the graph's local structure.
The final representation is a weighted sum of the global and local outputs, balancing observed graph structure with unobserved potential interactions.
Experimental Results
SGFormer was evaluated across 12 real-world datasets, ranging from medium-sized citation networks to the web-scale OGBN-Papers100M, which contains over 111 million nodes and 1.6 billion edges.
Performance and Scalability
SGFormer is the first Transformer-style model to scale to OGBN-Papers100M on a single 24GB GPU, achieving a testing accuracy of 66.0. It consistently outperformed standard GNNs and state-of-the-art GTs like GraphGPS and DIFFormer, particularly on heterophilic datasets where global context is vital.
Efficiency Gains
The model offers massive speedups: on Cora, it is 38x faster to train and 141x faster for inference than Graphormer. Compared to NodeFormer, it provides a 20x-30x speedup. Its simplicity also leads to greater training stability and data efficiency, showing resilience even when labeled data is scarce (e.g., training on only 1% of nodes).
Conclusion
SGFormer demonstrates that a "flat" architecture can match or exceed the performance of deep Graph Transformers while being orders of magnitude faster. By reducing complexity without sacrificing expressiveness, it opens the door for Transformer-based models to handle truly massive graph data. Future work includes incorporating structural features like Laplacian eigenvectors and extending this simplified philosophy to other domains like combinatorial optimization.
Summary updated