Can LLM-Driven Hard Negative Sampling Empower Collaborative Filtering? Findings and Potentials

Chu Zhao, Enneng Yang, Yuting Liu, Jianzhe Zhao, Guibing Guo, Xingwei Wang · OpenReview

Abstract

Hard negative samples can accelerate model convergence and optimize decision boundaries, which is key to improving the performance of recommender systems. Although large language models (LLMs) possess strong semantic understanding and generation capabilities, systematic research has not yet been conducted on how to generate hard negative samples effectively. To fill this gap, this paper introduces the concept of Semantic Negative Sampling and explores how to optimize LLMs for high-quality, hard negative sampling. Specifically, we design an experimental pipeline that includes three main modules, profile generation, semantic negative sampling, and semantic alignment, to verify the potential of LLM-driven hard negative sampling in enhancing the accuracy of collaborative filtering (CF). Experimental results indicate that hard negative samples generated based on LLMs, when semantically aligned and integrated into CF, can significantly improve CF performance, although there is still a certain gap compared to traditional negative sampling methods. Further analysis reveals that this gap primarily arises from two major challenges: noisy samples and lack of behavioral constraints. To address these challenges, we propose a framework called HNLMRec, based on fine-tuning LLMs supervised by collaborative signals. Experimental results show that this framework outperforms traditional negative sampling and other LLM-driven recommendation methods across multiple datasets, providing new solutions for empowering traditional RS with LLMs. Additionally, we validate the excellent generalization ability of the LLM-based semantic negative sampling method on new datasets, demonstrating its potential in alleviating issues such as data sparsity, popularity bias, and the problem of false hard negative samples.

Introduction: The Semantic-Behavioral Gap

In recommendation systems, negative sampling is the process of choosing items a user hasn't interacted with to teach the model what the user doesn't like. "Hard" negatives—items very similar to a user's known preferences—are the most informative for training.

However, current methods suffer from False Hard Negative Samples (FHNS). Because most models rely on item IDs rather than semantic meaning, they often accidentally pick items the user would actually enjoy (e.g., recommending a different color of the same shirt as a "negative"). This creates a "Semantic-Behavioral Gap": an LLM might think an iPhone 13 and iPhone 14 are a "hard" pair because they are linguistically similar, but in a real-world recommendation context, a user who likes one is highly likely to like the other. Treating them as negatives "untrains" the model and hurts accuracy.

The HNLMRec Framework

The authors propose HNLMRec, a framework that moves beyond using LLMs as simple "plug-and-play" samplers. It consists of three main stages designed to bridge the gap between LLM "world knowledge" and actual user behavior.

The HNLMRec framework architecture, illustrating the transition from profile generation to semantic alignment and joint training.
  1. Profile Generation: The LLM summarizes user and item profiles based on text data like titles, brands, and reviews.
  2. Generative Hard Negative Sampling: Instead of selecting from a fixed pool of existing items, the LLM synthesizes textual descriptions of items that are semantically plausible but behaviorally irrelevant to the user.
  3. Collaborative-Semantic Alignment: This is the core innovation. To bridge the gap, the authors use Contrastive Supervised Fine-tuning (SFT). They fine-tune the LLM (via LoRA) to align its generated embeddings with "collaborative labels" mined from traditional recommendation models.
  4. Joint Training: The final recommendation model is trained using a multi-task loss function that combines standard ranking loss (BPR) with a "Semantic-Collaborative Alignment" loss (InfoNCE) to ensure the synthesized negatives remain grounded in real user behavior.

Key Insights and Results

The researchers evaluated HNLMRec on four real-world datasets: Amazon Toys & Games, Amazon CDs & Vinyl, Yelp2018, and Amazon Electronics (used as a "held-out" benchmark).

Analysis of (a) False Negative Ratio over training epochs and (b) final NDCG@20 performance across datasets.
  • The Cost of FHNS: As shown in Figure (a), HNLMRec significantly reduces the ratio of false negatives compared to baselines like AHNS and DNS*. Reducing these "accidental" negatives is the key to unlocking faster convergence and higher accuracy.
  • State-of-the-Art Performance: Figure (b) demonstrates that HNLMRec significantly outperformed traditional ID-based samplers (like Mixup and DNS) across all datasets. On the Toys and CDs datasets, HNLMRec achieved a 5.45% to 7.91% improvement in NDCG over the strongest baselines.
  • Alignment > Scale: Interestingly, model scale isn't the most important factor. A medium-sized model (like Llama-3-8B) with proper collaborative alignment outperformed much larger models (like Qwen-72B) that lacked alignment.
  • Superior Generalization: When a model fine-tuned on Toys/CDs/Yelp was tested on the Amazon Electronics dataset without any further tuning, it still outperformed all other models, proving that the "semantic-behavioral alignment" it learned is a universal principle.
  • Solving the Long-Tail: HNLMRec showed massive improvements on "unpopular" items. Because LLMs bring external knowledge, they can understand user preferences even when interaction data is extremely sparse.

Limitations and Future Work

While HNLMRec provides a powerful new solution, it introduces computational overhead due to the contrastive fine-tuning and synthesis modules. Additionally, the method's effectiveness is text-dependent, relying on high-quality titles and reviews. Future research will focus on adapting this framework to fully online settings with real-time feedback.

Summary updated

BibTeX
@misc{zhao2025can,
  author = {Chu Zhao and Enneng Yang and Yuting Liu and Jianzhe Zhao and Guibing Guo and Xingwei Wang},
  title = {{Can LLM-Driven Hard Negative Sampling Empower Collaborative Filtering? Findings and Potentials}},
  year = {2025},
  eprint = {2504.04726},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.04726},
}
Figure