UserBERT: Contrastive User Model Pre-training

Chuhan Wu, Fangzhao Wu, Yang Yu, Tao Qi, Yongfeng Huang, Xing XiearXiv 2021

Abstract

User modeling is critical for personalized web applications. Existing user modeling methods usually train user models from user behaviors with task-specific labeled data. However, labeled data in a target task may be insufficient for training accurate user models. Fortunately, there are usually rich unlabeled user behavior data which encode rich information of user characteristics and interests. Thus, pre-training user models on unlabeled user behavior data has the potential to improve user modeling for many downstream tasks. In this paper, we propose a contrastive user model pre-training method named UserBERT. Two self-supervision tasks are incorporated in UserBERT for user model pre-training on unlabeled user behavior data to empower user modeling. The first one is masked behavior prediction, which aims to model the relatedness between user behaviors. The second one is behavior sequence matching, which aims to capture the inherent user interests that are consistent in different periods. In addition, we propose a medium-hard negative sampling framework to select informative negative samples for better contrastive pre-training. We maintain a synchronously updated candidate behavior pool and an asynchronously updated candidate behavior sequence pool to select the locally hardest negative behaviors and behavior sequences in an efficient way. Extensive experiments on two real-world datasets in different tasks show that UserBERT can effectively improve various user models.

Introduction

Personalized web applications, ranging from news recommendation to targeted advertising, rely heavily on accurate user modeling. Traditionally, these models are trained using task-specific labeled data. However, collecting and annotating such data is often expensive and time-consuming, frequently resulting in datasets that are too small to capture the full complexity of user interests.

Fortunately, web platforms generate massive amounts of unlabeled user behavior data, such as search queries and browsing histories, which encode rich information about user characteristics. While recent NLP-inspired pre-training methods have attempted to exploit this data, they often struggle with the inherent noise and randomness of human browsing. UserBERT addresses these challenges through a contrastive pre-training framework that leverages two complementary self-supervision tasks and a novel negative sampling strategy to build robust, generalizable user models.

Methodology

UserBERT utilizes a hierarchical user model architecture consisting of a Behavior Encoder and a User Encoder. The Behavior Encoder transforms individual actions (e.g., browsing a webpage) into embeddings, while the User Encoder aggregates these into a unified user representation.

Self-Supervised Pre-training Tasks

To capture both short-term behavior patterns and long-term interests, UserBERT employs two primary tasks:

  1. Masked Behavior Prediction (MBP): Inspired by BERT's masked language modeling, this task randomly masks a portion of a user's behavior sequence. The model must predict the masked behaviors based on the surrounding context, forcing it to learn the short-term relatedness between specific user actions.
  2. Behavior Sequence Matching (BSM): This task presents the model with two non-overlapping behavior sequences from different time periods. The model must determine if they belong to the same user. This encourages the model to identify stable, inherent user interests that persist over time, making it more robust to the noise of individual clicks.
Overview of the two self-supervision tasks: Masked Behavior Prediction (MBP) and Behavior Sequence Matching (BSM).

Medium-Hard Negative Sampling

The effectiveness of contrastive learning depends heavily on the quality of negative samples. Randomly selected negatives are often too easy for the model to distinguish, providing little learning signal. Conversely, "globally hardest" negatives can be counterproductive, as they are often semantically identical to the positive sample (e.g., two nearly identical news headlines), leading to noisy labels.

UserBERT introduces a medium-hard negative sampling framework. It maintains a restricted "candidate pool" of behaviors and sequences. The model selects the "locally hardest" samples from this pool—those that are most similar to the positive sample within the restricted set. To maintain efficiency, the behavior pool is updated synchronously, while the more complex sequence pool is updated asynchronously (e.g., every 50 steps).

The medium-hard negative sampling framework, illustrating the selection of informative negative candidates from synchronously and asynchronously updated pools.

Experimental Evaluation

Datasets and Tasks

The model was pre-trained on an unlabeled dataset of 500,000 Bing users containing over 63 million browsing behaviors. Evaluation was conducted on two downstream tasks:

  • News Recommendation: Predicting future news clicks based on browsing history using a Microsoft News dataset.
  • Ad CTR Prediction: Predicting ad click-through rates based on ad text and browsing history.

Key Results

UserBERT consistently outperformed state-of-the-art pre-training baselines like PTUM and Contrastive Pre-training (CP) across all metrics:

  • Performance Gains: In news recommendation, UserBERT improved AUC from 61.02 to 62.56. In Ad CTR prediction, it improved AUC from 72.99 to 73.96.
  • Data Efficiency: The benefits of UserBERT were most significant when labeled data was scarce. A model pre-trained with UserBERT using only 10% of labeled data often approached the performance of non-pre-trained models using 25% or more of the data.
  • Task Complementarity: Ablation studies showed that MBP and BSM provide complementary signals; MBP captures local context, while BSM captures global interest consistency.

Conclusion

UserBERT demonstrates that contrastive pre-training on unlabeled behavior data can significantly enhance user modeling for personalized applications. By combining masked behavior prediction with behavior sequence matching and utilizing a "Goldilocks" approach to negative sampling, the framework effectively filters noise and captures the stable underlying interests of users. Future work may explore adaptive methods for managing candidate pools to further optimize the balance between computational efficiency and sample hardness.

Summary updated

BibTeX
@misc{wu2021userbert,
  author = {Chuhan Wu and Fangzhao Wu and Yang Yu and Tao Qi and Yongfeng Huang and Xing Xie},
  title = {{UserBERT: Contrastive User Model Pre-training}},
  year = {2021},
  eprint = {2109.01274},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.01274},
}
Figure