Temporal Graph Pattern Machine

Yijun Ma, Zehong Wang, Weixiang Sun, Yanfang Ye · DOI

Abstract

Temporal graph learning is pivotal for deciphering dynamic systems, where the core challenge lies in explicitly modeling the underlying evolving patterns that govern network transformation. However, prevailing methods are predominantly task-centric and rely on restrictive assumptions -- such as short-term dependency modeling, static neighborhood semantics, and retrospective time usage. These constraints hinder the discovery of transferable temporal evolution mechanisms. To address this, we propose the Temporal Graph Pattern Machine (TGPM), a foundation framework that shifts the focus toward directly learning generalized evolving patterns. TGPM conceptualizes each interaction as an interaction patch synthesized via temporally-biased random walks, thereby capturing multi-scale structural semantics and long-range dependencies that extend beyond immediate neighborhoods. These patches are processed by a Transformer-based backbone designed to capture global temporal regularities while adapting to context-specific interaction dynamics. To further empower the model, we introduce a suite of self-supervised pre-training tasks -- specifically masked token modeling and next-time prediction -- to explicitly encode the fundamental laws of network evolution. Extensive experiments show that TGPM consistently achieves state-of-the-art performance in both transductive and inductive link prediction, demonstrating exceptional cross-domain transferability.

Introduction

Most current temporal graph models are task-centric, designed to predict specific outcomes by fitting correlations within a single dataset. This approach often relies on static neighborhood semantics, short-term dependencies, and retrospective modeling where time is treated as an auxiliary label. These limitations make models brittle and unable to generalize across different network structures or time scales. TGPM shifts the focus to mechanism learning—inferring the latent processes driving system evolution to discover transferable temporal patterns.

Methodology

The TGPM architecture is built upon three core components: Interaction Patches, a Transformer Backbone, and Self-Supervised Pre-training.

The TGPM architecture overview, illustrating the construction of interaction patches, the Transformer-based backbone, and the self-supervised pre-training tasks.

Interaction Patches

Instead of simple node histories, TGPM represents interactions as "patches" synthesized from non-monotonic, temporally-biased random walks. These walks can traverse edges in any chronological order as long as they precede the target interaction, allowing the model to capture complex, interleaved structural motifs and "rekindled relationships" that strict chronological models miss.

Transformer Backbone

These patches are processed by a Transformer-based encoder designed to capture global temporal regularities. The backbone remains invariant to absolute time shifts by focusing on relative intervals, ensuring robust pattern recognition across different temporal scales.

Self-Supervised Pre-training

To internalize the "rhythms" of a graph, TGPM employs two primary pre-training tasks:

  • Masked Token Modeling (MTM): The model reconstructs hidden blocks of interaction patches. Multi-scale masking forces the model to learn both short-term and long-range dependencies.
  • Next-Time Prediction (NTP): The model predicts the timing of the next interaction, explicitly modeling the temporal granularity of the system.

Experimental Evaluation

TGPM was evaluated on the Dynamic Text-Attributed Graph Benchmark (DTGB), including the Enron email network, the ICEWS1819 political event graph, and the large-scale Googlemap CT e-commerce graph.

Key Results

TGPM consistently outperforms both supervised (e.g., TGAT, GraphMixer) and self-supervised (e.g., PT-DGNN, DDGCL) baselines in transductive and inductive link prediction. Notably, in cross-domain transfer experiments, TGPM achieved an Average Ranking of 1.0, demonstrating its ability to learn generalized evolution mechanisms.

Scaling behavior of TGPM: performance improves consistently as the number of parameters increases across different datasets.

The model also exhibits clear scaling law behavior. As shown in the figure above, performance on complex datasets like Googlemap CT continues to improve as the number of parameters increases, suggesting that larger models can capture even more intricate evolutionary patterns.

Conclusion and Future Work

TGPM represents a significant step toward foundation models for temporal graphs. While it achieves state-of-the-art results, challenges remain regarding "temporal burstiness" in datasets like Enron, where concurrent identical interactions can lead to trivial pre-training solutions. Future work will focus on developing "meta-patterns" for concurrent edges and integrating uncertainty-aware learning for sensitive domains.

The code is available at: https://github.com/antman9914/TGPM.

Summary updated

BibTeX
@misc{ma2026temporal,
  author = {Yijun Ma and Zehong Wang and Weixiang Sun and Yanfang Ye},
  title = {{Temporal Graph Pattern Machine}},
  year = {2026},
  eprint = {2601.22454},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.22454},
}
Figure