Abstract
Modern deep neural networks (DNNs) have greatly facilitated the development of sequential recommender systems by achieving state-of-the-art recommendation performance on various sequential recommendation tasks. Given a sequence of interacted items, existing DNN-based sequential recommenders commonly embed each item into a unique vector to support subsequent computations of the user interest. However, due to the potentially large number of items, the over-parameterised item embedding matrix of a sequential recommender has become a memory bottleneck for efficient deployment in resource-constrained environments, e.g., smartphones and other edge devices. Furthermore, we observe that the widely-used multi-head self-attention, though being effective in modelling sequential dependencies among items, heavily relies on redundant attention units to fully capture both global and local item-item transition patterns within a sequence. In this paper, we introduce a novel lightweight self-attentive network (LSAN) for sequential recommendation. To aggressively compress the original embedding matrix, LSAN leverages the notion of compositional embeddings, where each item embedding is composed by merging a group of selected base embedding vectors derived from substantially smaller embedding matrices. Meanwhile, to account for the intrinsic dynamics of each item, we further propose a temporal context-aware embedding composition scheme. Besides, we develop an innovative twin-attention network that alleviates the redundancy of the traditional multi-head self-attention while retaining full capacity for capturing long- and short-term (i.e., global and local) item dependencies. Comprehensive experiments demonstrate that LSAN significantly advances the accuracy and memory efficiency of existing sequential recommenders.
Introduction
Sequential Recommender Systems (SRSs) are designed to predict a user's next interaction based on their historical behavior. While Deep Neural Networks (DNNs) have significantly improved prediction accuracy, they face two major deployment hurdles on edge devices: the memory bottleneck caused by massive item embedding matrices and the computational redundancy of standard multi-head self-attention mechanisms. Popular models like SASRec often assign a unique, high-dimensional vector to every item, which is unsustainable for platforms with millions of items. Furthermore, standard attention heads often struggle to efficiently balance local (recent) and global (long-term) patterns without excessive parameterization.
Methodology: The LSAN Architecture
The Lightweight Self-Attentive Network (LSAN) addresses these challenges through two primary architectural innovations: dynamic compositional embeddings and a twin-attention network.
Dynamic Context-aware Compositional Embedding
Instead of maintaining a massive static embedding table, LSAN utilizes a small set of base embedding tables. An item's representation is dynamically "composed" using a quotient-remainder indexing trick. To capture the intrinsic dynamics of user behavior, LSAN incorporates temporal context (such as item categories or time of day) to weight these base vectors. This allows the model to adapt item representations based on seasonal or situational relevance without increasing the storage footprint.
Twin-Attention Network
To eliminate the redundancy found in standard multi-head self-attention, LSAN employs a "divide and conquer" strategy through two specialized branches:
- Convolution Branch: Utilizes lightweight depth-wise 1D convolutions to capture short-term, local dependencies between adjacent items.
- Self-Attention Branch: Employs an order-aware self-attention mechanism to model long-range, global dependencies across the entire sequence. This specialization allows LSAN to remain shallow—often requiring only a single layer—while outperforming deeper, standard attention models.
Experimental Results
LSAN was evaluated on four benchmark datasets: Amazon Beauty, Toys, Sports, and Yelp. The results consistently showed that LSAN outperforms state-of-the-art baselines like SASRec and BERT4Rec in both accuracy and efficiency.
Key findings from the experiments include:
- Memory Efficiency: On the Beauty dataset, LSAN reduced the parameter count by nearly 40% (1.11M vs. 1.75M for SASRec) while achieving higher accuracy.
- Layer Efficiency: As shown in the sensitivity analysis, LSAN typically reaches peak performance with just one twin-attention layer. Adding more layers can lead to performance degradation, highlighting the efficiency of the specialized architecture.
- Compression Limits: While highly efficient, the model exhibits a "performance cliff" if the base embedding tables are too small (e.g., dimensionality below 64), as the model becomes under-parameterized.
Conclusion
LSAN demonstrates that sequential recommendation can be both highly accurate and memory-efficient. By replacing static, massive embedding tables with dynamic compositional ones and specializing attention heads for local and global patterns, LSAN provides a viable path for deploying state-of-the-art recommenders on resource-constrained edge devices. Future work will focus on evaluating the latency and energy consumption of LSAN on actual smartphone hardware.
Summary updated