Pre-trained Language Model and Knowledge Distillation for Lightweight Sequential Recommendation

Li Li, Mingyue Cheng, Zhiding Liu, Hao Zhang, Qi Liu, Enhong ChenarXiv 2024 · DOI

Introduction

Sequential recommendation (SR) is a critical task in modern e-commerce and content platforms. It involves predicting a user's future interests by analyzing their chronological sequence of interactions. For instance, if a user has recently purchased headphones and a smartphone, a recommendation system might predict they are looking for a screen protector next.

Sequential recommendation predicts the next item in a user's interaction history.

While traditional models have made significant strides, they often struggle with data sparsity, where limited interaction data makes it difficult to learn complex user patterns. Large Pre-trained Language Models (PLMs) like BERT offer a potential solution due to their ability to capture deep semantic relationships. However, their massive computational requirements make them impractical for real-time industrial applications where millisecond latency is required.

Proposed Framework: PreBERT and Mini-BERT

To address the trade-off between accuracy and efficiency, researchers proposed a two-stage framework combining domain-specific pre-training with knowledge distillation.

Stage 1: Domain Transfer (PreBERT)

The first stage involves adapting a standard 12-layer BERT model for the recommendation domain. Since BERT is designed for text, the researchers employed a random mapping strategy to represent Item IDs as tokens. This "PreBERT" model is then fine-tuned on recommendation datasets using a Masked Language Model (MLM) objective, effectively learning the "grammar" of user behavior sequences.

Stage 2: Knowledge Distillation (Mini-BERT)

To achieve the speed necessary for production, the knowledge from the heavy PreBERT (teacher) is distilled into a lightweight "Mini-BERT" (student). Mini-BERT is a significantly smaller 2-layer model. During the distillation process, the student model is trained to minimize two types of loss:

  1. Hard Target Loss: The standard cross-entropy loss against the ground-truth labels.
  2. Soft Target Loss: A loss that encourages the student to mimic the full probability distribution produced by the teacher model (PreBERT).
The two-stage framework: PreBERT (teacher) transfers knowledge to Mini-BERT (student) via soft target distillation.

This approach allows the compact student model to inherit the complex reasoning and generalization capabilities of the much larger teacher.

Experimental Evaluation

The framework was tested on three diverse datasets: MovieLens (ML-1M), Steam, and YooChoose-Buys.

Key Results

  • Performance Gains: The teacher model, PreBERT, significantly outperformed state-of-the-art baselines like SASRec and BERT4Rec. On the ML-1M dataset, it achieved a 17.15% improvement in Hit Ratio (HR@10).
  • Efficiency of Distillation: The distilled Mini-BERT maintained a high level of performance despite its reduced size. Remarkably, the 2-layer Mini-BERT outperformed the standard 12-layer BERT4Rec model in most scenarios, demonstrating that the distillation process provides a superior training signal compared to standard supervised learning.
  • Robustness: The model proved stable across various random mappings of items to tokens, suggesting it is a robust solution for different recommendation environments.

Conclusion and Future Directions

This research demonstrates that PLMs can be effectively adapted for sequential recommendation without sacrificing real-time performance. By using knowledge distillation, developers can deploy models that are both "smart" (leveraging large-scale pre-training) and "fast" (using lightweight architectures). Future work may explore more advanced distillation techniques, such as feature-based distillation, to further bridge the gap between teacher and student performance.

Summary updated

BibTeX
@misc{li2024pre,
  author = {Li Li and Mingyue Cheng and Zhiding Liu and Hao Zhang and Qi Liu and Enhong Chen},
  title = {{Pre-trained Language Model and Knowledge Distillation for Lightweight Sequential Recommendation}},
  year = {2024},
  eprint = {2409.14810},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.14810},
}
Figure