Generating Negative Samples for Sequential Recommendation

Yongjun Chen, Jia Li, Zhiwei Liu, Nitish Shirish Keskar, Huan Wang, Julian J. McAuley, Caiming XiongarXiv 2022 · DOI

Introduction

Sequential Recommendation (SR) models predict a user's next interaction based on their historical behavior. These models are typically trained using Noise Contrastive Estimation (NCE) or Bayesian Personalized Ranking (BPR), which rely on "negative" samples—items the user did not interact with—to define the boundaries of user preference. By pulling positive items closer and pushing negative items further away in a latent representation space, the model learns to rank relevant items higher.

The Problem: The Efficiency-Informativeness Trade-off

The standard approach in SR is to sample negative items uniformly from the item catalog. While computationally efficient, this strategy suffers from a major drawback: as the model learns, random negatives become "too easy" to distinguish. For instance, if a user recently purchased a mountain bike, a random negative like a "toaster" provides almost no useful gradient for the model to refine its understanding of cycling preferences.

Informative vs. Random Negatives

As illustrated in Figure 1, an "informative" negative is an item that the model currently mistakenly ranks highly, such as "cycling shoes" or a "bottle holder" for a "water bottle" positive. These hard negatives keep the learning process active by forcing the model to distinguish between closely related items.

The GenNi Framework

To bridge this gap, the authors introduce GenNi (Generating Negative items), a framework designed to be dynamic, adaptive, and computationally efficient. GenNi moves away from static uniform sampling toward an adversarial approach where negatives are generated based on the model's current state.

GenNi Framework Overview

The framework incorporates three primary technical components:

  1. Self-Adversarial Training: GenNi samples negatives based on the current model’s predicted probability. A "hardness" parameter ($\alpha$) is used to tune the difficulty of these samples.
  2. Two-Stage Acceleration: Scoring every item in a million-item catalog is infeasible. GenNi first selects a random subset of items (the $\beta$ ratio) and then performs hard sampling only within that subset. The authors found that a $\beta$ of 0.1 (10% of the catalog) captures 95% of the performance of a full search while reducing costs by 90%.
  3. Self-Adjusted Curriculum Learning: Rather than manual tuning, GenNi uses a curriculum approach. It starts with easier negatives and automatically increases the difficulty ($\alpha$) based on the training loss, ensuring the model is consistently challenged without becoming unstable.

Key Results and Insights

The researchers evaluated GenNi on four major benchmarks: Amazon Sports, Beauty, Toys, and Yelp. The results highlight that the sampling strategy can be as impactful as the model architecture itself:

  • Massive Performance Gains: Replacing uniform sampling with GenNi improved the NDCG@5 of the $S^3$-Rec model by an average of 107.66% and the SASRec model by 96.02%.
  • Solving Gradient Vanishing: In BPR-based models, training often stalls because random negatives become too easy, causing gradients to drop to zero. GenNi keeps gradients "alive" by providing consistently challenging samples.
  • Efficiency: GenNi is significantly faster than previous "hard mining" baselines, running 5x to 13x faster than methods like MMInfoRec.

Conclusion

GenNi demonstrates that adaptive negative sampling is a highly effective way to boost the performance of sequential recommenders. By focusing on informative negatives that challenge the model's current boundaries, GenNi achieves state-of-the-art results while remaining scalable to large-scale production environments. Future research may focus on distinguishing "hard negatives" from "latent positives" (items the user would actually like) and addressing cold-start scenarios.

Summary updated

BibTeX
@misc{chen2022generating,
  author = {Yongjun Chen and Jia Li and Zhiwei Liu and Nitish Shirish Keskar and Huan Wang and Julian J. McAuley and Caiming Xiong},
  title = {{Generating Negative Samples for Sequential Recommendation}},
  year = {2022},
  eprint = {2208.03645},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.03645},
}
Figure