Abstract
We introduce an adversarial learning framework, which we named KBGAN, to improve the performances of a wide range of existing knowledge graph embedding models. Because knowledge graph datasets typically only contain positive facts, sampling useful negative training examples is a non-trivial task. Replacing the head or tail entity of a fact with a uniformly randomly selected entity is a conventional method for generating negative facts used by many previous works, but the majority of negative facts generated in this way can be easily discriminated from positive facts, and will contribute little towards the training. Inspired by generative adversarial networks (GANs), we use one knowledge graph embedding model as a negative sample generator to assist the training of our desired model, which acts as the discriminator in GANs. The objective of the generator is to generate difficult negative samples that can maximize their likeliness determined by the discriminator, while the discriminator minimizes its training loss. This framework is independent of the concrete form of generator and discriminator, and therefore can utilize a wide variety of knowledge graph embedding models as its building blocks. In experiments, we adversarially train two translation-based models, TransE and TransD, each with assistance from one of the two probability-based models, DistMult and ComplEx. We evaluate the performances of KBGAN on the link prediction task, using three knowledge base completion datasets: FB15k-237, WN18 and WN18RR. Experimental results show that adversarial training substantially improves the performances of target embedding models under various settings.
TL;DR
KBGAN is an adversarial learning framework designed to improve Knowledge Graph Embedding (KGE) models by solving the "easy negative" problem. By using one KGE model as a generator to find "hard" negative examples and another as a discriminator to learn from them, the framework significantly boosts performance on link prediction tasks across standard benchmarks.
The Challenge of Negative Sampling
Knowledge Graphs (KGs) like Freebase or WordNet are massive collections of facts stored as triples, such as (New Orleans, LocatedIn, Louisiana). However, KGs generally only store positive facts. To train machine learning models to understand these graphs, we need negative examples to teach the model what is not true.
The traditional approach is Uniform Negative Sampling: take a real fact and replace one entity with a random one from the entire graph. The problem is that most random replacements are "too easy." For example, replacing "Louisiana" with "Barack Obama" creates the triple (New Orleans, LocatedIn, Barack Obama). A model quickly learns that people aren't locations, but it doesn't learn the fine-grained nuances of geography. To truly improve, a model needs "hard" negatives—like replacing "Louisiana" with "Florida"—which force it to learn the actual semantics of the data.
The KBGAN Framework
The authors introduce KBGAN, inspired by Generative Adversarial Networks (GANs). The framework consists of two components:
- The Generator (G): Usually a probability-based model (like DistMult or ComplEx). Its job is to look at a set of random candidate negatives and pick the one that looks most "plausible" to the current discriminator.
- The Discriminator (D): This is the target KGE model (like TransE or TransD) that uses a distance-based marginal loss. It strives to minimize the distance for positive facts and maximize it for the "hard" negatives provided by the generator.
The Technical Twist: Because the generator performs a discrete sampling step (picking one triple from a list), standard backpropagation cannot be used. To solve this, the authors treat the generator as a Reinforcement Learning agent using the REINFORCE algorithm. The "reward" for the generator is based on how well it fools the discriminator (specifically, the negative score the discriminator assigns to the generated triple).
Datasets and Evaluation
The researchers evaluated KBGAN on three widely used knowledge base completion datasets:
- FB15k-237: A subset of Freebase with redundant relations removed to make it more challenging.
- WN18: A subset of WordNet containing lexical relations between words.
- WN18RR: A more difficult version of WN18 that removes "inverse" relations which can make link prediction trivial.
Key Results and Insights
KBGAN consistently outperformed baseline models that used uniform sampling.
- TransE Boost: On the WN18 dataset, the Hits@10 (the probability that the correct answer is in the top 10 results) jumped from 89.2% (baseline) to 94.9% with KBGAN.
- Robustness on WN18RR: On the toughest dataset (WN18RR), KBGAN improved the Mean Reciprocal Rank (MRR) of TransE from 0.186 to 0.213.
- Consistency: Whether using DistMult or ComplEx as the generator, the improvements to the discriminator (TransE/TransD) were stable, proving the framework's robustness.
Beyond the numbers, KBGAN demonstrates Semantic Awareness. While uniform sampling picks random noise, the trained KBGAN generator starts picking semantically related entities. For a fact about "distilling," the generator suggests "revivification" or "liquid body substance"—incorrect, but contextually relevant. This "quality over quantity" approach shows that a single, high-quality "hard" negative is often more valuable for training than a mountain of "easy" ones.
Limitations and Future Directions
Despite its success, KBGAN faces some challenges:
- Computational Overhead: Training a GAN is inherently more complex than simple uniform sampling. The authors limited embedding dimensions to $k=50$ to manage resources.
- The False Negative Risk: A very "smart" generator might accidentally pick a triple that is actually true but missing from the training set, providing a confusing signal to the discriminator.
- Scaling Up: Future work should involve testing more advanced, high-dimensional models within the KBGAN framework to see if the performance gains scale with model complexity.
Summary updated