All models

dyglib_tgb.DyGFormer

A Transformer for dynamic graphs that patches first-hop histories and counts shared neighbors.

Graphs and geometry · 198 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 (110 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
25.5K
Operations
198
Framework
PyTorch
Recurrent
Yes
Published
NeurIPS (arXiv 2023)
Cited by
100 (as of 24 October 2026)
Authors
Le Yu, Leilei Sun, Bowen Du, Weifeng Lv
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
m11821
Graph hash
7d8b11a42733aa79df25944e4d1ec7088361dea8c220f24b7b2169f20d381cf3
Skeleton hash
25631388b88b8ef196e8cdb54587f6f8cce2edf934bdda8e0ecd0683b9788818
Architecture hash
d9b757ce3bfd6d10ddf535dd0128365524e8f313f60182c6f3ef57201bdbde82
Diagram SHA-256
f08436cb8f51f802f508b3138576acd7a2f040b22d27744791b1c45b284f7796
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

DyGFormer is a Transformer-based architecture for dynamic graph learning, where entities are nodes and their timestamped interactions are links. It is conceptually simple and only needs to learn from nodes' historical first-hop interactions, which turns dynamic graph learning into a sequence learning problem. Given an interaction between a source and a destination node, it extracts both nodes' first-hop histories before that timestamp, encodes neighbors, links and time intervals, and feeds the result to a Transformer.

Two ideas distinguish it. The first is a neighbor co-occurrence encoding scheme that explores correlations between the source and destination nodes based on their historical sequences, on the intuition that two nodes with more common historical neighbors are more likely to interact in the future. The second is a patching technique that divides each sequence into multiple patches and feeds them to the Transformer, letting the model benefit effectively and efficiently from longer histories. Each patch groups temporally adjacent interactions with flattened encodings, which preserves local temporal proximities. In experiments the input sequence length is varied from 32 to 4096 while the patch size grows from 1 to 128, keeping computational complexity constant regardless of input length. The encoder stacks pre-norm multi-head self-attention and feed-forward blocks with GELU, and processes the source and destination sequences together so attention can run within and across them.

The paper also introduces DyGLib, a unified library with standard training pipelines, extensible coding interfaces and comprehensive evaluating protocols for continuous-time dynamic graph learning. Across thirteen datasets for dynamic link prediction and dynamic node classification, DyGFormer reaches state-of-the-art performance on most of them. The authors are candid about where it does not: on datasets whose positive and negative links have similar common-neighbor ratios, such as UN Vote, DyGFormer can trail a few baselines.

Key idea. DyGFormer pairs a neighbor co-occurrence encoding that captures source-destination correlations with a patching technique that lets a Transformer exploit long first-hop histories at constant cost, and ships with the DyGLib library for reproducible dynamic graph learning.

  • dygformer
  • dyglib
  • dynamic graph learning
  • temporal graph
  • continuous-time dynamic graph
  • dynamic link prediction
  • dynamic node classification
  • neighbor co-occurrence encoding
  • patching transformer

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

Cite the paper

@misc{yu2023betterdynamicgraphlearning,
      title={Towards Better Dynamic Graph Learning: New Architecture and Unified Library}, 
      author={Le Yu and Leilei Sun and Bowen Du and Weifeng Lv},
      year={2023},
      eprint={2303.13047},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2303.13047}, 
}