StackRec: Efficient Training of Very Deep Sequential Recommender Models by Layer Stacking

Jiachun Wang, Fajie Yuan, Jian Chen, Qingyao Wu, Chengming Li, Min Yang, Yang Sun, Guoxiao Zhang · DOI

Abstract

Deep learning has brought great progress for sequential recommendation (SR) tasks. With advanced network architectures, sequential recommender models can be stacked with many hidden layers, e.g., up to 100 layers on real-world recommendation datasets. Training such a deep network is difficult because it can be computationally expensive and time-consuming, especially with tens of billions of user-item interactions. To address this, we present StackRec, a simple yet effective training framework for deep SR models using iterative layer stacking. We observe that hidden layers in well-trained deep SR models have very similar distributions. Leveraging this, StackRec transfers knowledge from shallower models to deeper ones through stacking operations, enabling much deeper models to be trained more easily. Extensive experiments across four state-of-the-art SR models and three real-world datasets demonstrate that StackRec achieves comparable performance with substantial acceleration in training time compared to training from scratch.

Introduction

Sequential Recommendation (SR) models predict a user's next action based on their historical behavior. As datasets grow to include billions of interactions, these models are becoming increasingly complex. While fields like computer vision have long utilized networks with hundreds of layers, recommendation systems have typically remained shallow, often using fewer than 10 layers.

However, recent evidence suggests that "going deep" can significantly improve recommendation accuracy, particularly on large-scale datasets. As shown in Figure 1, while deeper models may overfit on smaller data subsets, they provide substantial performance gains when trained on full-scale real-world data. The primary obstacle is the prohibitive computational cost and time required to train such massive architectures from scratch.

Performance (MRR@5) and parameter count vs. model depth for 40% and 100% training data.

Methodology: Iterative Stacking

StackRec addresses the training bottleneck through Iterative Stacking. Rather than training a deep model (e.g., 64 blocks/128 layers) directly, the process begins with a shallow model (e.g., 8 blocks). Once the shallow model converges, its learned weights are used to initialize a deeper version. This cycle repeats until the target depth is reached.

The framework employs two primary stacking strategies:

  1. Adjacent-block stacking: Each block from the shallow model is duplicated into two successive positions in the deeper model.
  2. Cross-block stacking: The entire stack of $L$ blocks is copied and appended on top of the original $L$ blocks.

To ensure a smooth transition and prevent "gradient shock," a learnable weight ($\alpha$) is introduced in the residual blocks. Initialized to zero, it ensures that new layers initially function as identity mappings, preserving the shallow model's performance before fine-tuning begins.

Key Insights: Layer Redundancy

The motivation for stacking comes from a critical observation: well-trained deep SR models exhibit high redundancy across layers. Analysis of feature maps reveals that the cosine similarity between adjacent blocks often exceeds 90%.

Cosine similarity heatmaps between hidden blocks for ML20 and Kuaibao datasets, illustrating high inter-layer similarity.

This high similarity suggests that deep models learn incremental transformations, making them ideal candidates for knowledge transfer from shallower counterparts. Stacking acts as a "warm start," providing a superior optimization starting point compared to random initialization.

Experimental Evaluation

The researchers evaluated StackRec using three large-scale datasets: ML20 (MovieLens 20M), Kuaibao (a massive feed recommendation dataset from Tencent), and ColdRec (for cross-domain transfer learning). StackRec was tested across various architectures, including CNN-based (NextItNet) and Transformer-based (SASRec, SSEPT) models.

Results

  • Training Acceleration: StackRec achieved a 35-40% reduction in training time for models trained from scratch and up to a 3.5x speedup in continual learning scenarios.
  • Accuracy Preservation: In nearly all experiments, StackRec-trained models matched or slightly exceeded the performance (MRR@5 and Hit Ratio) of models trained traditionally.
  • Scalability: The framework successfully scaled models up to 128 layers, demonstrating that SR models can indeed benefit from extreme depth when trained efficiently.

Conclusion

StackRec provides a practical framework for building very deep SR models without prohibitive costs. By leveraging layer redundancy through iterative stacking, it achieves significant training speedups while maintaining high recommendation quality. While highly effective for CNN and Attention-based models, future work remains to adapt these techniques for RNN-based architectures and to automate the stacking schedules for optimal growth.

Summary updated

BibTeX
@inproceedings{wang2021stackrec,
  author = {Jiachun Wang and Fajie Yuan and Jian Chen and Qingyao Wu and Chengming Li and Min Yang and Yang Sun and Guoxiao Zhang},
  title = {{StackRec: Efficient Training of Very Deep Sequential Recommender Models by Layer Stacking}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2021},
  url = {https://openreview.net/forum?id=zYKSCzxkEWD},
}
Figure