[Paper Review] Mamba4Rec: Towards Efficient Sequential Recommendation with Selective State Space Models
Mamba4Rec uses selective state space models (SSMs) to achieve Transformer-level performance with higher efficiency for sequential recommendation, outperforming RNN- and Transformer-based baselines on public datasets.
Sequential recommendation aims to estimate the dynamic user preferences and sequential dependencies among historical user behaviors. Although Transformer-based models have proven to be effective for sequential recommendation, they suffer from the inference inefficiency problem stemming from the quadratic computational complexity of attention operators, especially for long behavior sequences. Inspired by the recent success of state space models (SSMs), we propose Mamba4Rec, which is the first work to explore the potential of selective SSMs for efficient sequential recommendation. Built upon the basic Mamba block which is a selective SSM with an efficient hardware-aware parallel algorithm, we design a series of sequential modeling techniques to further promote model performance while maintaining inference efficiency. Through experiments on public datasets, we demonstrate how Mamba4Rec effectively tackles the effectiveness-efficiency dilemma, outperforming both RNN- and attention-based baselines in terms of both effectiveness and efficiency. The code is available at https://github.com/chengkai-liu/Mamba4Rec.
Motivation & Objective
- Address the efficiency-performance gap in sequential recommendation models.
- Introduce selective SSMs for sequential modeling in recommendation.
- Enhance Mamba with embedding techniques, normalization, and feed-forward components to boost performance.
- Demonstrate efficiency gains (memory, training, inference) over RNN/Transformer baselines on public datasets.
Proposed method
- Adopts a Mamba block (selective SSM with hardware-aware parallelism) as the core unit.
- Builds Mamba4Rec as stacked Mamba layers with a position-wise feed-forward network (PFFN).
- Uses an embedding layer with dropout and layer normalization.
- Incorporates optional positional embeddings to study their impact in SSM-based modeling.
- Prediction layer mirrors SASRec by using the last item embedding to generate next-item scores.
- Performs ablation studies to assess the impact of position embeddings, layer normalization, PFFN, Mamba block vs block+PFFN, and layer stacking.

Experimental results
Research questions
- RQ1Can selective SSMs provide competitive or superior accuracy for sequential recommendation compared to RNNs and Transformers?
- RQ2Do selective SSM-based models offer efficiency benefits (memory, training time, inference time) on long sequences?
- RQ3What is the impact of embedding strategies, normalization, and feed-forward components on Mamba4Rec’s performance?
- RQ4How does stacking multiple Mamba layers affect accuracy and efficiency in long-sequence settings?
Key findings
- Mamba4Rec achieves superior performance compared with RNN- and Transformer-based baselines across datasets with varying sparsity and sequence lengths.
- On MovieLens-1M, Mamba4Rec outperforms SASRec and BERT4Rec, particularly with longer sequences.
- Mamba4Rec is more efficient, using less GPU memory and faster per-epoch training and per-batch inference than SASRec and BERT4Rec on MovieLens-1M.
- A single Mamba layer often suffices for good performance, while stacking layers with residual connections can improve performance at the cost of efficiency.
- Ablation shows positional embeddings do not help much, layer normalization and dropout are beneficial, and the PFFN notably aids longer sequences.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.