On the Feasibility of Simple Transformer for Dynamic Graph Modeling

Yuxia Wu, Yuan Fang, Lizi Liao

Introduction

Dynamic graphs, which represent entities and their evolving relationships over time, are fundamental to real-world applications such as social networks, recommendation systems, and financial transaction monitoring. Modeling these graphs effectively requires capturing two distinct dimensions: structural dependencies (the topology of connections) and temporal dynamics (the timing and frequency of interactions).

Traditionally, researchers have approached this problem through two primary lenses. Discrete-time methods treat dynamic graphs as a sequence of static snapshots, which often results in the loss of fine-grained temporal information. Conversely, continuous-time methods map every interaction to a specific point on a timeline. While more detailed, continuous-time methods often rely on message-passing Graph Neural Networks (GNNs), which are susceptible to "over-smoothing"—a phenomenon where node representations become indistinguishable as the network depth increases—and struggle to capture long-range dependencies.

This paper introduces SimpleDyG, a model that challenges the necessity of specialized, complex architectures. By re-conceptualizing dynamic graph modeling as a sequence modeling task, SimpleDyG demonstrates that a "vanilla" Transformer can outperform state-of-the-art specialized models.

Methodology

SimpleDyG eschews complex modifications to the Transformer architecture, such as modified attention mechanisms or integrated GNN layers. Instead, it focuses on how data is structured and fed into a standard Transformer.

Temporal Ego-graphs

To ensure computational scalability and focus on local dynamics, SimpleDyG extracts a "temporal ego-graph" for each node. This ego-graph is a chronological sequence of a node's historical interactions. By transforming the graph structure into a set of sequences, the model bypasses the traditional bottlenecks of message-passing and treats the evolution of a node as a natural language-like sequence problem.

Temporal Alignment Tokens

While Transformers excel at understanding relative order, dynamic graphs require a sense of absolute time to synchronize events across different nodes. SimpleDyG introduces Temporal Alignment Tokens (e.g., <|time1|>, <|time2|>) into the sequences. These tokens act as a "global clock," allowing the model to align the timing of interactions across the entire dataset. This ensures that the model understands not just that event A happened before event B, but whether they occurred during the same global period of activity.

Vanilla Architecture

The core of SimpleDyG remains a standard Transformer utilizing Multi-Head Attention and Feed-Forward Networks. This simplicity ensures that the model benefits from the inherent strengths of the Transformer architecture, such as the ability to handle long-range dependencies without the "over-squashing" issues common in deep GNNs.

Experimental Evaluation

The researchers evaluated SimpleDyG against several competitive baselines, including TGN, DySAT, and GraphMixer, across four diverse real-world datasets:

  • UCI: A social network based on message exchanges.
  • ML-10M: A MovieLens rating network focusing on user-tag interactions.
  • Hepth: A citation network for high-energy physics, used to test inductive capabilities with new nodes.
  • MMConv: A multi-turn conversation dataset.

Key Results and Discussion

State-of-the-Art Performance

SimpleDyG consistently outperformed both discrete and continuous-time baselines in link prediction tasks. Notably, on the ML-10M dataset, the model achieved an NDCG@5 of 0.138, representing a significant improvement over the previous state-of-the-art models.

Computational Efficiency

Despite the perceived complexity of Transformers, SimpleDyG proved to be highly efficient. On the UCI dataset, it recorded a training time of 6.21 seconds per epoch, significantly faster than more specialized models like TGAT, which required 18.54 seconds per epoch. This efficiency stems from avoiding the overhead of complex graph-traversal and message-passing operations.

Long-term Robustness

In multi-step prediction scenarios—where the model must predict connections several time steps into the future—SimpleDyG exhibited a much slower performance decay than its competitors. This suggests that the Transformer's attention mechanism is superior at maintaining relevant historical context over long durations compared to GNN-based approaches.

Limitations and Future Work

While SimpleDyG shows remarkable promise, the authors noted that the effectiveness of global temporal alignment is dataset-dependent. In citation networks (Hepth) and conversational data (MMConv), strict global alignment was less effective than no alignment, suggesting that event-driven dynamics in these datasets may not follow a synchronized global clock. Additionally, the $O(n^2)$ complexity of the Transformer attention mechanism remains a constraint for nodes with extremely long interaction histories.

Future research will focus on developing more flexible temporal alignment techniques that can adapt to both global and localized event-driven timelines, further refining the balance between simplicity and temporal precision.

Summary updated

BibTeX
@inproceedings{wu2024feasibility,
  author = {Yuxia Wu and Yuan Fang and Lizi Liao},
  title = {{On the Feasibility of Simple Transformer for Dynamic Graph Modeling}},
  booktitle = {The Web Conference},
  year = {2024},
  url = {https://openreview.net/forum?id=lt9nqrwJ9t},
}
Figure