Linear Recurrent Units for Sequential Recommendation

Zhenrui Yue, Yueqi Wang, Zhankui He, Huimin Zeng, Julian J. McAuley, Dong Wang

TL;DR

LRURec (Linear Recurrent Units for Sequential Recommendation) solves the "impossible triangle" of sequential recommendation: balancing training efficiency, inference speed, and predictive performance. By replacing complex self-attention mechanisms with a parallelizable linear recurrence, the authors achieve state-of-the-art accuracy while delivering $O(1)$ incremental inference and significantly faster training convergence.

What Problem Does This Paper Address?

Sequential recommendation aims to predict a user’s next action based on their history. Currently, the field is dominated by Self-Attentive Recommenders (SARs) like SASRec. While SARs are accurate and parallelizable during training, they struggle with inference efficiency. Because self-attention computes weights across the entire sequence, adding a single new user action requires re-computing the whole history ($O(L^2)$ complexity), which is costly for real-time systems.

Older Recurrent Neural Networks (RNNs) like GRU4Rec offer fast, incremental inference ($O(1)$) because they compress history into a hidden state. However, they are notoriously slow to train because their non-linear steps cannot be parallelized. LRURec aims to provide the best of both worlds: the parallel training of Transformers and the lightning-fast inference of RNNs.

Methods

The core innovation is the Linear Recurrent Unit (LRU), which strips away the non-linear activations typically found in RNN hidden-state transitions.

  1. Linear Recurrence: By using a linear transition ($h_t = Ah_{t-1} + Bx_t$), the recurrence can be unrolled into a closed-form summation. This allows the model to calculate all hidden states simultaneously rather than one by one.
  2. Complex Space & Diagonalization: To make the math efficient and stable, the authors perform eigendecomposition on the transition matrix $A$. They represent the system in the complex domain using polar coordinates (magnitude and phase). This ensures numerical stability (keeping magnitudes $< 1$) and allows for highly efficient exponentiation.
  3. Recursive Parallelization: The authors introduce a "divide-and-conquer" algorithm (Algorithm 1) that splits a sequence of length $L$ into subsequences. This reduces the time complexity of the forward pass from $O(L)$ to $O(\log L)$, making it even faster than standard linear scans.
  4. The "Transformer Trimmings": To compensate for the lack of non-linearity in the recurrence, the authors wrap the LRU in components borrowed from the Transformer architecture: Layer Normalization, Residual Connections, and Position-wise Feed-Forward Networks (PFFN).

Datasets

The model was evaluated on six diverse real-world datasets:

  • MovieLens (ML-1M): A classic movie recommendation benchmark.
  • Amazon (Beauty, Video, Sports): Sparse datasets with varying sequence lengths.
  • Steam: A large-scale video game review dataset.
  • XLong: An Alibaba dataset specifically chosen to test long-range dependencies, featuring interaction histories of up to 1,000 items.

Key Insights and Ideas

  • Linearity is Not a Weakness: A common assumption is that recurrence must be non-linear to be powerful. This paper shows that if you place non-linear layers (like the PFFN) around a linear recurrent core, you retain the expressive power while gaining massive efficiency.
  • The Importance of "Recentness": By analyzing the learned decay factors ($\lambda$), the authors found that LRURec naturally learns to prioritize recent items. In shorter sequences (like Amazon Beauty), the model decays history faster than in longer sequences (like ML-1M), providing a mathematical justification for why recurrence works so well for recommendation.
  • Solving the Inference Bottleneck: Unlike SASRec, which gets slower as a user's history grows, LRURec’s cost to process a new click remains constant. This is a "holy grail" for production systems serving millions of users.

Key Results

  • Superior Accuracy: LRURec consistently outperformed state-of-the-art baselines (SASRec, BERT4Rec, FMLP-Rec) across all datasets. It showed an average improvement of 4.39% over the best baseline, with a massive 17.43% jump in NDCG@10 on the Sports dataset.
  • Faster Convergence: In training tests on ML-1M, LRURec reached peak performance in ~23k steps, whereas SASRec took over 50k and GRU4Rec took over 80k.
  • Inference Throughput: For a sequence length of 50, LRURec achieved 7.3× higher throughput than SASRec during incremental inference.
  • Long-Sequence Handling: On the XLong dataset, LRURec outperformed SASRec by a wide margin, proving it can handle "lifelong" user histories better than attention-based models.

Limitations and Future Work

  • Complex Numbers: Implementing models in the complex domain can be non-trivial in some deep learning frameworks and may require specialized kernels for maximum hardware optimization.
  • Hyperparameter Sensitivity: The authors noted that while the model is robust to weight decay, the dropout rate needs careful tuning, especially when moving between dense (MovieLens) and sparse (Amazon) datasets.
  • Future Directions: The authors suggest exploring LRURec for multi-behavior recommendation or integrating it into even larger cross-domain recommendation architectures.

Summary updated

BibTeX
@inproceedings{yue2024linear,
  author = {Zhenrui Yue and Yueqi Wang and Zhankui He and Huimin Zeng and Julian J. McAuley and Dong Wang},
  title = {{Linear Recurrent Units for Sequential Recommendation}},
  booktitle = {WSDM},
  year = {2024},
  doi = {10.1145/3616855.3635760},
}
Figure