recbole.NARM
A GRU session recommender whose attention picks out the clicks that reveal the user's main purpose.
Tabular and recommender · 27 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
- 230.7K
- Operations
- 27
- Framework
- PyTorch
- Recurrent
- No
- Published
- CIKM 2017
- Cited by
- 1,566 (as of 19 October 2026)
- Authors
- Jing Li, Pengjie Ren, Zhumin Chen 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
- m8647
- Graph hash
- b49250f49b2c2868224d452e5f1d27f366ee68018739f6dfd568543230be442f
- Skeleton hash
- b69fcef00faced625eafa3d5cb574a7f6a0ae9dbd5893a2a618415898dfdc23c
- Architecture hash
- 972214be8fbfa88106370e494b9f925fb767306b080d3414212d75195e6e4a15
- Diagram SHA-256
- 4a792298d7db5492e01c0a818b9527521decc42498878051bc714d4e0f0022ae
- 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
NARM, the Neural Attentive Recommendation Machine, is a session-based recommender that predicts the next item a user will click from the clicks in the current session alone. Its premise is that earlier recurrent models only tracked the user's sequential behavior, while the user's main purpose in the current session was not emphasized. NARM answers with a hybrid encoder: a global encoder that summarizes the whole click sequence, and a local encoder whose item-level attention picks out the clicks that reveal the main purpose, combined into one session representation.
Both encoders use a recurrent network with Gated Recurrent Units, which the authors chose because earlier work had shown GRU outperforming LSTM units on this task. Scores for candidate items come from a bi-linear decoding scheme between the session representation and each item embedding, which the paper says reduces parameters and improves performance over a fully-connected decoder. The paper reports that NARM outperformed all its baselines in recall at 20 across three dataset splits drawn from YOOCHOOSE and DIGINETICA, and most of them in MRR at 20. The original model used a single GRU layer of 100 hidden units and 50-dimensional item embeddings.
This PyTorch version comes from RecBole, which names a third-party PyTorch port as its reference code. Its forward pass returns the combined session representation, and full ranking scores are a matrix product of that vector with the item embedding table.
Key idea. NARM combines a GRU global encoder with an attention-based local encoder to capture a session's sequential behavior and main purpose, scoring items bi-linearly.
- narm
- neural attentive recommendation machine
- session-based recommendation
- next-item prediction
- attention
- gru
- recurrent
- click sequence
- e-commerce
- recbole
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{li2017neuralattentivesessionbasedrecommendation,
title={Neural Attentive Session-based Recommendation},
author={Jing Li and Pengjie Ren and Zhumin Chen and Zhaochun Ren and Jun Ma},
year={2017},
eprint={1711.04725},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/1711.04725},
}