Introduction
Sequential Recommendation (SR) models, such as SASRec and BERT4Rec, are essential components of modern digital platforms. However, as item catalogs scale into the millions, these models encounter a critical performance barrier known as the Logit Bottleneck. In the final cross-entropy layer, the system must compute scores for every item in the catalog to identify the next likely interaction. For a catalog of 1 million items, a typical training batch can require over 100GB of memory—far exceeding the capacity of standard industrial GPUs like the NVIDIA A100.
While negative sampling is a common workaround, standard implementations in frameworks like PyTorch often suffer from slow execution or still materialize large intermediate tensors. This paper introduces $CCE^-$ (Cut-Cross-Entropy with negative sampling), a GPU-efficient implementation designed to break the memory wall and accelerate training without compromising accuracy.
Methods: Breaking the Logit Bottleneck
$CCE^-$ achieves its efficiency through a combination of low-level hardware optimizations and algorithmic refinements:
- Fused Triton Kernels: By using the Triton language, the authors "fuse" matrix multiplication and softmax operations. This keeps data within fast, on-chip SRAM, avoiding the need to write massive intermediate tensors to slower global memory.
- Chunked Processing: Inspired by techniques in Large Language Models (LLMs), $CCE^-$ processes hidden states in smaller chunks, drastically reducing the peak memory footprint.
- Gradient Filtering: The authors observed that in large-scale recommendation, gradients for most incorrect items are effectively zero. $CCE^-$ skips computations for these items, providing a "free" speedup during the backward pass.
- Integrated Negative Sampling: Negative sampling is integrated directly into the fused kernel, ensuring only the necessary columns of the weight matrix are loaded and processed.
Experimental Evaluation
The researchers evaluated $CCE^-$ across six datasets, including standard benchmarks (MovieLens-20M, Beauty, Gowalla) and massive industrial catalogs (30Music, Zvuk with 893k items, and MegaMarket with 1.6M items).
Key Results and Insights
1. Massive Speedup and Memory Efficiency
$CCE^-$ accelerates training by up to 2x compared to standard PyTorch implementations and reduces peak memory usage by more than 10x. For instance, on the Beauty dataset, memory requirements dropped from over 50GB to approximately 2.5GB.
2. The Hyperparameter Reallocation
A core finding of the paper is that memory savings can be reinvested into other hyperparameters. By reallocating memory from the logit layer to larger batch sizes or longer sequence lengths, the authors achieved up to a 30% improvement in NDCG@10 within the same hardware budget. As shown in the Megamarket results (Figure 1), the optimized $CCE^-$ configuration (red) delivers significantly higher accuracy and faster epoch times than the baseline Cross-Entropy (blue).
3. Exploiting Gradient Sparsity
The model naturally learns to ignore irrelevant items, leading to sparse gradient matrices. $CCE^-$ exploits this feature via filtering, which accelerates the training process without degrading the final recommendation quality.
Conclusion
$CCE^-$ addresses the primary scaling challenge in sequential recommendation. By co-designing the algorithm with GPU hardware constraints in mind, the authors provide a path for training high-accuracy models on massive catalogs using standard hardware. Future work will look into adapting these fused kernels for more complex sampling strategies, such as popularity-biased sampling, and implementing adaptive thresholds for gradient filtering.
Summary updated