All models

Spexphormer

A two-stage sparse graph transformer: a narrow net picks the attention edges, a wide net trains on them.

Graphs and geometry · 155 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 (34 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

Parameters
56.8K
Operations
155
Framework
PyTorch
Recurrent
No
Published
NeurIPS 2024
Cited by
3 (as of 17 October 2026)
Authors
Hamed Shirzad, Honghao Lin, Balaji Venkatachalam 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
m20555
Graph hash
1737f96f32a20769f66e0eb52a2755e78c884a7403a34346cb4fbaaf6620cbed
Skeleton hash
b6ad5ab44966420a166bb92372b8e9bde40a4ca31ffc81f64d7e843e5f5af2c2
Architecture hash
4ecca2e29d580a5591ab421f6ed0b1d98dc518fcf351e8e8ccb3a4ca090aa200
Diagram SHA-256
c821b9df4f81351a0e06c1107d089f9c0b21200e1024dd1676dac7dc45a06645
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

What it is

About this model's family

Spexphormer is a graph transformer trained in two stages so that it fits in far less memory than a full-attention model or even an Exphormer-style sparse one. The problem it attacks is that graph transformers need memory quadratic in the number of nodes, which keeps them off large graphs. Sparse variants such as Exphormer help, but they may still need high-degree augmentations of the input graph and do nothing to thin an already dense one. The observation behind the method is that attention scores on graphs stay quite consistent as the width of the network changes.

So the authors first train a narrow network on the full expander-augmented graph, then keep only the connections its attention actually used and train a wider network on that much sparser graph. Sparsification happens layer by layer, keeping a fixed number of edges per node in each attention layer, so the attention pattern can differ from one layer to the next. Two small changes make the narrow and wide networks agree better: the value vectors are normalised to a common length under one learnable global scale, and the attention temperature is annealed from 1.0 down to 0.05 over training. Only the transformer half of Exphormer is used, not its dual message-passing plus transformer design.

Both captured members run the same Sp_Exphormer code in its Actor configuration, taking sampled neighbourhood batches of 64 core nodes and returning five-way node logits. In the repository the first stage is called the attention score estimator; its scores are saved to disk and the Spexphormer run reads them back to do the sampling. The paper's experiments cover twelve medium-sized graphs, six homophilic and six heterophilic, with Actor among the heterophilic ones.

Key idea. Train a narrow graph transformer first to learn which attention edges matter, then train the wide model only on those edges, cutting memory drastically while keeping accuracy.

  • Spexphormer
  • Even Sparser Graph Transformers
  • Exphormer
  • graph transformer
  • sparse attention
  • node classification
  • Sp_Exphormer
  • GraphGPS

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

Cite the paper

@misc{shirzad2024sparsergraphtransformers,
      title={Even Sparser Graph Transformers}, 
      author={Hamed Shirzad and Honghao Lin and Balaji Venkatachalam and Ameya Velingker and David Woodruff and Danica Sutherland},
      year={2024},
      eprint={2411.16278},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2411.16278}, 
}