All models

SGFormerAttention

A simplified graph transformer whose single linear attention layer scales to graphs with a hundred million nodes.

Graphs and geometry · 28 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (33 KB)

Open in a new tab

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.

At a glance

Family
SGFormer
Parameters
12.3K
Operations
28
Framework
PyTorch
Recurrent
No
Published
NeurIPS 2023
Cited by
64 (as of 19 October 2026)
Authors
Qitian Wu, Wentao Zhao, Chenxiao Yang and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m2674
Graph hash
fc658b1c1bf52169e7f3cbdcef617b55dcf19250340e57aad71f45abc9387801
Skeleton hash
74906b551d19d70cad8b1588291cced64a89267e6865b0831dbcabd8d31e3eae
Architecture hash
8fc936071a60a07d9ebe1d903131fb7ff933942ec8ca73ddd49a97f696e8219a
Diagram SHA-256
e5c22b9fe463414e4c9479302c27f2b3f62a00f33bb6dbc5beb424593abd0ffc
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

torch_geometric.nn.attention.SGFormerAttention(channels=64, heads=1, head_channels=64, qkv_bias=False)

What it is

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.

  • sgformer
  • simplified graph transformer
  • graph transformer
  • linear attention
  • large graphs
  • node classification
  • all-pair attention
  • ogbn-papers100m
  • sgformerattention

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@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}, 
}