Diversified and Adaptive Negative Sampling on Knowledge Graphs

Ran Liu, Zhongzhou Liu, Xiaoli Li, Hao Wu, Yuan FangarXiv 2024 · DOI

Abstract

Knowledge Graph (KG) embedding models rely on negative sampling to learn the boundaries of factual truth. However, existing sampling methods often struggle with a trade-off between diversity and informativeness. We introduce DANS (Diversified and Adaptive Negative Sampling), a novel framework that employs a two-way adaptive generator and Feature-wise Linear Modulation (FiLM) to generate high-quality negative samples. By specializing the generator for local graph neighborhoods and ensuring diverse sample pathways, DANS achieves state-of-the-art performance across multiple benchmark datasets including WN18RR and NELL-995.

Introduction

Knowledge Graphs represent structured information as triplets $(h, r, t)$. Embedding these into latent spaces is fundamental for tasks like link prediction. Training typically involves a contrastive loss between positive triplets (observed facts) and negative triplets (corrupted facts).

The effectiveness of this training hinges on the "informativeness" of negative samples. If a negative sample is too obvious (e.g., <Beijing, isCapitalOf, KFC>), the model learns little. If it is "hard" (e.g., <Beijing, isCapitalOf, Russia>), it forces the model to learn finer-grained distinctions. Current methods like random sampling produce easy negatives, while standard GAN-based methods often lack the diversity and entity-specific adaptiveness required for complex graphs.

The DANS Framework

DANS addresses these limitations through three core architectural innovations integrated into the training loop.

The DANS framework architecture, featuring a two-way adaptive generator and a dual-task discriminator.
  1. Two-way Adaptive Generator: Unlike single-path generators, DANS utilizes two pathways: $G_E$, which generates negatives based on the head entity embedding, and $G_R$, which considers both the head entity and the specific relation. This dual-path approach ensures that the generated "fake" facts are diversified across different semantic dimensions.
  2. FiLM (Feature-wise Linear Modulation): To make the generator adaptive to the vast heterogeneity of Knowledge Graphs, DANS incorporates FiLM layers. These layers scale and shift the generator's internal activations based on the specific entity or relation being processed. This allows a single global model to function as a collection of "local" generators specialized for different neighborhoods in the graph.
  3. Two-way Discriminator: The discriminator is tasked with two objectives: distinguishing real triplets from generated ones ($D_{Adv}$) and identifying which generator pathway produced a given fake sample ($D_{Aux}$). This auxiliary task prevents the two generators from collapsing into the same output space, maintaining diversity.

The system uses a Relational Graph Convolutional Network (RGCN) as its backbone and is compatible with various scoring decoders like DistMult, ComplEx, and RotatE.

Experimental Evaluation

The model was evaluated on three standard benchmarks: WN18RR (WordNet), NELL-995 (general facts), and UMLS (medical knowledge). DANS consistently outperformed traditional samplers (Rand, Pop) and advanced adversarial baselines (KBGAN, MCNS).

  • Quantitative Performance: On the WN18RR dataset using the DistMult decoder, DANS achieved an MRR (Mean Reciprocal Rank) of 0.381, outperforming the standard random sampling baseline (0.372).
  • Ablation Success: Removing either the two-way generation or the FiLM modulation led to a significant drop in performance, proving that both diversity and adaptiveness are necessary for high-quality negative sampling.
  • Qualitative Visualization: Using t-SNE plots, the authors showed that DANS generates negative entities that occupy different subspaces than the positive ones, whereas random sampling often overlaps with real facts, potentially creating "false negatives" that confuse the model.

Conclusion and Future Work

DANS represents a significant step forward in negative sampling for Knowledge Graphs. By combining diversity through two-way generation and adaptiveness through FiLM, it produces more informative training signals. While the GAN-based training adds some computational complexity, the gains in embedding quality and robustness across diverse datasets make it a powerful framework for modern KG applications. Future directions include exploring DANS on even larger, more heterogeneous graphs and integrating it with different types of Graph Neural Network backbones.

Summary updated

BibTeX
@misc{liu2024diversified,
  author = {Ran Liu and Zhongzhou Liu and Xiaoli Li and Hao Wu and Yuan Fang},
  title = {{Diversified and Adaptive Negative Sampling on Knowledge Graphs}},
  year = {2024},
  eprint = {2410.07592},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.07592},
}
Figure