Abstract
Many graph representation learning (GRL) problems are dynamic, with millions of edges added or removed per second. A fundamental workload in this setting is dynamic link prediction: using a history of graph updates to predict whether a given pair of vertices will become connected. Recent schemes for link prediction in such dynamic settings employ Transformers, modeling individual graph updates as single tokens. In this work, we propose HOT: a model that enhances this line of works by harnessing higher-order (HO) graph structures; specifically, k-hop neighbors and more general subgraphs containing a given pair of vertices. Harnessing such HO structures by encoding them into the attention matrix of the underlying Transformer results in higher accuracy of link prediction outcomes, but at the expense of increased memory pressure. To alleviate this, we resort to a recent class of schemes that impose hierarchy on the attention matrix, significantly reducing memory footprint. The final design offers a sweetspot between high accuracy and low memory utilization. HOT outperforms other dynamic GRL schemes, for example achieving 9%, 7%, and 15% higher accuracy than – respectively – DyGFormer, TGN, and GraphMixer, for the MOOC dataset. Our design can be seamlessly extended towards other dynamic GRL workloads.
Introduction
In real-world applications such as social networks, retail transactions, and financial systems, graphs are inherently dynamic. The evolution of these networks is captured through continuous updates—edges being added or removed. A core challenge in dynamic graph representation learning (GRL) is dynamic link prediction: predicting the likelihood of a future connection between two nodes based on their interaction history.
While recent advancements have utilized Transformers to model these interactions as sequences of tokens, most existing methods treat interactions in isolation. They often overlook higher-order (HO) structures, such as triangles or $k$-hop neighborhoods, which are strong predictors of future connectivity. For instance, if two individuals share multiple common neighbors, the probability of them forming a direct link increases significantly. However, explicitly incorporating these HO structures typically leads to a "memory explosion" due to the quadratic complexity of standard Transformer attention mechanisms relative to sequence length.
Methodology
HOT (Higher-Order Transformer) addresses the trade-off between structural richness and computational feasibility through a multi-stage architecture designed for efficiency.
- Higher-Order Extraction: The model identifies $k$-hop neighbors and calculates neighbor co-occurrence metrics. These HO features are integrated into the input feature matrices alongside standard 1-hop data.
- Patching and Alignment: To manage sequence length, HOT utilizes a "patching" technique that aggregates temporally adjacent interactions into single tokens. Furthermore, node sequences are concatenated horizontally to help the Transformer better infer chronological order across different nodes.
- Block-Recurrent Transformer (BRT): The core innovation for efficiency is the use of a BRT. By dividing the sequence into blocks and employing a recurrent state to pass information between them, HOT shifts the attention complexity from quadratic to linear. This allows the model to process significantly longer histories and more complex HO structures than vanilla Transformers.
Experimental Evaluation
The authors evaluated HOT on three diverse dynamic graph datasets: MOOC (student-course interactions), LastFM (user-music track interactions), and CanParl (parliamentary interactions). The model was tested in both transductive and inductive settings using various negative sampling strategies (Random, Historical, and Inductive).
Key Results
HOT consistently outperformed state-of-the-art baselines, including TGN, GraphMixer, and DyGFormer. On the MOOC dataset, HOT achieved a 9% accuracy boost over DyGFormer and a 15% boost over GraphMixer.
Ablation studies (as seen in the figure above) highlight that the inclusion of 2-hop interactions provides a critical structural signal. The combination of 1-hop and 2-hop data consistently yields higher scores across Average Precision (AP) and Area Under the Curve (AUC) metrics compared to using 1-hop data alone.
Conclusion
HOT successfully bridges the gap between high-fidelity structural modeling and computational efficiency in dynamic GRL. By leveraging higher-order graph features within a Block-Recurrent Transformer framework, it achieves superior accuracy in link prediction while maintaining a manageable memory footprint. Future work includes optimizing the preprocessing overhead of HO structure searching and extending the framework to dynamic node classification and graph-level regression tasks.
Summary updated