Rethinking Graph Transformer Architecture Design for Node Classification

Jiajun Zhou, Xuanze Chen, Chenxuan Xie, Shanqing Yu, Qi Xuan, Xiaoniu YangarXiv 2024 · DOI

Introduction

Graph Transformers (GTs) have emerged as a powerful alternative to traditional Graph Neural Networks (GNNs), specifically designed to mitigate issues like over-squashing and the limited receptive fields of message-passing layers. By employing Multi-Head Attention (MHA), GTs allow every node to attend to every other node, theoretically capturing long-range dependencies across the entire graph.

However, recent research suggests that for the specific task of node classification, this global attention mechanism may be more of a hindrance than a help. The authors of this study argue that MHA often introduces "global noise" by incorporating information from distant, irrelevant nodes. Furthermore, the $O(N^2)$ computational complexity of self-attention makes vanilla GTs impractical for large-scale real-world graphs. This paper investigates which components of the Transformer architecture are truly essential for graph learning and proposes a more efficient, graph-aware alternative: GNNFormer.

The GNNFormer Architecture

The core innovation of GNNFormer is the replacement of the standard MHA-based block with a modular design that decouples feature transformation from structural propagation.

Comparison of the Vanilla GT block with the proposed GNNFormer architecture, highlighting the decoupled Propagation (P) and Transformation (T) blocks.

Decoupled PT-Blocks

Instead of a monolithic attention layer, GNNFormer utilizes stackable blocks consisting of Propagation (P) and Transformation (T) operations.

  • Propagation (P): Responsible for moving information between neighboring nodes (e.g., using GCN or GAT-like operators).
  • Transformation (T): Applies non-linear feature updates to individual node representations.

By experimenting with different sequences—such as PTPT, PPTT, and TPTP—the researchers found that the order of these operations significantly impacts performance.

Advanced Components

Beyond the PT-blocks, GNNFormer incorporates several architectural refinements:

  1. SwishGLU Activation: The standard ReLU-based Feed-Forward Network (FFN) is replaced with a SwishGLU-based FFN. This combination of the smooth Swish activation and Gated Linear Units (GLUs) allows for more selective and expressive feature propagation.
  2. Adaptive Initial Residual Connections (AIRes): To combat over-smoothing—a common failure mode in deep GNNs where node features become indistinguishable—GNNFormer uses a learnable parameter to balance initial input features with the representations learned at each layer.

Experimental Evaluation

The model was rigorously tested on 12 benchmark datasets, categorized by their level of homophily (the tendency of similar nodes to be connected):

  • Homophilous: Computers, Photo, Coauthor CS, Coauthor Physics, Wiki-CS, and Facebook.
  • Heterophilous: Actor, Chameleon-fix, Squirrel-fix, Tolokers, Roman-empire, and Penn94.

Notably, the inclusion of large-scale graphs like Penn94 (over 40,000 nodes) served as a stress test for scalability, where many traditional GTs fail due to memory constraints.

Key Results and Insights

The experimental results demonstrate that GNNFormer consistently outperforms or matches state-of-the-art GNNs and GTs across diverse graph topologies.

Performance comparison of different GNNFormer variants (PPTT, TTPP, PTPT, TPTP) against Vanilla GT and GAT across homophilous and heterophilous datasets.

The Role of Attention vs. FFN

One of the most significant findings is that the MHA module—often considered the defining feature of Transformers—is not strictly necessary for high-performance node classification. Removing MHA and replacing it with localized message passing often improves accuracy by filtering out irrelevant global noise. Conversely, the Feed-Forward Network (FFN) was found to be a critical component; GNNs that include a Transformer-style FFN consistently outperform those that do not.

Sequence Optimization

The researchers observed that "Transformation-first" sequences (like TPTP or TTPP) generally provide more robust performance. By applying non-linear transformations before propagation, the model can align features into a unified space, making the subsequent message passing more effective.

Scalability and Stability

GNNFormer effectively bypasses the quadratic complexity bottleneck of vanilla GTs. On the Penn94 dataset, while several GT variants encountered Out-of-Memory (OOM) errors, GNNFormer maintained stable runtime and memory usage. Furthermore, the AIRes connections ensured that performance did not degrade as the model depth increased, providing immunity to the over-smoothing problem.

Conclusion

GNNFormer represents a paradigm shift in graph architecture design, moving away from the blind adoption of NLP-centric self-attention. By focusing on decoupled propagation and transformation, and leveraging the power of the FFN, GNNFormer achieves superior accuracy and scalability. Future work will explore Automated Architecture Search (NAS) to dynamically determine the optimal P/T sequence for any given graph structure.

Summary updated

BibTeX
@misc{zhou2024rethinking,
  author = {Jiajun Zhou and Xuanze Chen and Chenxuan Xie and Shanqing Yu and Qi Xuan and Xiaoniu Yang},
  title = {{Rethinking Graph Transformer Architecture Design for Node Classification}},
  year = {2024},
  eprint = {2410.11189},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.11189},
}
Figure