USE: Dynamic User Modeling with Stateful Sequence Models

Zhihan Zhou, Qixiang Fang, Leonardo Neves, Francesco Barbieri, Yozen Liu, Han Liu, Maarten W. Bos, Ron DotscharXiv 2024 · DOI

Abstract

Personalization systems rely on user embeddings to represent interests and habits. However, traditional stateless models like Transformers face a "recompute tax" when updating embeddings with new user actions. This paper introduces USE (User Stateful Embedding), a framework utilizing the Retentive Network (RetNet) to maintain a persistent user state. USE enables constant-time updates while preserving long-term historical context. Evaluated on Snapchat behavioral logs, USE demonstrates superior performance and efficiency across diverse downstream tasks compared to existing stateless architectures.

Introduction: The Recompute Tax in Personalization

In modern applications, user behavior is a continuous stream rather than a static snapshot. To provide effective recommendations or detect fraudulent activity, systems utilize user embeddings—mathematical vectors representing a user's interests and habits. The primary challenge lies in "Dynamic User Modeling": keeping these profiles up-to-date without incurring prohibitive computational costs.

Most current state-of-the-art models, such as Transformers, are stateless and operate within a fixed context window. When a user performs new actions, these systems typically face three suboptimal choices: discarding old data to maintain speed (Recent Only), processing the entire history (Recompute All), or averaging embeddings (Pooling). The latter often results in significant information loss, while the former two sacrifice either accuracy or scalability.

Comparison of stateless and stateful user modeling strategies across performance, efficiency, and versatility metrics.

Methodology: Stateful Embeddings with RetNet

The USE framework addresses these limitations by employing the Retentive Network (RetNet). RetNet combines the parallel training capabilities of Transformers with the efficient, recurrent inference of RNNs. This allows USE to maintain a persistent "state"—a summary of past behaviors—that can be updated with new events in $O(1)$ constant time.

To optimize these embeddings, the authors introduce two novel training objectives:

  • Future $W$-Behaviors Prediction (FBP): Instead of predicting the exact next action, which is often noisy in human behavior, USE predicts a "bag of behaviors" likely to occur within a future window ($W$). This encourages the model to capture broader intent.
  • Same User Prediction (SUP): A contrastive learning task where the model learns to associate non-overlapping behavior segments from the same user. This helps distinguish between temporary behavioral states and permanent user traits.

Experimental Results

The researchers evaluated USE using Snapchat behavioral logs, comprising 685 distinct behaviors and over 766,000 sequence pairs. The model was tested against established baselines, including GPT-2 style Transformers (Trans-CLM) and traditional TF-IDF methods, across eight downstream tasks such as User Retrieval (UR) and Future Behavior Prediction (FBP).

Performance comparison of USE against baseline models across multiple downstream tasks, showing significant gains in User Retrieval and overall average performance.

Key findings include:

  • Superior Performance: USE achieved a Mean Reciprocal Rank (MRR) of 47.4 in User Retrieval, significantly outperforming the 33.2 achieved by the Trans-CLM baseline.
  • Dynamic Efficiency: In simulations of real-world app usage over 16 periods, USE consistently outperformed "Pool Embeddings" and "Recent Only" strategies, proving that its internal state carries more useful historical information than simple averaging.
  • Scalability: While "Recompute All" strategies saw linear growth in computational costs as user history expanded, USE maintained a flat, constant time cost for updates.

Conclusion

USE represents a significant step forward in scalable personalization. By leveraging stateful architectures like RetNet and robust training objectives like FBP and SUP, it resolves the tension between historical depth and computational efficiency. Future work may extend this framework to multi-modal data, incorporating text and images to further enrich dynamic user representations.

Summary updated

BibTeX
@misc{zhou2024use,
  author = {Zhihan Zhou and Qixiang Fang and Leonardo Neves and Francesco Barbieri and Yozen Liu and Han Liu and Maarten W. Bos and Ron Dotsch},
  title = {{USE: Dynamic User Modeling with Stateful Sequence Models}},
  year = {2024},
  eprint = {2403.13344},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.13344},
}
Figure