Adaptive Hardness Negative Sampling for Collaborative Filtering

Riwei Lai, Rui Chen, Qilong Han, Chi Zhang, Li Chen

Introduction

Collaborative filtering (CF) using implicit feedback is a cornerstone of modern recommendation systems. However, training these models effectively requires distinguishing between items a user likes and those they haven't interacted with. This process, known as negative sampling, often relies on fixed "hardness" levels, which can lead to significant performance bottlenecks. This paper introduces Adaptive Hardness Negative Sampling (AHNS), a novel paradigm that dynamically adjusts the difficulty of negative samples based on the strength of the positive signal.

The Challenges of Negative Sampling

In recommendation scenarios with implicit feedback (e.g., clicks, views), we lack explicit "dislike" signals. Models are typically trained by picking unobserved items as negative samples and teaching the model to rank them lower than observed positive items. The "hardness" of a negative sample is defined by its current predicted score; a "hard" negative is an item the model incorrectly ranks highly.

Traditional methods suffer from two primary issues:

  1. The False Positive Problem (FPP): Sampling only "easy" negatives prevents the model from learning to demote irrelevant items that initially receive high scores.
  2. The False Negative Problem (FNP): Sampling only "hard" negatives increases the risk of selecting items the user would actually like but hasn't seen yet. Treating these as negatives confuses the model and degrades ranking quality.
Illustration of the False Positive Problem (FPP) and False Negative Problem (FNP) in traditional negative sampling.

The AHNS Paradigm

To address these issues, the authors propose AHNS, governed by three core criteria:

  • C1: Positive-Aware: Negative sample hardness must be relative to the corresponding positive sample.
  • C2: Negative Correlation: A high-confidence positive score should lead to "easier" negative samples to avoid FNP. Conversely, a low positive score necessitates "harder" negatives to combat FPP.
  • C3: Adjustable: The hardness target should be tunable to accommodate diverse dataset characteristics.

The implementation, $AHNS_{p<0}$, utilizes a rating function to select the optimal negative from a candidate set: $$r_m = |e_u^\top e_{i_m} - \beta \cdot (e_u^\top e_{i^+} + \alpha)^{p+1}|$$ By minimizing $r_m$, the algorithm selects a negative sample whose score closely tracks a dynamic target relative to the positive sample $i^+$.

Experimental Evaluation

The researchers evaluated AHNS across four benchmarks with varying densities: MovieLens-1M (dense), and Amazon-Phones, Amazon-Sports, and Amazon-Tools (sparse). These datasets provide a robust testing ground for the algorithm's versatility across different e-commerce categories.

Key Insights: Escaping the Hardness Trap

A critical observation in this work is the "Hardness Trap." As shown in the training dynamics for the Phones dataset, popular methods like DNS and DENS remain "stuck" at a fixed hardness level (approximately 0.3–0.4) throughout training. In contrast, AHNS dynamically "moves the goalposts."

Comparison of average hardness and NDCG@20 performance over training epochs on the Phones dataset.

AHNS acts as a self-correcting mechanism. During early training, it prioritizes harder negatives to accelerate learning. As the model matures and positive scores increase, it shifts toward easier negatives, preventing the False Negative Problem from undermining final ranking performance.

Results and Efficiency

  • Superior Accuracy: $AHNS_{p<0}$ consistently outperformed state-of-the-art baselines like MixGCF and DENS. Notably, on the Amazon-Tools dataset, it achieved a 7.4% improvement in NDCG@50 over the best existing baseline.
  • Stability: Unlike hard-negative samplers that often experience performance drops in late-stage training due to FNP, AHNS maintains high performance, combining the stability of random sampling with significantly higher accuracy.
  • Efficiency: Training time per epoch for AHNS is nearly identical to standard DNS, making it highly practical for real-world deployment without the computational overhead of more complex sampling strategies.

Conclusion and Future Work

AHNS provides a theoretically grounded and empirically successful approach to negative sampling. By proving that AHNS offers a larger lower bound for NDCG compared to fixed-hardness methods, the authors provide a formal justification for adaptive sampling. Future research will explore the interaction of AHNS with complex architectures like Graph Neural Networks (GNNs) and its behavior in extreme cold-start scenarios.

Summary updated

BibTeX
@inproceedings{lai2024adaptive,
  author = {Riwei Lai and Rui Chen and Qilong Han and Chi Zhang and Li Chen},
  title = {{Adaptive Hardness Negative Sampling for Collaborative Filtering}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i8.28709},
}
Figure