All models

ANS-GT

A graph Transformer for node classification that attends over sampled nodes, super-nodes and global nodes.

Graphs and geometry · 142 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 (28 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
583.4K
Operations
142
Framework
PyTorch
Recurrent
No
Published
NeurIPS 2022
Cited by
40 (as of 29 October 2026)
Authors
Zaixi Zhang, Qi Liu, Qingyong Hu, Chee-Kong Lee
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
m14554
Graph hash
bcfcf101fa0f0547264b5381fccf123d02ea773fd86447595394891640f238e4
Skeleton hash
852a3eb1d919c87564cdad96659574ad886b568c7b2adb7a99ac45227a2afc7d
Architecture hash
701ed4269bfdc95b8afd1af8a1eaaef461a29dd229e3d26d3faec7ad498ab909
Diagram SHA-256
6fa55676e0dd04220ac965876d1056635b1a0c2085d2e70a655755d3f5f33f8a
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

ANS-GT, short for Adaptive Node Sampling for Graph Transformer, is a Transformer that classifies the nodes of a graph. Instead of attending over the whole graph, it builds a short input sequence around each center node, and the paper's two ideas concern which nodes go into that sequence. Its starting point is that existing node sampling strategies in graph Transformers ignore the characteristics of the graph and the training process.

The first idea treats node sampling as an adversarial bandit problem. The paper considers four sampling strategies: 1-hop neighbors, 2-hop neighbors, PPR and KNN. A weight on each strategy is updated during training, and a strategy earns a higher reward when its sampling probabilities resemble the attention weights the Transformer gives to the nodes.

The second idea is a hierarchical attention scheme with fine-grained local attention and coarse-grained global attention. A graph coarsening algorithm groups nodes into super-nodes, and sampled super-nodes are used to capture long-range dependencies. Global nodes with learnable features join the sequence to store global context. The paper shows that the overall computational complexity is linear in the number of nodes, and it compares ANS-GT with 12 baseline methods on node classification accuracy. The code's README notes that graph coarsening is left out of the preprocessing script for larger datasets because of instability.

Key idea. ANS-GT casts node sampling in graph Transformers as an adversarial bandit problem rewarded by attention weights, and adds coarse-grained global attention over a coarsened graph.

  • ANS-GT
  • Hierarchical Graph Transformer with Adaptive Node Sampling
  • Adaptive Node Sampling for Graph Transformer
  • graph transformer
  • node classification
  • node sampling
  • graph coarsening
  • hierarchical attention
  • adversarial bandit
  • large graphs

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

Cite the paper

@misc{zhang2022hierarchicalgraphtransformeradaptive,
      title={Hierarchical Graph Transformer with Adaptive Node Sampling}, 
      author={Zaixi Zhang and Qi Liu and Qingyong Hu and Chee-Kong Lee},
      year={2022},
      eprint={2210.03930},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2210.03930}, 
}