TL;DR
DyGFormer is a new Transformer-based architecture that achieves state-of-the-art results in dynamic graph learning by explicitly modeling node correlations and efficiently processing long-term histories through a novel patching technique. Alongside the model, the authors release DyGLib, a unified library designed to solve the field's reproducibility crisis by providing standardized pipelines and evaluation protocols.
What Problem Does This Paper Address?
Dynamic graphs—where nodes and edges evolve over time (e.g., social networks, transaction logs)—are ubiquitous. However, current learning methods face two major hurdles:
- Ignoring Correlations: Most models compute node representations independently, failing to exploit the fact that common historical neighbors between two nodes are often strong predictors of future interactions.
- The "Short Memory" Problem: Processing long historical sequences is computationally expensive. Existing models often truncate history or use recurrent units that suffer from vanishing gradients, preventing them from capturing long-term temporal dependencies.
- Reproducibility Crisis: The field lacks a standard library. Different researchers use varied training pipelines and "problematic" implementations, making it nearly impossible to fairly compare new algorithms against old ones.
Methods
The authors introduce DyGFormer, which simplifies dynamic graph learning by treating it as a sequence modeling task focused on first-hop interactions.
Key innovations include:
- Neighbor Co-occurrence Encoding (NCoE): This scheme counts how often a neighbor appears in the historical sequences of both the source and destination nodes. This explicitly feeds the model information about the nodes' shared context.
- Patching Technique: Instead of feeding every single interaction as a token to the Transformer, DyGFormer groups $P$ adjacent interactions into a "patch." This keeps the number of tokens constant even as the history length increases, drastically reducing computational complexity while preserving local temporal patterns.
- DyGLib: A comprehensive PyTorch-based library that unifies data loading, training, and evaluation for continuous-time dynamic graph learning.
Datasets
The study evaluates DyGFormer on 13 diverse datasets, including Wikipedia (edits), Reddit (posts), MOOC (student actions), LastFM (listening history), and various political and trade networks. They also validate their model on the recently proposed Temporal Graph Benchmark (TGB), which features larger-scale and more challenging tasks.
Key Insights and Ideas
- Shared History is a Strong Signal: The NCoE scheme proved to be highly versatile. When the authors integrated it into other models like TCL and GraphMixer, those models also saw significant performance gains (up to 24.9% on LastFM).
- More History Isn't Always Better for Baselines: Surprisingly, many existing models perform worse as you give them more historical data. This suggests they lack the architectural capacity to filter out noise or handle long-range dependencies.
- Patching is a Win-Win: By using patches, DyGFormer can look back at 4,096 historical interactions while remaining faster and more memory-efficient than models looking at much shorter sequences.
- Standardization Matters: The authors found that many previously reported baseline results were inconsistent due to suboptimal hyperparameter tuning or implementation bugs. DyGLib revealed that with proper tuning, some "old" models are much stronger than previously thought.
Key Results
DyGFormer achieved the best or second-best performance on nearly all datasets for both dynamic link prediction and node classification.
- Link Prediction: On the Average Precision (AP) metric, DyGFormer achieved an average rank of 1.62 across 13 datasets, outperforming popular baselines like TGN and CAWN.
- Efficiency: The patching technique provided massive speedups. For a sequence length of 256 on the LastFM dataset, DyGFormer with patching was 5.1x faster and used 3.15x less memory than a version without patching.
As shown in the figure above, while baselines (like TGN and DyRep) struggle or crash as history length increases, DyGFormer's performance continues to scale upward.
Limitations and Future Work
The authors acknowledge two main limitations:
- First-Hop Only: DyGFormer currently only looks at direct (first-hop) neighbors. While this simplifies the model, some tasks might require understanding higher-order relationships (neighbors of neighbors).
- Sensitivity to Sampling: The NCoE scheme relies on the assumption that common neighbors imply future interaction. In datasets where this isn't true, or under certain negative sampling strategies, the model's advantage can diminish.
Future work involves extending the architecture to handle multi-hop neighbors efficiently and incorporating even more state-of-the-art models into the DyGLib ecosystem.
Summary updated