Hierarchical Transformer for Scalable Graph Learning

Wenhao Zhu, Tianyu Wen, Guojie Song, Xiaojun Ma, Liang Wang

Introduction

Graph Transformers have emerged as a powerful alternative to traditional Graph Neural Networks (GNNs), effectively mitigating issues like over-smoothing through global self-attention. However, the $O(N^2)$ computational complexity of standard self-attention makes them difficult to scale to massive graphs. While subgraph sampling is a common workaround, it often forces a trade-off between local precision and global context. This paper introduces the Hierarchical Scalable Graph Transformer (HSGT), an architecture designed to capture multi-scale structural information efficiently, enabling Transformer-level performance on graphs with millions of nodes.

The HSGT Architecture

HSGT addresses the scalability bottleneck by constructing a hierarchy of progressively coarser graphs. This structure allows the model to route information across long distances through "virtual nodes" that represent condensed graph partitions.

Overview of the HSGT architecture, illustrating the hierarchical graph coarsening, horizontal/vertical blocks, and the multi-scale node embedding fusion.

The framework consists of several key stages:

  1. Graph Coarsening: Using the METIS algorithm, the input graph is partitioned into clusters, forming a hierarchy ($G^0, G^1, \dots, G^H$).
  2. Horizontal Blocks: These layers apply structural-enhanced self-attention within each level of the hierarchy. Shortest Path Distance (SPD) is used to bias attention, ensuring local structural integrity.
  3. Vertical Blocks: Instead of simple pooling, HSGT employs an attention-based aggregation to pass information from lower-level nodes to their corresponding higher-level virtual nodes.
  4. Readout and Fusion: A final readout layer aggregates embeddings from all hierarchical levels, producing a comprehensive node representation that incorporates both local details and global topology.

Scalability via Historical Embeddings

To manage the "neighbor explosion" problem during mini-batch training, HSGT leverages historical embeddings. By caching representations of high-level nodes from previous training steps, the model can access global context without needing to expand the active computational graph for every batch. This allows HSGT to maintain a global receptive field with memory costs comparable to standard scalable GNNs like GraphSAGE.

Experimental Results

The authors evaluated HSGT on nine benchmarks, ranging from small citation networks to the massive ogbn-products dataset (2.4M nodes, 61M edges).

Performance comparison of HSGT against state-of-the-art GNNs and Graph Transformers across various small and large-scale datasets.

HSGT consistently outperformed existing scalable GNNs and sampled Graph Transformers. On ogbn-products, HSGT achieved a state-of-the-art accuracy of 81.15%, significantly higher than GraphSAGE (78.50%) and Graphormer-SAMPLE (79.10%). Notably, this performance gain comes with high efficiency; on the same dataset, HSGT required only ~1.9GB of peak GPU memory, making it accessible for standard hardware.

Conclusion

HSGT demonstrates that hierarchical coarsening combined with historical embeddings is a highly effective strategy for scaling Graph Transformers. By providing a structured "information highway" through virtual nodes, the model captures global context without the quadratic overhead of global attention. Future work may explore extending this multi-scale approach to dynamic graphs or graph-level prediction tasks.

Summary updated

BibTeX
@inproceedings{zhu2023hierarchical,
  author = {Wenhao Zhu and Tianyu Wen and Guojie Song and Xiaojun Ma and Liang Wang},
  title = {{Hierarchical Transformer for Scalable Graph Learning}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/523},
}
Figure