Efficient On-Device Session-Based Recommendation

Xin Xia, Junliang Yu, Qinyong Wang, Chaoqun Yang, Nguyen Quoc Viet Hung, Hongzhi Yin

Abstract

Session-based recommendation (SBR) models, such as Transformers and Graph Neural Networks, are typically deployed on powerful cloud servers due to their large memory footprints and computational demands. Deploying these models directly on-device is desirable for privacy and low latency but is hindered by the "memory wall" of large item embedding tables and the "inference bottleneck" of complex decompression techniques. This paper introduces EODRec, a framework designed for efficient on-device SBR. By employing a summation-based compositional encoding and a bidirectional self-supervised knowledge distillation strategy, EODRec achieves a 30x reduction in model size and an 8x boost in inference speed, often outperforming the original uncompressed models.

Introduction

Session-based recommendation (SBR) aims to predict a user's next action based on their current short-term activity. While state-of-the-art models excel at this task, their deployment on mobile devices faces two major hurdles:

  1. The Memory Wall: Item embedding tables, which assign a unique vector to every product, often exceed the RAM capacity of mobile devices in large-scale catalogs.
  2. The Inference Bottleneck: Existing compression methods like Tensor-Train Decomposition (TTD) require heavy matrix multiplications to reconstruct embeddings during inference, leading to high latency and battery drain.

Methodology

EODRec addresses these challenges through two primary innovations: compositional encoding for efficiency and bidirectional distillation for accuracy.

Overview of the EODRec framework, including the base SASRec architecture (a), the next-item prediction task with teacher-student distillation (b), and the self-supervised knowledge distillation component (c).

1. Compositional Encoding

To overcome the memory wall without sacrificing speed, EODRec replaces massive embedding tables with a compositional encoding method. Each item is represented by a short sequence of discrete codes. The system maintains several small "codebooks." To retrieve an item's embedding, the model looks up the vectors corresponding to its codes and performs a simple summation. This approach is significantly faster than multiplication-heavy alternatives like TTD. To ensure the system remains trainable, the authors utilize the Gumbel-Softmax trick, making the discrete code-learning process differentiable.

2. Bidirectional Self-Supervised Knowledge Distillation (BSSKD)

To mitigate the accuracy loss typically associated with model compression, EODRec employs a novel Knowledge Distillation (KD) strategy. Unlike standard KD, where a large "teacher" model unilaterally trains a "student," EODRec uses a bidirectional approach. This allows the compact student model to influence the teacher, capturing patterns that the larger model might overlook.

Furthermore, the framework incorporates Self-Supervised Knowledge Distillation. Sessions are partitioned into "hot" (popular) and "cold" (niche) items. By swapping these representation segments between the teacher and student during training, the model is forced to learn more robust item relationships, particularly for the "long tail" of less frequent items.

Evaluation and Results

The researchers evaluated EODRec on two major e-commerce benchmarks: Tmall and RetailRocket.

Key Findings

  • Efficiency: EODRec achieved an 8x speedup in generating recommendations compared to previous state-of-the-art on-device models like OD-Rec.
  • Compression: The model size was reduced by up to 30x compared to the uncompressed SASRec base model.
  • Accuracy: Remarkably, the compressed student model frequently achieved higher Precision and NDCG scores than the original teacher model.
  • Generalization: The framework proved effective across various architectures, including RNN-based (NARM) and Graph-based (SR-GNN) models.

Conclusion and Future Work

EODRec demonstrates that high-performance recommendation is possible on resource-constrained devices by prioritizing additive operations over multiplicative ones and leveraging bidirectional distillation. While the current framework excels at inference, future work will focus on on-device updates. Updating models with new items without full cloud-to-device synchronization remains a challenge, with "module grafting" proposed as a potential solution to allow for energy-efficient local adaptation.

Summary updated

BibTeX
@article{xia2022efficient,
  author = {Xin Xia and Junliang Yu and Qinyong Wang and Chaoqun Yang and Nguyen Quoc Viet Hung and Hongzhi Yin},
  title = {{Efficient On-Device Session-Based Recommendation}},
  journal = {ACM Trans. Information Systems},
  year = {2022},
}
Figure