LinRec
A SASRec sequential recommender whose attention is replaced by LinRec, an L2-normalized linear attention.
Tabular and recommender · 97 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
- 765.3K
- Operations
- 97
- Framework
- PyTorch
- Recurrent
- No
- Published
- SIGIR 2023
- Cited by
- 88 (as of 28 October 2026)
- Authors
- Langming Liu, Xiangyu Zhao, Chi Zhang and others
- 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
- m17945
- Graph hash
- c4ad8adf6ddc9a6adfb4b29a2bde76dbdcc4e99030a37a06673779eced111de7
- Skeleton hash
- b52eb0d03ecf39b4e657c13590ae9fc76a66a0e69cf13d47dcb1df608afbb03f
- Architecture hash
- 3b94919a5e8528d965385b0ecebc5a9d0fbb9985c1d16037e07220c7b1e6b3b2
- Diagram SHA-256
- 50a19e41b9a5edef2117785a7c4d96d8a096da72736e7c141b56c767b8c4867e
- 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
LinRec is an attention mechanism for Transformer-based sequential recommender systems, the models that suggest a next item from a user's history of interactions. Its motivation is that computing the attention matrix in dot-product attention has quadratic complexity in the sequence length, which is costly for long histories.
LinRec changes standard attention in three ways: the order of the dot products is changed, the Query is normalized row-wise and the Key column-wise, and an activation layer is added to both. The activation is the ELU function, a variation of ReLU chosen to control negative values. It is not a network of its own: the paper says it can be transplanted to any transformer for sequential recommendation.
This model is one of the recommenders the paper integrates LinRec into, SASRec, with the released attention layer substituted into the RecBole framework. It uses the paper's settings for the ml-1m dataset, a maximum sequence length of 200 and a hidden size of 128. On ML-1M the paper reports that LinRec reduces the GPU memory and time cost to approximately one-third for most baseline models.
Key idea. LinRec is an L2-normalized linear attention for Transformer-based sequential recommenders that lowers the cost of attention from quadratic to linear in sequence length.
- LinRec
- linear attention
- L2-normalized linear attention
- sequential recommendation
- long-term sequential recommender
- efficient transformer
- recommender systems
- next-item recommendation
- RecBole
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{liu2024linreclinearattentionmechanism,
title={LinRec: Linear Attention Mechanism for Long-term Sequential Recommender Systems},
author={Langming Liu and Xiangyu Zhao and Chi Zhang and Jingtong Gao and Wanyu Wang and Wenqi Fan and Yiqi Wang and Ming He and Zitao Liu and Qing Li},
year={2024},
eprint={2411.01537},
archivePrefix={arXiv},
primaryClass={cs.IR},
doi={https://doi.org/10.1145/3539618.3591717},
url={https://arxiv.org/abs/2411.01537},
}