Scalable Cross-Entropy Loss for Sequential Recommendations with Large Item Catalogs

Gleb Mezentsev, Danil Gusak, Ivan V. Oseledets, Evgeny Frolov

Introduction

Sequential recommendation systems aim to predict a user's next interaction based on their historical behavior. The current gold standard for training these models is Cross-Entropy (CE) loss, which provides a strong learning signal by evaluating predictions against every item in the catalog. However, as item catalogs grow into the millions, CE loss faces a severe scalability bottleneck.

The Scalability Challenge

The primary issue with standard CE loss is its memory footprint. For a catalog of one million items, calculating and storing the scores (logits) for a standard training batch can require over 100GB of GPU memory, far exceeding the capacity of modern hardware like the NVIDIA V100.

Standard Cross-Entropy Loss requires calculating dot products between all input embeddings and catalog items.

To circumvent this, researchers often use Binary Cross-Entropy (BCE) with random negative sampling. While memory-efficient, this approach often degrades recommendation quality because the model rarely encounters "hard negatives"—items that are similar to the target but incorrect—which are crucial for fine-tuning the model's decision boundaries.

Scalable Cross-Entropy (SCE) Methodology

This paper introduces Scalable Cross-Entropy (SCE), a novel loss function that approximates full CE by focusing on the most informative items while maintaining a fixed, GPU-friendly memory profile.

Overview of Scalable Cross-Entropy (SCE) compared to standard CE, highlighting the randomized bucketing and localized dot product calculation.

Randomized Bucketing and the "Mix" Operation

SCE utilizes a GPU-efficient version of Maximum Inner Product Search (MIPS). It generates random "bucket center" vectors and assigns both user states and item embeddings to these buckets based on their similarity. To prevent "bucket collapse" and ensure a diverse selection of items, the authors introduce a "Mix" operation. This projects model outputs onto random directions to identify informative spatial features, effectively regularizing the model.

GPU-Centric Design

Unlike previous MIPS-based approaches that produce variable-sized outputs, SCE ensures every bucket is the same size. This design choice allows the entire loss calculation to be performed using highly optimized batch matrix multiplications, maximizing GPU utilization.

Performance and Key Results

The researchers evaluated SCE on several real-world datasets, including BeerAdvocate, Kindle Store, and Yelp. The results demonstrate that SCE matches or exceeds the accuracy of full CE while providing significant efficiency gains:

  • Memory Efficiency: SCE achieved 7.8x to 100.2x reduction in peak memory usage across major datasets.
  • Training Speed: Training was 2.5x to 6.7x faster than high-performing baselines.
  • Recommendation Quality: On the Amazon Beauty benchmark, models trained with SCE outperformed state-of-the-art complex models like DuoRec and FEARec, improving NDCG@10 by up to 17.6% when constrained to the same memory budget as competitors.

Insights and Future Directions

A key insight from the study is that hard negatives are essential for high-quality recommendations. SCE succeeds because it effectively "mines" these negatives. Interestingly, for smaller catalogs (under 40k items), the authors found that full CE is actually more memory-efficient than traditional negative sampling due to the overhead of storing sample embeddings.

The randomization inherent in the "Mix" operation also acts as a form of regularization, occasionally allowing SCE to outperform full CE. Future work will focus on addressing challenges related to dataset sparsity and refining hyperparameter tuning for bucket sizes. Additionally, the authors plan to investigate methods to account for "false negatives"—items a user might like but has not yet encountered—to further improve the robustness of the learning signal.

Summary updated

BibTeX
@inproceedings{mezentsev2024scalable,
  author = {Gleb Mezentsev and Danil Gusak and Ivan V. Oseledets and Evgeny Frolov},
  title = {{Scalable Cross-Entropy Loss for Sequential Recommendations with Large Item Catalogs}},
  booktitle = {RecSys},
  year = {2024},
  doi = {10.1145/3640457.3688140},
}
Figure