SGFormer: Single-Layer Graph Transformers with Approximation-Free Linear Complexity

Qitian Wu, Kai Yang, Hengrui Zhang, David Wipf, Junchi Yan
9/13/2024
cs.LGcs.AI

No official code found. Best implementation: qitianwu/SGFormer (280 stars, MIT, last commit 2025-11-13).

Abstract

Learning representations on large graphs is a long-standing challenge due to the inter-dependence nature. Transformers recently have shown promising performance on small graphs thanks to its global attention for capturing all-pair interactions beyond observed structures. Existing approaches tend to inherit the spirit of Transformers in language and vision tasks, and embrace complicated architectures by stacking deep attention-based propagation layers. In this paper, we attempt to evaluate the necessity of adopting multi-layer attentions in Transformers on graphs, which considerably restricts the efficiency. Specifically, we analyze a generic hybrid propagation layer, comprised of all-pair attention and graph-based propagation, and show that multi-layer propagation can be reduced to one-layer propagation, with the same capability for representation learning. It suggests a new technical path for building powerful and efficient Transformers on graphs, particularly through simplifying model architectures without sacrificing expressiveness. As exemplified by this work, we propose a Simplified Single-layer Graph Transformers (SGFormer), whose main component is a single-layer global attention that scales linearly w.r.t. graph sizes and requires none of any approximation for accommodating all-pair interactions. Empirically, SGFormer successfully scales to the web-scale graph ogbn-papers100M, yielding orders-of-magnitude inference acceleration over peer Transformers on medium-sized graphs, and demonstrates competitiveness with limited labeled data.

View on arXivView PDF

Code Implementations(1)

qitianwu/SGFormerCommunity100%
MIT

The official implementation for NeurIPS2023 paper "SGFormer: Simplifying and Empowering Transformers for Large-Graph Representations"

28029Shell, PythonOct 28, 202311 months agoMIT

Similar Papers

Cite this paper

@article{wu2024sgformer,
  title  = {SGFormer: Single-Layer Graph Transformers with Approximation-Free Linear Complexity},
  author = {Qitian Wu and Kai Yang and Hengrui Zhang and David Wipf and Junchi Yan},
  year   = {2024},
  eprint = {2409.09007},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2409.09007v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2409.09007.svg)](https://codeofpaper.com/paper/2409.09007)

Discussion