Abstract
Temporal Graph Networks (TGNs) typically aggregate information from a fixed number of a node's most recent neighbors. This strategy often leads to "information redundancy" and a limited "temporal receptive field," missing critical long-range dependencies. We propose Time-aware Neighbor Sampling (TNS), a method that learns to adaptively skip redundant interactions and expand the sampling window. By employing a differentiable interpolation trick, TNS enables end-to-end training of the sampling process. Our evaluation on benchmark datasets shows that TNS significantly improves performance in edge prediction and node classification without increasing computational overhead.
Introduction
Real-world graphs, such as social networks, transaction logs, or user-item interactions, are inherently dynamic. Temporal Graph Networks (TGNs) model these systems by aggregating information from a node's neighborhood over time. However, as the number of interactions grows, models must sample a subset of neighbors to remain computationally feasible.
Standard approaches typically sample the $S$ most recent neighbors. This "most recent" heuristic suffers from two primary drawbacks:
- Redundancy: High-frequency interactions (bursts) can consume the entire sampling budget with repetitive information.
- Short-Sightedness: Important periodic or long-term patterns are often ignored because they fall outside the immediate temporal window.
Methods
Expanded Neighbor Sampling
To address these limitations, we introduce the concept of an expansion rate ($r$). Instead of selecting the $S$ most recent neighbors, the model selects neighbors at intervals defined by $r$. For instance, with $r=4$, the model selects one neighbor and skips the subsequent three in the chronological sequence. This approach naturally increases the temporal diversity of the sampled neighborhood and extends the model's reach into the node's history.
Time-aware Neighbor Sampling (TNS)
A fixed expansion rate is often suboptimal across different nodes or time steps. TNS addresses this by utilizing an expansion learning module—a small neural network that predicts the ideal expansion rate $r$ for a specific node at a given time.
To make the discrete sampling process differentiable and thus trainable via backpropagation, we utilize an interpolation trick. By treating the sequence of neighbor messages as a continuous signal (analogous to pixels in an image), the model can compute a weighted average of neighboring messages. This allows the gradient to flow back through the sampling indices, effectively "pushing" the model toward the most informative temporal scales.
Results
We integrated TNS into two prominent architectures, TGAT and TGN, and evaluated them on the Wikipedia, Reddit, and MOOC datasets.
- Edge Prediction: On the MOOC dataset, TNS improved TGAT's test accuracy from 75.20% to 80.76% in transductive settings and from 74.02% to 80.45% in inductive settings.
- Node Classification: TNS consistently outperformed baselines. For the Wikipedia dataset, TGN + TNS achieved an 89.04% ROC AUC, compared to 87.81% for the standard TGN.
- Efficiency: Since TNS only modifies the selection of neighbors rather than the total count, it provides these performance gains with negligible impact on latency or memory usage.
Conclusion
TNS introduces adaptive temporal receptive fields to graph networks, allowing them to dynamically adjust their focus between immediate and historical interactions. While currently limited by a linear expansion assumption, TNS demonstrates that temporal diversity is a powerful signal for improving the robustness and accuracy of temporal graph models. Future work may explore non-linear or irregular sampling patterns to further enhance flexibility.
Summary updated