Abstract
Understanding user behavior in e-commerce sessions is critical for recommendation and intent prediction. Traditional models often oversimplify sessions as sequences of Item IDs, neglecting rich textual product descriptions and the nuances of specific user actions. We present the User Behavior Model (UBM), a hierarchical Transformer framework that integrates fine-grained product semantics and action-based context. Through a two-stage contrastive pre-training approach, UBM captures both intra-item semantics and inter-interaction dependencies. Experimental results on a large-scale real-world dataset demonstrate that UBM significantly outperforms existing baselines in Next Item Prediction and Purchase Intention Prediction, particularly for rare and new items.
Introduction
In e-commerce, session data represents the digital breadcrumb trail of interactions—searches, clicks, and views—a user performs during a single visit. Accurately modeling this data is essential for personalized recommendations and predicting purchase intent. However, existing approaches face two primary challenges: oversimplification and data sparsity. Most models treat sessions as simple ID sequences, ignoring the rich information in product titles and attributes, as well as the varying intent signaled by different actions (e.g., a "click" signals interest, while an "add-to-cart" signals stronger intent). Furthermore, ID-based models struggle with "cold-start" scenarios where new products lack historical interaction data.
The User Behavior Model (UBM)
The UBM architecture is designed to bridge the gap between product semantics and behavioral nuance using a two-level hierarchical Transformer.
- Interaction Encoder: This level processes "micro" details. It utilizes a BERT-based structure to encode product titles, categories, and attributes alongside "special action tokens" (e.g.,
[SEARCH],[VIEW],[ADD]). This produces a comprehensive embedding for each individual interaction. - Session Encoder: This level captures the "macro" evolution of user interest. It takes the sequence of interaction embeddings and models how user intent shifts across the entire session.
Contrastive Pre-training
To train UBM effectively without extensive manual labeling, the authors employ a two-stage contrastive pre-training strategy. This approach allows the model to learn robust representations by comparing similar and dissimilar session states.
- Stage 1 (Item-level): Focuses on item associations within sessions using techniques like Item Token Masking and Next Item Pairing.
- Stage 2 (Session-level): Focuses on session flow understanding through Behavior Reordering (swapping interactions) and Action/Item Token Masking.
Experimental Results
The model was evaluated using a massive dataset from Shopee, comprising nearly 3 million pre-training sessions. UBM demonstrated substantial improvements over standard baselines:
- Next Item Prediction (NIP): UBM achieved a 28.9% improvement in
hit@10and a 32% increase inMRR@10compared toBERT_mini. - Purchase Intention Prediction (PIP): The model saw a 13.6% improvement in AUROC, highlighting its superior ability to distinguish between casual browsing and serious purchase intent.
- Robustness: By relying on textual semantics rather than fixed IDs, UBM performs exceptionally well on "long-tail" and new items, providing robust "zero-shot" capabilities.
Conclusion
UBM represents a significant step forward in session data understanding by treating text as a universal language for items and actions as contextual modifiers. While the computational cost of training Transformers on rich text is a consideration, the model's adaptability and performance on sparse data make it highly effective for real-world e-commerce applications. Future work may explore higher-quality negative sampling and the integration of multimodal data, such as product images.
Summary updated