Between Linear and Sinusoidal: Rethinking the Time Encoder in Dynamic Graph Learning

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Chung, Hsing-Huan, Chaudhari, Shravan, Han, Xing, Wald, Yoav, Saria, Suchi, Ghosh, Joydeep
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866911087736127488
author Chung, Hsing-Huan
Chaudhari, Shravan
Han, Xing
Wald, Yoav
Saria, Suchi
Ghosh, Joydeep
author_facet Chung, Hsing-Huan
Chaudhari, Shravan
Han, Xing
Wald, Yoav
Saria, Suchi
Ghosh, Joydeep
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2504_08129
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Between Linear and Sinusoidal: Rethinking the Time Encoder in Dynamic Graph Learning
Chung, Hsing-Huan
Chaudhari, Shravan
Han, Xing
Wald, Yoav
Saria, Suchi
Ghosh, Joydeep
Machine Learning
Social and Information Networks
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.
title Between Linear and Sinusoidal: Rethinking the Time Encoder in Dynamic Graph Learning
topic Machine Learning
Social and Information Networks
url https://arxiv.org/abs/2504.08129