Reinforced Negative Sampling over Knowledge Graph for Recommendation

Xiang Wang, Yaokun Xu, Xiangnan He, Yixin Cao, Meng Wang, Tat-Seng ChuaWWW 2020 · DOI

Abstract

Properly handling missing data is a fundamental challenge in recommendation. Most present works perform negative sampling from unobserved data to supply the training of recommender models with negative signals. Nevertheless, existing negative sampling strategies, either static or adaptive ones, are insufficient to yield high-quality negative samples — both informative to model training and reflective of user real needs. In this work, we hypothesize that item knowledge graph (KG), which provides rich relations among items and KG entities, could be useful to infer informative and factual negative samples. Towards this end, we develop a new negative sampling model, Knowledge Graph Policy Network (KGPolicy), which works as a reinforcement learning agent to explore high-quality negatives. Specifically, by conducting our designed exploration operations, it navigates from the target positive interaction, adaptively receives knowledge-aware negative signals, and ultimately yields a potential negative item to train the recommender. We tested on a matrix factorization (MF) model equipped with KGPolicy, and it achieves significant improvements over both state-of-the-art sampling methods like DNS and IRGAN, and KG-enhanced recommender models like KGAT.

Introduction

Most recommendation engines rely on "implicit feedback" (like clicks or views), creating a one-class problem: we know what a user liked, but we don't know what they disliked. To train these models, researchers use negative sampling—picking unobserved items and assuming the user doesn't like them.

However, current sampling strategies have two major flaws:

  1. Static/Random Sampling: Often picks "easy" negatives that the model already knows are bad, providing zero useful information for training.
  2. Adaptive/Hard Sampling: Picks items the model currently ranks highly. While "informative," these are often "false negatives"—items the user actually would like but hasn't seen yet.

The authors argue that a good negative sample should be both informative (challenging for the model) and factual (likely a true dislike). They hypothesize that the Knowledge Graph—which links items via shared attributes like directors, genres, or brands—holds the key to finding these elusive high-quality negatives.

Methodology: KGPolicy

The authors propose KGPolicy (Knowledge Graph Policy Network), which treats negative sampling as a reinforcement learning task. The sampler acts as an agent exploring the KG. Starting from a "target" positive item (something the user liked), it performs a multi-hop walk to find a negative item.

The KGPolicy framework illustrating the interaction between the Recommender and the Sampler, and the multi-hop exploration process.

The RL Agent and Exploration

The agent specifically looks for 2-hop paths: Positive Item → KG Entity → Candidate Negative Item. For example, if a user watched The Dark Knight, the agent might move to the entity Christopher Nolan and then to Interstellar as a candidate negative. KGPolicy uses an attention mechanism to weigh which KG entities are most relevant to a specific user’s tastes, allowing it to "personalize" the search for negatives.

Reward and Pruning

The agent is rewarded based on two factors:

  1. Prediction Reward: How highly the current recommender ranks the candidate (informativeness).
  2. Similarity Reward: How similar the candidate is to the positive item (increasing the likelihood it was a "factual" exposure).

To handle the massive scale of KGs, a pruning module filters out irrelevant nodes, keeping the search space manageable. Crucially, KGPolicy is recommender-agnostic, meaning it can be plugged into various architectures like Matrix Factorization or Neural CF.

Experiments and Results

The model was evaluated on three large-scale public benchmarks: Amazon-book, Last-FM, and Yelp2018. KGPolicy was tested against strong baselines, including adaptive samplers like DNS and IRGAN, and KG-specific models like KGAT.

Performance comparison of KGPolicy against various baselines across three datasets.

Key Findings

  • Accuracy Boost: KGPolicy consistently outperformed all baselines. On the Yelp2018 dataset, it improved NDCG@20 by 9.77% over the best-performing sampling baseline.
  • Superior to KG-specific Models: Even when using a simple Matrix Factorization model, KGPolicy-driven training outperformed complex GNN-based models like KGAT by roughly 5-11% across different datasets.
  • Robustness to Sparsity: The method proved particularly effective for "active" users, though it struggled slightly with extremely "cold-start" users who had fewer than 16 interactions to guide the KG walk.

Conclusion

KGPolicy demonstrates that Knowledge Graphs can serve as a powerful proxy for user exposure. By picking negatives that are "close" to positives in the KG space, the model receives more informative signals during training. This approach effectively bridges the gap between purely random sampling and overly aggressive hard sampling, leading to more robust and accurate recommendation systems.

Summary updated

BibTeX
@inproceedings{wang2020reinforced,
  author = {Xiang Wang and Yaokun Xu and Xiangnan He and Yixin Cao and Meng Wang and Tat-Seng Chua},
  title = {{Reinforced Negative Sampling over Knowledge Graph for Recommendation}},
  booktitle = {The Web Conference},
  year = {2020},
  doi = {10.1145/3366423.3380098},
}
Figure