Abstract
Negative sampling plays a crucial role in training successful sequential recommendation models. Instead of merely employing random negative sample selection, numerous strategies have been proposed to mine informative negative samples to enhance training and performance. However, few of these approaches utilize structural information. In this work, we observe that as training progresses, the distributions of node-pair similarities in different groups with varying degrees of neighborhood overlap change significantly, suggesting that item pairs in distinct groups may possess different negative relationships. Motivated by this observation, we propose a Graph-based Negative sampling approach based on Neighborhood Overlap (GNNO) to exploit structural information hidden in user behaviors for negative mining. GNNO first constructs a global weighted item transition graph using training sequences. Subsequently, it mines hard negative samples based on the degree of overlap with the target item on the graph. Furthermore, GNNO employs curriculum learning to control the hardness of negative samples, progressing from easy to difficult. Extensive experiments on three Amazon benchmarks demonstrate GNNO's effectiveness in consistently enhancing the performance of various state-of-the-art models and surpassing existing negative sampling strategies.
Introduction
Sequential Recommendation (SR) models aim to predict the next item a user will interact with based on their historical behavior. To train these models effectively, researchers typically use a contrastive approach: the model is taught to distinguish a "positive" item (the actual next interaction) from "negative" items (items the user did not choose).
While standard approaches rely on uniform random sampling for negatives, this often results in samples that are too "easy" for the model to distinguish, leading to slow convergence and suboptimal performance. Conversely, existing "hard negative mining" strategies often struggle with two issues:
- False Negatives: Some hard negatives are so similar to the target item that they might actually be relevant to the user, even if they don't appear in the training sequence. Treating these as negatives confuses the model.
- Structural Blindness: Most methods focus on local sequences and ignore the global structural relationships between items across the entire dataset.
To address these challenges, we introduce GNNO (Graph-based Negative sampling based on Neighborhood Overlap), a framework that leverages global item transition structures to identify high-quality hard negatives while filtering out potential false negatives.
The GNNO Framework
GNNO consists of three primary components designed to integrate structural intelligence into the negative sampling process.
1. Weighted Item Transition Graph (WITG)
Rather than treating user sequences in isolation, GNNO constructs a global Weighted Item Transition Graph (WITG). In this graph, items are nodes, and edges represent transitions between items within user sequences. Edge weights are determined by the proximity of items; for instance, a 1-hop neighbor in a sequence receives a higher weight than a 3-hop neighbor. This graph captures the collective wisdom of all users, providing a global context that local sequence encoders lack.
2. Neighborhood-based Negative Sampler
The core innovation of GNNO is the use of Jaccard Similarity to measure the overlap between the neighborhoods of two items on the WITG. This allows the sampler to categorize potential negatives into three distinct zones:
- Low Overlap (Easy Negatives): Items with little to no shared neighbors. These are useful for the early stages of training to establish basic item boundaries.
- Medium Overlap (Hard Negatives): The "Goldilocks" zone. These items are structurally related but distinct enough to provide a strong training signal, helping the model learn fine-grained differences.
- High Overlap (False Negatives): Items that share many neighbors are often substitutes or highly similar products. GNNO explicitly filters these out to avoid the "gradient noise" caused by penalizing items that a user might actually like.
3. Curriculum Learning (CL) Scheduler
Training on extremely hard negatives immediately can lead to model instability. GNNO employs a curriculum learning strategy using a "pacing function." The model begins training with easier negatives (low overlap) and gradually introduces harder negatives (medium overlap) as the training epochs progress, ensuring a stable and efficient learning curve.
Experimental Evaluation
Datasets and Baselines
We evaluated GNNO on three widely used Amazon product category benchmarks: Beauty, Toys, and Phone. All datasets were pre-processed using the "5-core" rule to ensure data density. We integrated GNNO with several state-of-the-art sequence encoders, including SASRec, BERT4Rec, and ContraRec, and compared it against popular negative sampling strategies like DNS and MixGCF.
Key Results
GNNO consistently outperformed all baselines across all datasets and metrics.
- Performance Gains: On the Beauty dataset, GNNO achieved an NDCG@5 of 0.3215, significantly surpassing the previous best-performing model, ContraRec (0.3158).
- Model Agnostic: The improvements were consistent regardless of the underlying sequence encoder, demonstrating that neighborhood-based mining is a robust, generalizable enhancement for sequential recommendation.
- Structural Alignment: Pilot experiments indicated that as models train, their internal embeddings naturally align with the graph structure. GNNO accelerates this process by explicitly using the graph structure during the sampling phase.
Conclusion and Future Work
GNNO demonstrates that structural information from a global item transition graph can significantly improve the quality of negative sampling in sequential recommendation. By identifying the "Goldilocks" zone of neighborhood overlap and employing curriculum learning, GNNO avoids the pitfalls of false negatives and easy samples.
Future work will explore dynamic hard negative mining, where the transition graph evolves in real-time as new user data arrives, and investigate methods to reduce the computational overhead of building global graphs for extremely large-scale datasets.
Summary updated