Introduction
Sequential recommendation systems aim to predict a user's next interaction based on their historical behavior. The Cross-Entropy (CE) loss is widely considered the "gold standard" for training models like SASRec or BERT4Rec due to its superior accuracy. However, CE loss faces a significant scalability challenge: the "memory wall." It requires computing and storing logits for every item in the catalog at every step of a user's sequence. As catalogs grow to hundreds of thousands or millions of items, the memory requirements for these activations become prohibitive.
To circumvent this, researchers often use negative sampling. While memory-efficient, simple sampling often misses "hard negatives"—items similar to the target that are critical for learning fine-grained distinctions. RECE (REduced Cross-Entropy) is a novel loss function designed to bridge this gap, providing the performance of full CE loss with the memory efficiency of sampling methods.
The RECE Method
The core innovation of RECE is an approximation of the full softmax distribution that focuses on the most informative items using a GPU-friendly hashing approach. Instead of a full matrix multiplication, RECE identifies "hard negatives" through an approximate Maximum Inner Product Search (MIPS) based on Locality-Sensitive Hashing (LSH).
The RECE pipeline consists of three primary stages as illustrated below:
- Bucketing and Sorting: User states and item embeddings are assigned to buckets based on proximity to random vectors. The data is then sorted by bucket indices to ensure that similar items and user states are contiguous in memory.
- Chunking: The sorted sequence is divided into fixed-size chunks.
- Selective Calculation: Scalar products (logits) are computed only for items within the same or adjacent chunks.
By focusing computation on these chunks, RECE captures the gradients of "hard negatives" while ignoring millions of "easy negatives" that contribute negligibly to model updates. This approach leverages the parallel processing power of GPUs through efficient sorting and chunking operations.
Experimental Results
The authors evaluated RECE across four diverse datasets: BeerAdvocate (22k items), Behance (32k items), Amazon Kindle Store (96k items), and Gowalla (173k items).
Memory and Speed Efficiency
RECE demonstrates remarkable efficiency gains. On the Kindle Store dataset, it achieved a 12x reduction in peak memory usage compared to standard CE. On the Gowalla dataset, memory usage was reduced by 6.6x. Furthermore, by avoiding massive matrix multiplications, RECE trained up to 6.7x faster than competing high-performance baselines.
Recommendation Quality
Despite the approximation, RECE maintains or improves upon the accuracy of full CE. On the Gowalla dataset, RECE outperformed the next best method by 8.19% in NDCG@10. When compared against state-of-the-art complex models like CBiT and DuoRec on the Amazon Beauty dataset, a simple SASRec model using RECE loss achieved dominant performance, proving that a better loss function can be more impactful than architectural complexity.
Conclusion
RECE successfully addresses the memory bottleneck of Cross-Entropy loss in large-scale recommendation. By intelligently selecting hard negatives through a GPU-optimized LSH process, it enables high-quality training on massive catalogs within standard hardware constraints. Future research may explore automated hyperparameter tuning for chunk sizes and the application of RECE to other domains with large output spaces, such as large-scale classification in computer vision or natural language processing.
Summary updated