NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Sequential Recommender System based on Hierarchical Attention Networks

Haochao Ying, Fuzhen Zhuang, Fuzheng Zhang, Yanchi Liu, Guandong Xu, Xing Xie, Hui Xiong, Jian Wu

Abstract

The Sequential Hierarchical Attention Network (SHAN) model addresses the challenges of next-item recommendation by dynamically weighting a user's long-term "general taste" against their short-term "recent demand." Unlike traditional models that rely on static user representations or linear combinations, SHAN employs a two-layer hierarchical attention mechanism to capture the evolving nature of user preferences. Experimental results on real-world e-commerce and check-in datasets demonstrate that SHAN significantly outperforms state-of-the-art baselines.

Introduction

Traditional recommender systems often struggle with sequential recommendation—the task of predicting a user's next action based on their historical interactions. Existing approaches typically suffer from three primary limitations:

  1. Static Long-term Preferences: Many models treat a user's general taste as a fixed vector, failing to account for how interests evolve over time.
  2. Linear Integration: Systems often combine long-term and short-term signals linearly, which cannot capture the complex, non-linear interactions between past habits and current sessions.
  3. Rigid Sequential Assumptions: Models like Recurrent Neural Networks (RNNs) assume a strict chronological order, which may not hold true in scenarios like shopping carts where the collective set of items in a session is more important than their specific order.

Methodology

The proposed Sequential Hierarchical Attention Network (SHAN) addresses these gaps through a four-component architecture designed to model dynamic user behavior.

The SHAN architecture featuring hierarchical attention layers for long-term and short-term preference modeling.

Architecture Components

  • Embedding Layer: Sparse user and item IDs are projected into low-dimensional dense vectors.
  • Long-term Attention-based Pooling Layer: This layer computes a dynamic long-term representation by attending to all previously purchased items. Guided by the user's embedding, the attention mechanism assigns weights to historical items, allowing the model to focus on those most relevant to the user's current persona.
  • Hybrid Attention-based Pooling Layer: This second layer integrates the long-term representation with items from the current short-term session. A second attention network determines the relative importance of "general taste" versus immediate "recent demand."
  • Optimization: The model is trained using Bayesian Personalized Ranking (BPR), which optimizes for ranking observed items higher than unobserved ones, suitable for implicit feedback data.

Experimental Setup

The SHAN model was evaluated on two large-scale datasets:

  • Tmall: Data from China’s largest e-commerce platform, featuring over 20,000 users and 25,000 items. Sessions are defined by daily activity.
  • Gowalla: A location-based social network dataset with approximately 15,000 users and 13,000 locations (items).

Results and Discussion

SHAN consistently outperformed state-of-the-art baselines, including TOP, BPR, FPMC, FOSSIL, and HRM, across both datasets.

Performance comparison of SHAN against baselines on Tmall and Gowalla datasets using Recall@N and AUC metrics.

Key Performance Gains

  • Tmall: SHAN achieved a 33.6% improvement in Recall@20 compared to the second-best method, HRM.
  • Gowalla: The model improved Recall@20 by 9.8% over the nearest competitor.
  • Ablation Study: Tests on "SHAN-S" (short-term only) and "SHAN-L" (long-term only) variants revealed that while short-term intent is a strong predictor, the full hierarchical model performs best. This confirms that general taste provides a necessary anchor for accurate recommendations.

Insights

The success of SHAN stems from its use of attention as a dynamic filter. By using the user's embedding as context, the model allows item importance to vary between users and over time. Furthermore, the hierarchical structure prevents long-term history from overwhelming short-term signals, while non-linear modeling captures interactions more effectively than traditional linear methods.

Conclusion

While SHAN demonstrates superior performance, future work could explore more granular session definitions beyond daily logs and incorporate additional metadata like item categories or user demographics. Additionally, addressing the computational complexity of hierarchical attention for real-time serving remains an area for optimization.

Summary updated

BibTeX
@inproceedings{ying2018sequential,
  author = {Haochao Ying and Fuzhen Zhuang and Fuzheng Zhang and Yanchi Liu and Guandong Xu and Xing Xie and Hui Xiong and Jian Wu},
  title = {{Sequential Recommender System based on Hierarchical Attention Networks}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.24963/ijcai.2018/546},
}
Figure