Between Linear and Sinusoidal: Rethinking the Time Encoder in Dynamic Graph Learning
Not on the map. Why?
Abstract (arXiv)
Dynamic graph learning is essential for applications involving temporal networks and requires effective modeling of temporal relationships. Seminal attention-based models like TGAT and DyGFormer rely on sinusoidal time encoders to capture temporal dependencies between edge events. Prior work justified sinusoidal encodings because their inner products depend on the time spans between events, which are crucial features for modeling inter-event relations. However, sinusoidal encodings inherently lose temporal information due to their many-to-one nature and therefore require high dimensions. In this paper, we rigorously study a simpler alternative: the linear time encoder, which avoids temporal information loss caused by sinusoidal functions and reduces the need for high-dimensional time encoders. We show that the self-attention mechanism can effectively learn to compute time spans between events from linear time encodings and extract relevant temporal patterns. Through extensive experiments on six dynamic graph datasets, we demonstrate that the linear time encoder improves the performance of TGAT and DyGFormer in most cases. Moreover, the linear time encoder can lead to significant savings in model parameters with minimal performance loss. For example, compared to a 100-dimensional sinusoidal time encoder, TGAT with a 2-dimensional linear time encoder saves 43% of parameters and achieves higher average precision on five datasets. While both encoders can be used simultaneously, our study highlights the often-overlooked advantages of linear time features in modern dynamic graph models. These findings can positively impact the design choices of various dynamic graph learning architectures and eventually benefit temporal network applications such as recommender systems, communication networks, and traffic forecasting.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 32 of its 43 references that are in the map. First posted on arXiv 10 Apr 2025.
Builds on
32 of 43 references.
References · 32
- 2017Attention Is All You Needcited by 60,361
- 2014Adam: A Method for Stochastic Optimizationcited by 37,240
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2017Graph Attention Networkscited by 8,923
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2017Spatio-Temporal Graph Convolutional Networks: A Deep Learning Framework for Traffic Forecastingcited by 1,136
- 2018Self-Attention with Relative Position Representationscited by 1,120
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
- 2020A Generalization of Transformer Networks to Graphscited by 661
- 2020Temporal Graph Networks for Deep Learning on Dynamic Graphscited by 530
- 2020Inductive Representation Learning on Temporal Graphscited by 462
20 more
- 2019Predicting Dynamic Embedding Trajectory in Temporal Interaction Networkscited by 448
- 2019EvolveGCN: Evolving Graph Convolutional Networks for Dynamic Graphscited by 447
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
- 2021Multi-Time Attention Networks for Irregularly Sampled Time Seriescited by 238
- 2019Time2Vec: Learning a Vector Representation of Timecited by 213
- 2021Inductive Representation Learning in Temporal Networks via Causal Anonymous Walkscited by 193
- 2022Pure Transformers are Powerful Graph Learnerscited by 188
- 2023Towards Better Dynamic Graph Learning: New Architecture and Unified Librarycited by 157
- 2023Do We Really Need Complicated Model Architectures For Temporal Networks?cited by 143
- 2023Temporal Graph Benchmark for Machine Learning on Temporal Graphscited by 138
- 2022ROLAND: Graph Learning Framework for Dynamic Graphscited by 132
- 2022Towards Better Evaluation for Dynamic Link Predictioncited by 122
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 86
- 2021TCL: Transformer-based Dynamic Graph Modelling via Contrastive Learningcited by 68
- 2023Graph Neural Networks for temporal graphs: State of the art, open challenges, and opportunitiescited by 61
- 2021Dynamic Graph Neural Networks for Sequential Recommendationcited by 57
- 2019Self-attention with Functional Time Representation Learningcited by 52
- 2024TGB 2.0: A Benchmark for Learning on Temporal Knowledge Graphs and Heterogeneous Graphscited by 36
- 2020Laplacian Change Point Detection for Dynamic Graphscited by 25
- 2022Temporal Link Prediction: A Unified Framework, Taxonomy, and Reviewcited by 20
Built on by
Citing papers per year: 2025: 1; 2026: 1.
2 papers.