TL;DR
The paper introduces PerSRec, a novel framework that compresses long user interaction histories into a few learnable tokens called "personalized experts." By bypassing the quadratic computational bottleneck of transformer-based recommendation models, this method slashes inference costs while fully preserving the high accuracy gains that come with tracking long-term user interests.
What Problem Does This Paper Address?
Modern sequential recommendation models (like Meta's HSTU or LLM-based recommenders) follow a clear scaling law: the longer the user interaction history they can process, the better their recommendations become.
However, there is a massive catch. These models rely on the Transformer architecture, which suffers from a quadratic computational complexity ($O(n^2)$) relative to sequence length. In a real-world production environment serving millions of users, feeding thousands of historical user actions into a Transformer for every single recommendation is computationally prohibitive.
Current workarounds typically use a two-stage approach: heuristically sampling or clustering a user's history down to a shorter sequence before feeding it into the model. Unfortunately, because this compression step is disconnected from the actual recommendation model's training, it often leads to sub-optimal performance.
Methods
The authors propose PerSRec (Personalized Sequential Recommendation), which integrates history compression directly into the sequence modeling process.
Here is how it works:
- Segmentation: A user's long interaction history is divided into chunks or segments (e.g., by session, by day, or by a fixed number of events).
- Compression via Personalized Experts: Instead of keeping all historical item embeddings, a segment decoder compresses each historical segment into a small set of learnable tokens, termed "personalized experts."
- Modified Attention Masking: During training, the model uses a specialized attention mask. Items within a specific historical segment are blocked from attending to other segments, but they can attend to the learnable tokens from previous segments. This forces the learnable tokens to distill and carry forward all necessary historical context.
- Efficient Inference via KV Caching: During inference, old segments don't need to be reprocessed. The activations of the personalized experts are computed once and stored as a Key-Value (KV) cache. To make a new recommendation, the model only processes the most recent uncompressed segment alongside the cached historical tokens.
Datasets
The framework was evaluated on two large-scale sequential recommendation datasets:
- MerRec Dataset: A massive, highly diverse e-commerce dataset from the Mercari C2C platform. The authors filtered this to a subset of 119,756 users who each had at least 2,000 interactions, utilizing the last 2,000 events to evaluate long-sequence performance.
- EB-NeRD (Ekstra Bladet News Recommendation Dataset): A comprehensive news recommendation dataset from a Danish newspaper. The authors selected 44,968 users with at least 512 click interactions.
Key Insights and Ideas
- Information Doesn't Decay Quickly: A key "aha!" moment was discovering that these compressed personalized experts do not rapidly lose relevance. Even when the user's active window slides far past the period when the historical tokens were generated, the compressed tokens continue to provide a powerful accuracy boost. This means the historical cache can be safely reused across multiple inferences over time.
- Simplicity Wins in Token Placement: When experimenting with how to split histories and place learnable tokens, the authors found that simply compressing the entire older "pretrain" block into a single set of tokens right before the recent segment performed better than finer-grained, progressive segment splitting. It gives the model maximum flexibility to figure out how to represent the user's long-term profile.
Key Results
The authors integrated PerSRec into two state-of-the-art architectures: HSTU (a trillion-parameter capable sequential transducer) and HLLM (a hierarchical large language model for recommendation).
- Accuracy Preservation: On the MerRec dataset, while a baseline HSTU model restricted to a short sequence length of 256 achieved a Recall@5 of ~35.5%, expanding the sequence to 1280 boosted it to ~39.8%. PerSRec achieved a virtually identical 39.24% Recall@5 while only needing to process the equivalent of the short 256-length sequence at inference time.
- Computational Savings: For the heavy HLLM architecture, PerSRec delivered an immediate 11.5% reduction in inference time per epoch. For HSTU, theoretical complexity analysis showed that the cost drops to roughly one-quarter ($S \approx 0.238$) of the full-sequence baseline cost.
Limitations and Future Work
While the framework proves highly effective, the authors noted a strange anomaly during token-size scaling: setting the number of learnable tokens ($k$) to exactly 16 consistently yielded the worst performance across their ablations, whereas smaller ($k=1, 2, 4$) or larger ($k=64, 256$) token counts performed optimally. The root cause of this non-linear behavior remains unexplained and is flagged for future study. Additionally, exploring how these personalized experts behave across extremely long temporal gaps (e.g., months or years) remains an open avenue for exploration.
Summary updated