All models

SpecFormer

A spectral GNN whose filter is a Transformer over all Laplacian eigenvalues, traced on Cora node classification.

Graphs and geometry · 86 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 (48 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
99.9K
Operations
86
Framework
PyTorch
Recurrent
No
Published
ICLR 2023
Cited by
25 (as of 17 October 2026)
Authors
Deyu Bo, Chuan Shi, Lele Wang, Renjie Liao
License
GPL-3.0
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
m2879
Graph hash
fb47149921b7e0294575f0fff46f8750684a8fca7b0bc6ca95f922cd9cc6bec7
Skeleton hash
468b4864763c128f9e808b93e6bce0e31d054d2fc775516876e0dffa39934d37
Architecture hash
d9ee0b5db0eea10a9919e81865c2fdd46dafce9487ee6c77bd7225d62b0b0429
Diagram SHA-256
422546e5097f0f7d1e46a825d9843383f6e8d4c54f0bd136139fcd964478c5e5
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

Specformer is a spectral graph neural network that hands the whole spectrum of a graph's Laplacian to a Transformer, so the filter it learns depends on all eigenvalues at once rather than treating each one in isolation. The authors' motivation is that most existing spectral filters are scalar-to-scalar functions, mapping a single eigenvalue to a single filtered value and so ignoring the global pattern of the spectrum. Those filters are also usually built from fixed-order polynomials, which the paper argues have limited expressiveness and flexibility.

Each eigenvalue is first turned into a vector by a sinusoidal eigenvalue encoding, then a standard Transformer block with pre-norm layer normalization learns the dependencies between eigenvalues. A decoder then reads out new eigenvalues from each attention head, rebuilds a basis from each, and a feed-forward network combines those bases into the final graph convolution. Importantly, the paper shows the resulting filter is equivariant to permutation and performs non-local graph convolution.

The paper describes three sizes, Specformer-Small, Specformer-Medium and Specformer-Large, which differ in whether the filters and the combining feed-forward network are shared across layers or layer-specific. The captured member is the node-classification model at the Cora settings: two layers, two heads and a hidden size of 32, producing one row of 7 class scores for each of the 2,708 nodes. On the real-world node benchmarks, the authors report that Specformer outperforms state-of-the-art baselines on 7 out of 8 datasets, with a 12% relative improvement on Squirrel. The input it needs is unusual for a GNN: the eigenvalues and eigenvectors of the normalized graph Laplacian, precomputed with a spectral decomposition of cubic cost.

Key idea. A Transformer-based set-to-set spectral filter with learnable bases that captures both the magnitudes and relative differences of all Laplacian eigenvalues, giving a permutation-equivariant, non-local graph convolution.

  • specformer
  • spectral graph neural network
  • spectral gnn
  • spectral graph neural networks meet transformers
  • graph transformer
  • set-to-set spectral filter
  • eigenvalue encoding
  • learnable bases
  • laplacian eigenvalues
  • graph filter
  • node classification
  • cora
  • graph classification
  • zinc

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

Cite the paper

@misc{bo2023specformerspectralgraphneural,
      title={Specformer: Spectral Graph Neural Networks Meet Transformers}, 
      author={Deyu Bo and Chuan Shi and Lele Wang and Renjie Liao},
      year={2023},
      eprint={2303.01028},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2303.01028}, 
}