
SGFormer
Graphs and geometry233 ops213.8K params
A simplified graph transformer whose single linear attention layer scales to graphs with a hundred million nodes.
Graphs and geometry · 28 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
How this diagram was made
torch_geometric.nn.attention.SGFormerAttention(channels=64, heads=1, head_channels=64, qkv_bias=False)
This page's module is the simple global attention on its own, without the GNN branch of the full model. It defaults to a single attention head.
SGFormer, the Simplified Graph Transformer, is a graph encoder for node property prediction built around a single layer of global attention that propagates information among arbitrary nodes. Its premise is that existing graph transformers inherit the deep multi-head stacks of language and vision models. The paper shows that even one attention layer is competitive on node property prediction benchmarks whose node counts range from thousands to billions.
The attention step combines all-pair attentive propagation across the nodes with a self-loop term that preserves each node's own information. It runs in time linear in the number of nodes, against quadratic for the softmax attention of the original Transformer. Graph structure enters at the output, where the attention output is mixed with embeddings propagated by a simple GNN. The model needs no positional encodings, feature or graph pre-processing, extra loss functions or edge embeddings. Unlike NodeFormer, which relies on random features for approximation, it uses no approximation or stochastic components.
On medium-sized graphs the paper reports an improvement of up to 25.9% over GCN on actor. It reports speedups of up to 37x in training and 141x in inference over scalable transformers. SGFormer scaled to ogbn-papers100M, with 0.1 billion nodes, on a single GPU, two orders of magnitude beyond the largest demonstrations of NodeFormer and DIFFormer. The official code pairs the one-layer global attention with a shallow GNN.
Key idea. SGFormer shows that a single-layer, single-head linear global attention, combined with a shallow GNN, is competitive on node property prediction from thousands to billions of nodes.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{wu2024sgformersimplifyingempoweringtransformers,
title={SGFormer: Simplifying and Empowering Transformers for Large-Graph Representations},
author={Qitian Wu and Wentao Zhao and Chenxiao Yang and Hengrui Zhang and Fan Nie and Haitian Jiang and Yatao Bian and Junchi Yan},
year={2024},
eprint={2306.10759},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2306.10759},
}