Introduction
Knowledge Graphs (KGs) such as Freebase, WordNet, and Wikidata are essential backbones for modern AI applications, including question answering and recommendation systems. These graphs represent factual knowledge as triples $(h, r, t)$, where $h$ is the head entity, $r$ is the relation, and $t$ is the tail entity. However, KGs are notoriously incomplete. Knowledge Graph Completion (KGC) is the task of predicting missing links to fill these gaps.
Historically, KGC methods have been divided into two categories. Embedding-based methods map entities and relations into a low-dimensional vector space. While computationally efficient, they often fail to capture the complex semantic nuances present in entity descriptions. Text-based methods leverage Pre-trained Language Models (PLMs) like BERT to encode textual information. While more semantically "intelligent," these models are often prohibitively expensive for large-scale KGs because they typically require scoring every entity in the database during inference.
Generative Hard Negative Mining (GHN)
The core challenge in training high-performance text-based KGC models via contrastive learning is the selection of "hard negatives"—incorrect entities that are semantically similar enough to the correct answer to challenge the model. Standard approaches often rely on random sampling or approximate nearest neighbor (ANN) searches, which can be either too easy or computationally taxing.
This paper introduces Generative Hard Negative Mining (GHN), a framework that uses a sequence-to-sequence (Seq2Seq) model, specifically BART, to "dream up" plausible tail entities.
The Generator and Self-Information
The GHN generator is trained to predict the correct tail entity. During training, the "mistakes" it makes—sampled from its output distribution—are naturally semantically related to the query, serving as high-quality hard negatives. To prevent the model from collapsing into generating only common, non-informative words, the authors implement a Self-Information Enhancement strategy. This weighting mechanism prioritizes rare tokens that carry more specific information, ensuring the generated negatives are both diverse and challenging.
Two-Stage Inference
To solve the scalability issues of text-based models, GHN employs a two-stage inference process. Instead of scoring millions of entities, the generator first proposes a small set of candidates (e.g., the top 50). A BERT-based predictor then performs a final, more precise ranking on only this subset. This decoupling allows the model to maintain high accuracy while significantly reducing the computational burden.
Experimental Results
The authors evaluated GHN on three major benchmarks: WN18RR (lexical), FB15k-237 (general knowledge), and Wikidata5M (large-scale).
State-of-the-Art Performance
On the WN18RR dataset, GHN achieved a Mean Reciprocal Rank (MRR) of 67.8, surpassing the previous state-of-the-art text-based model, SimKGC (66.6). The results demonstrate that generative negatives are more effective for training discriminative rankers than simple in-batch or sampled negatives.
Efficiency and Scalability
The most striking results were observed on the Wikidata5M dataset, which contains nearly 5 million entities. GHN achieved an inference speed approximately 4x faster than SimKGC. Because the generator's workload is independent of the total number of entities in the KG, GHN's efficiency remains stable as the graph grows, whereas traditional text-based models see their performance degrade. Furthermore, GHN reached peak performance using only 511 negatives, while competing models required over 1,000, indicating higher training efficiency.
Discussion: Vicinity vs. Uniformity
A key insight from the paper is the balance between Vicinity (how close a negative is to the truth) and Uniformity (how well negatives cover the representation space). The authors found that while ANN-based negatives offer high vicinity, they often lack uniformity, leading to suboptimal results. GHN’s generative approach, combined with self-information weighting, successfully optimizes both properties, leading to a more robust representation space.
Conclusion
Generative Hard Negative Mining represents a significant advancement in Knowledge Graph Completion. By shifting from negative sampling to negative generation, the authors have created a framework that is both more accurate and significantly more scalable. While challenges remain in handling entirely unseen entities (inductive KGC), GHN provides a powerful template for integrating generative and discriminative models in large-scale knowledge representation tasks.
Summary updated