Sequential Recommendation on Temporal Proximities with Contrastive Learning and Self-Attention
Hansol Jung, Hyunwoo Seo, Chiehyeon Lim
TL;DR
TemProxRec addresses the underutilization of temporal context in sequential recommendation by modeling both vertical temporal proximity (across users) and horizontal temporal proximity (within a user sequence). It introduces Temporal-proximity-aware Contrastive Learning (TCL) to align item representations across concurrent users and Multi-Head Absolute-Relative (MHAR) attention to encode time and order within a single user’s history, trained with the MLM objective and TCL loss ${\mathcal{L}_{MLM}}$ and ${\mathcal{L}_{TCL}}$. Empirical results on four real-world datasets show TemProxRec achieving state-of-the-art performance over strong baselines, with ablations confirming the distinct value of TCL and MHAR components. The work demonstrates that explicit temporal proximity modeling improves recommendation quality and offers a plug-in TCL approach that can enhance other transformer-based sequential recommenders, with potential extensions to additional contextual signals.
Abstract
Sequential recommender systems identify user preferences from their past interactions to predict subsequent items optimally. Although traditional deep-learning-based models and modern transformer-based models in previous studies capture unidirectional and bidirectional patterns within user-item interactions, the importance of temporal contexts, such as individual behavioral and societal trend patterns, remains underexplored. Notably, recent models often neglect similarities in users' actions that occur implicitly among users during analogous timeframes-a concept we term vertical temporal proximity. These models primarily adapt the self-attention mechanisms of the transformer to consider the temporal context in individual user actions. Meanwhile, this adaptation still remains limited in considering the horizontal temporal proximity within item interactions, like distinguishing between subsequent item purchases within a week versus a month. To address these gaps, we propose a sequential recommendation model called TemProxRec, which includes contrastive learning and self-attention methods to consider temporal proximities both across and within user-item interactions. The proposed contrastive learning method learns representations of items selected in close temporal periods across different users to be close. Simultaneously, the proposed self-attention mechanism encodes temporal and positional contexts in a user sequence using both absolute and relative embeddings. This way, our TemProxRec accurately predicts the relevant items based on the user-item interactions within a specific timeframe. We validate this work through comprehensive experiments on TemProxRec, consistently outperforming existing models on benchmark datasets as well as showing the significance of considering the vertical and horizontal temporal proximities into sequential recommendation.
