Abstract
Modern recommender systems often struggle to incorporate long-term user behavior sequences due to the computational complexity of self-attention and the vanishing gradient issues of recurrent architectures. This paper introduces the Sparse Attentive Memory (SAM) network, a novel framework designed to model user sequences exceeding 1,000 items with linear $O(L)$ complexity. By utilizing a dual-query attention mechanism and iterative memory updates, SAM captures complex intra-sequence dependencies and long-term interests. Experimental results on massive industrial datasets from Alibaba demonstrate a 7.3% improvement in Click-Through Rate (CTR) and a significant increase in recommendation diversity, all while maintaining the strict latency requirements of real-time production environments.
Introduction
In the domain of e-commerce, Click-Through Rate (CTR) prediction serves as the primary engine for personalized recommendations. To accurately predict a user's next action, models must analyze their historical behavior. However, most industrial models are "short-sighted," typically truncating user history to the most recent 50 to 100 actions. This limitation ignores the rich, long-term patterns that define a user's evolving preferences over months or years.
Expanding the sequence length presents two primary challenges. First, modeling difficulty: Recurrent Neural Networks (RNNs) and LSTMs often fail to retain information from the beginning of very long sequences. Second, computational cost: The Transformer architecture, while effective at capturing dependencies, relies on a self-attention mechanism with quadratic $O(L^2)$ complexity. For sequences of 1,000 items or more, the memory and compute requirements become prohibitive for real-time systems that must respond in milliseconds.
The Sparse Attentive Memory (SAM) Framework
The SAM network bypasses the quadratic bottleneck by introducing a more efficient way to capture intra-sequence relationships. The architecture is built around three core components:
1. Point-wise Dual-query Attention (PDA)
Unlike standard self-attention where every item in the history attends to every other item, SAM employs a dual-query approach. It uses two specific vectors to query the sequence: the target item (the candidate item being scored) and a memory vector (a compressed representation of the user's long-term interests). This reduction transforms the complexity from $O(L^2)$ to linear $O(L)$, making it feasible to process thousands of items.
2. Iterative Memory Update
To construct a high-quality summary of the user's history, SAM performs iterative "passes" (typically three) over the sequence. In each pass, the model uses the current memory state to extract relevant information from the sequence, then updates that state using a Gated Recurrent Unit (GRU). Because these passes are performed on the entire sequence simultaneously, they are highly parallelizable and "GPU-friendly," avoiding the slow, step-by-step nature of traditional RNNs.
3. Memory Enhancement
A final refinement module compares the updated memory vector against the target item. This step filters out "noise"—irrelevant past behaviors that do not relate to the current context—ensuring that the final prediction is based on the most pertinent historical evidence.
Experimental Evaluation
The researchers evaluated SAM using both public benchmarks and large-scale industrial data:
- Public Benchmarks: Amazon Books and Movies datasets were used to ensure reproducibility and baseline comparison.
- Alibaba Industrial Dataset: This gargantuan dataset includes 1.68 billion training samples and a test set of 57 million points, representing the scale and noise of real-world e-commerce.
Key Results
- Accuracy and Impact: SAM consistently outperformed established baselines such as DIN, DIEN, and SASRec. In live A/B testing on one of the world's largest e-commerce platforms, SAM delivered a 7.30% increase in CTR.
- Efficiency: Despite the long sequences, SAM's forward pass takes only 3.6ms. The total system latency remains under 30ms, meeting the rigorous demands of industrial deployment.
- Diversity: Beyond accuracy, the model increased the diversity of clicked items (measured by TCIC) by over 15%. This suggests that long-term memory allows the system to move beyond immediate trends and rediscover a user's broader range of interests.
Discussion and Insights
One of the primary insights of this work is the "Target as a Query" philosophy. By treating the target item as a search query to find relevant facts in a long history, SAM functions similarly to a Question-Answering (QA) system. Furthermore, the dual-query system enables the model to capture co-occurrence effects. For instance, if a user's history contains both "lime" and "peppermint," the model can more accurately predict an interest in "rum" (the Mojito effect), a multi-item relationship often missed by simpler attention models.
Limitations and Future Work
While SAM solves the computational bottleneck, it introduces a "storage wall." Storing 1,000+ behaviors for millions of users requires specialized infrastructure; the authors utilized an internal graph storage system to manage 350GB of online sequence data. Additionally, while the model was tested up to 16,000 items, the optimal balance of performance and cost was found at 1,000 items. Future research may explore hierarchical memory structures to push these boundaries even further, as well as methods to improve the "cold start" performance for users with limited history.
Summary updated