Abstract
Sequential recommendation systems aim to predict a user's next interaction by analyzing their historical behavior. However, existing models often struggle to balance stable long-term preferences with volatile short-term fluctuations, frequently relying on coarse fusion methods that fail to capture the nuanced evolution of user interests. This paper introduces TLSRec, a novel framework that employs a hierarchical self-attention network and a "Neural Time Gate." By utilizing the time lag between interactions to drive a dimension-wise gating mechanism, TLSRec adaptively fuses long-term and short-term representations. Experimental results on four real-world datasets demonstrate that TLSRec significantly outperforms state-of-the-art baselines, particularly in sparse data environments.
1. Introduction
Predicting the next item a user will interact with requires understanding both their enduring tastes and their immediate context. This task is complicated by two primary challenges: the Stability-Fluctuation Dilemma and Coarse Fusion. The former refers to the difficulty of distinguishing between a user's core interests (e.g., a lifelong preference for a specific movie genre) and temporary whims (e.g., a one-off purchase for a gift). The latter refers to the limitation of current models that combine these different interest scales using simple scalar weights, which ignores the fact that different latent features of a user's profile may evolve at different rates.
To address these issues, we propose TLSRec, a Time Lag Aware Sequential Recommendation framework. TLSRec treats time not just as a feature, but as a regulator that determines the relative importance of historical sessions through a fine-grained, dimension-wise fusion process.
2. Methodology
TLSRec is built upon three core components designed to capture and integrate multi-scale user preferences.
2.1 Hierarchical Self-Attention Network
Rather than treating interaction history as a flat sequence, TLSRec organizes data into sessions. The model processes these through two layers:
- Short-term Layer: This layer applies self-attention within the most recent session to capture the user's immediate intent and current context.
- Long-term Layer: This layer utilizes multi-head self-attention across multiple historical sessions. It incorporates learnable position embeddings to maintain the temporal order and dependencies between distinct sessions over time.
2.2 Neural Time Gate
The "Neural Time Gate" is the central innovation of the framework. It calculates the "time lag"—the duration between the user's last interaction and the current recommendation request. This lag is discretized and mapped to a time embedding, which serves as the input for the gating mechanism.
2.3 Fine-grained Fusion
Unlike traditional models that use a single scalar to weight long-term versus short-term interests, the Neural Time Gate generates a gating vector. This vector enables element-wise (dimension-wise) fusion of the embeddings. This allows the model to learn that certain dimensions (like genre) should remain stable, while others (like price or urgency) should be more sensitive to recent session data.
3. Experiments
3.1 Datasets
The model was evaluated on four diverse datasets to test its robustness across different interaction densities:
- Amazon Book: 517,556 ratings (characterized by high sparsity).
- Amazon Video: 64,298 ratings (a smaller, niche dataset).
- MovieLens-1M: 970,346 ratings (a standard benchmark).
- Lastfm: Over 16 million interactions (high-density sequential data).
Sessions were defined using time-based thresholds, such as 48 hours for Amazon datasets and 2 hours for MovieLens and Lastfm.
3.2 Performance
TLSRec demonstrated superior performance against ten state-of-the-art baselines, including RNN-based (DREAM), attention-based (SASRec, BERT4Rec), and GNN-based (SURGE) models. Notably, on the Amazon Book dataset, TLSRec achieved a Hit@20 of 0.3438, representing a nearly 55% improvement over the strongest baseline, SURGE (0.2219).
4. Discussion and Insights
4.1 Time as a Regulator
The success of TLSRec stems from its treatment of time lag as a controller. As the time lag increases, the model learns to decay the influence of the short-term session, naturally shifting the weight toward stable long-term preferences. This mirrors real-world behavior, where the relevance of a recent "shopping spree" fades as time passes.
4.2 Ablation Studies
Ablation experiments confirmed that both the hierarchical structure and the Neural Time Gate are essential. Removing either component led to a significant decrease in recommendation accuracy, proving that structural organization and time-aware fusion are complementary.
5. Conclusion
TLSRec provides a sophisticated approach to sequential recommendation by acknowledging the complex relationship between time and user interest. By moving from coarse scalar fusion to fine-grained gating, the model effectively navigates the stability-fluctuation dilemma. Future research may focus on automating session boundary detection and incorporating explicit negative feedback to further refine the hierarchical modeling of user behavior.
Summary updated