Introduction
Graph Transformers have emerged as powerful tools for graph machine learning, often surpassing traditional message-passing Graph Neural Networks (GNNs) by mitigating issues like over-smoothing. However, their reliance on global self-attention introduces a quadratic computational complexity ($O(N^2)$), making them impractical for large-scale graphs. While mini-batch sampling offers a path to scalability, it often restricts the Transformer's receptive field to local neighborhoods, stripping it of its primary advantage: the ability to capture global structural context.
This paper introduces the Hierarchical Scalable Graph Transformer (HSGT), a framework designed to bridge the gap between local efficiency and global context. By constructing a hierarchy of virtual nodes through graph coarsening, HSGT enables efficient long-range communication without the prohibitive cost of global attention.
The HSGT Framework
HSGT employs a "divide and summarize" strategy to manage large graphs. The process begins with an offline preprocessing step using the METIS algorithm to partition the graph into a multi-level hierarchy, where Level 0 is the original graph and subsequent levels represent increasingly coarsened versions.
The architecture consists of three primary components:
- Horizontal Blocks: These layers perform attention-based information exchange within a specific hierarchical level, utilizing Shortest Path Distance (SPD) biases to incorporate local structural information.
- Vertical Blocks: Instead of simple pooling, these blocks use attention mechanisms to aggregate node representations from lower levels into "virtual" nodes at higher levels. This allows the model to learn adaptive summaries of graph regions.
- Readout Blocks: To produce the final node embeddings, the model fuses representations from all levels of the hierarchy, ensuring that both fine-grained local details and broad global context are preserved.
To further enhance scalability, HSGT utilizes hierarchical sampling and historical embeddings. By caching high-level node embeddings from previous training iterations, the model avoids the "neighbor explosion" problem common in deep GNNs, allowing for inter-batch communication with minimal overhead.
Key Insights
- Efficiency through Hierarchy: Virtual nodes act as communication hubs. By passing information through a few high-level nodes, HSGT expands the receptive field significantly more efficiently than sampling thousands of distant neighbors.
- Attention-Driven Coarsening: The use of attention in vertical blocks is superior to traditional mean or sum pooling, as it allows the model to focus on the most relevant substructures during aggregation.
- Parameter Sharing: The authors observed that graph substructures often exhibit self-similarity across scales. Consequently, sharing parameters across horizontal blocks at different levels maintains a lightweight model without sacrificing accuracy.
Experimental Results
HSGT was evaluated on several benchmarks, including the massive ogbn-products dataset (2.4M nodes, 61.8M edges).
- Performance: HSGT achieved a state-of-the-art accuracy of 81.15% on
ogbn-products, significantly outperforming GraphSAGE (78.25%) and naively sampled Transformers like Graphormer-SAMPLE (64.76%). - Resource Efficiency: Despite its Transformer architecture, HSGT is remarkably efficient. On
ogbn-products, it required only 1903MB of peak GPU memory, making it competitive with lightweight GNNs while providing superior predictive power. - Ablation Study: Replacing METIS-based structural partitioning with random partitioning led to a sharp decline in performance (dropping to 75.23%), highlighting the importance of high-quality graph hierarchies.
Conclusion and Future Work
HSGT demonstrates that hierarchical structures are key to scaling Graph Transformers to massive datasets. While the current implementation relies on static offline preprocessing, it sets the stage for future research into end-to-end learnable coarsening mechanisms and adaptations for dynamic graphs where topology evolves over time.
Summary updated