Abstract
Learning useful representations for continuous-time dynamic graphs (CTDGs) is challenging, due to the concurrent need to span long node interaction histories and grasp nuanced temporal details. In particular, two problems emerge: (1) Encoding longer histories requires more computational resources, making it crucial for CTDG models to maintain low computational complexity to ensure efficiency; (2) Meanwhile, more powerful models are needed to identify and select the most critical temporal information within the extended context provided by longer histories. To address these problems, we propose a CTDG representation learning model named DyGMamba, originating from the popular Mamba state space model (SSM). DyGMamba first leverages a node-level SSM to encode the sequence of historical node interactions. Another time-level SSM is then employed to exploit the temporal patterns hidden in the historical graph, where its output is used to dynamically select the critical information from the interaction history. We validate DyGMamba experimentally on the dynamic link prediction task. The results show that our model achieves state-of-the-art in most cases. DyGMamba also maintains high efficiency in terms of computational resources, making it possible to capture long temporal dependencies with a limited computation budget.
Introduction
Continuous-Time Dynamic Graphs (CTDGs) represent data as a stream of timed events (e.g., "User A bought Item B at 10:01 AM"). To make accurate predictions, models must look deep into a node's interaction history. However, current state-of-the-art models like DyGFormer rely on Transformers, which face quadratic computational complexity ($O(L^2)$) relative to sequence length. This limits their ability to process long histories due to memory constraints. Furthermore, longer histories introduce "temporal noise," requiring models to distinguish between irrelevant past events and significant recurring patterns.
Methods
DyGMamba addresses these challenges by leveraging the selective scan mechanism of the Mamba State Space Model (SSM) to achieve linear scaling ($O(L)$). The architecture consists of three main components:
- Node-Level SSM Block: This component uses a Mamba-based block to encode the chronological sequence of a node's neighbors. A "patching" technique is employed to group adjacent interactions into single tokens, further boosting efficiency.
- Time-Level SSM Block: A specialized, smaller SSM designed to capture "edge-specific temporal patterns" by analyzing the time intervals between repeated interactions of the same pair of nodes.
- Dynamic Information Selection: The output of the Time-Level SSM acts as a selector, assigning weights to the encoded neighbors from the Node-Level SSM. This effectively filters the history to prioritize the most relevant temporal information for the current prediction.
Experimental Setup
The model was evaluated on a mix of real-world and synthetic datasets. Real-world datasets included LastFM, Enron, MOOC, Reddit, Wikipedia, UCI, and Social Evo. Synthetic benchmarks (S1, S2, S3) were introduced to test the model's ability to recognize specific temporal trends like increasing intervals, decreasing intervals, and periodic patterns.
Key Results and Insights
DyGMamba achieves state-of-the-art (SOTA) performance in Average Precision (AP) and AUC-ROC for dynamic link prediction across nearly all tested datasets. Notably, the transition from $O(L^2)$ to $O(L)$ complexity allows DyGMamba to process significantly longer histories. On an NVIDIA A40 GPU, while the previous SOTA (DyGFormer) hit memory limits at 2,048 neighbors, DyGMamba successfully processed over 8,192 neighbors—a 4x increase in context capacity.
The model's "Time as a Filter" approach allows it to model the rhythm of interactions. On synthetic datasets with clear temporal trends, DyGMamba outperformed DyGFormer by a massive margin (e.g., ~81.6% vs ~55.2% AP on the S1 dataset), proving the effectiveness of its time-level selection mechanism.
Conclusion
DyGMamba demonstrates that SSMs can provide a highly efficient and effective alternative to Transformers for CTDG representation learning. While currently limited to one-hop neighbors and event streams (CTDGs), future work could explore integrating multi-hop structural information and adapting the architecture for discrete-time dynamic graphs (DTDGs) through hybrid GNN-SSM models.
Summary updated