recbole.SHAN
A two-layer attention network that combines a user's long-term and short-term preferences to recommend the next item.
Tabular and recommender · 33 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 176.6K
- Operations
- 33
- Framework
- PyTorch
- Recurrent
- No
- Published
- IJCAI 2018
- Cited by
- 375 (as of 22 October 2026)
- Authors
- Haochao Ying, Fuzhen Zhuang, Fuzheng Zhang and others
- Source
- recbole 1.2.1
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m8668
- Graph hash
- 4b22405edcb9710f588d2703c0e142fe7e5e97e9116ae1856a1c2609422c4bc5
- Skeleton hash
- 5b6287bee146baaf4f42a0345ee8209a91afbc21c2f67348e1e946cd3a69c73b
- Architecture hash
- b289139ca1a1da1a01f45288593457d2ee6680fc9fc89081c21cce0a32df8ea1
- Diagram SHA-256
- 1e2e6a5617d84dc6e894c89dec2dae5dbba9322b0aff2e630c4aae6727bdb636
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
SHAN, the Sequential Hierarchical Attention Network, is a sequential recommender: it is built for the next item recommendation problem. The paper argues that existing methods neglect that a user's long-term preference keeps evolving over time, so a static representation of general taste may not reflect it. It also says those methods integrate user-item or item-item interactions in a linear way, which limits the capability of the model.
The network has two attention layers. Users and items are first embedded into low-dimensional dense spaces. The first attention layer computes weights for the items in the user's long-term set and compresses the weighted item vectors into a long-term user representation. A second attention layer couples the user's sequential behavior with that long-term representation. In both layers the user embedding vector is used as context information, so the weights differ from user to user.
Training uses the Bayesian personalized ranking criterion to form a pair-wise loss function. Experiments use two datasets, Tmall and Gowalla, where the paper reports that SHAN improves Recall at 20 by 33.6% and 9.8% respectively over the second best method, HRM. In the component study, SHAN-S, which considers only the user's short-term preference, does slightly better than the full SHAN at Recall at 20 on the Tmall dataset.
Key idea. SHAN uses a two-layer hierarchical attention network in which the first layer learns long-term user preferences and the second couples them with short-term preferences.
- shan
- sequential hierarchical attention network
- sequential recommendation
- next item recommendation
- hierarchical attention
- long-term and short-term preference
- recbole shan
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@inproceedings{Ying_2018, series={IJCAI-2018}, title={Sequential Recommender System based on Hierarchical Attention Networks}, url={http://dx.doi.org/10.24963/ijcai.2018/546}, DOI={10.24963/ijcai.2018/546}, booktitle={Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence}, publisher={International Joint Conferences on Artificial Intelligence Organization}, author={Ying, Haochao and Zhuang, Fuzhen and Zhang, Fuzheng and Liu, Yanchi and Xu, Guandong and Xie, Xing and Xiong, Hui and Wu, Jian}, year={2018}, month=July, pages={3926–3932}, collection={IJCAI-2018} }