Presented at NAACL 2024, BMKGC (Bilateral Masking with prompt for Knowledge Graph Completion) introduces a novel framework for addressing the inherent incompleteness of Knowledge Graphs (KGs). By leveraging pre-trained language models (PLMs) like BERT through a bi-encoder architecture and specialized prompting, the model achieves state-of-the-art performance while specifically mitigating the common issue of "degree bias."
The Challenge of Knowledge Graph Completion
Knowledge Graphs represent facts as triples: (head entity, relation, tail entity), such as (Paris, capital of, France). However, even the most comprehensive KGs are perpetually incomplete. Knowledge Graph Completion (KGC) aims to predict these missing links.
Existing methodologies generally diverge into two categories:
- Structure-based methods: These rely on the graph's topology but often ignore the rich semantic information available in entity descriptions.
- Description-based methods: These utilize text descriptions to represent entities. While accurate, they often face a trade-off between computational efficiency and embedding quality.
Furthermore, many models suffer from degree bias, where entities with few connections (low-degree nodes) are significantly harder to predict than well-connected ones. BMKGC was designed to bridge these gaps by improving embedding quality and balancing the training signal for rare entities.
Methodology: Bilateral Masking and Prompts
The core of BMKGC is a bi-encoder architecture consisting of two BERT-based encoders, $BERT_{head}$ and $BERT_{tail}$, which share initial weights but process different aspects of the triple.
Bilateral Masking Strategy
Instead of a single pass, the model uses a "Bilateral Masking" approach. For a triple $(h, r, t)$, $BERT_{head}$ processes the head entity and relation to predict the masked tail, while $BERT_{tail}$ performs a "fuzzy operation"—a self-prediction task where it attempts to reconstruct the tail entity from its own description. This ensures that the resulting embeddings are grounded in the entity's semantic description.
Prompt-based Input
BMKGC utilizes specific prompt templates to guide the PLM. For example, the input might be formatted as [CLS](h, r, [MASK]), dh[SEP]. By placing the [MASK] token in close proximity to the entity description ($d_h$), the model maintains a stronger gradient signal, preventing semantic "washout" that often occurs in long-sequence processing.
Mitigating Degree Bias
To address the poor performance on low-degree entities, the authors introduce a degree compensation technique. Inspired by contrastive learning methods like SimCSE, they pass the same input through the encoder multiple times. Because of the internal dropout mechanisms in BERT, each pass generates a slightly different embedding. This acts as a form of data augmentation, creating "synthetic" positive samples for rare entities and allowing the model to learn more robust representations for "lonely" nodes in the graph.
Experimental Results
The model was evaluated on two primary benchmarks: WN18RR (a logic-heavy dataset derived from WordNet) and FB15k-237 (a dense dataset of real-world facts from Freebase).
Performance Highlights
BMKGC achieved a new state-of-the-art on the WN18RR benchmark, reaching a Mean Reciprocal Rank (MRR) of 66.9, surpassing previous leaders like SimKGC. It also demonstrated high robustness in top-tier ranking, with a Hits@10 of 80.7%.
On the denser FB15k-237 dataset, while structure-based methods like CompGCN still hold an edge due to the high connectivity of the graph, BMKGC outperformed most other description-based competitors, proving its versatility across different graph densities.
Key Insights and Ablations
Ablation studies highlighted the critical role of the prompt-based input. Removing the prompts led to a significant drop in MRR (from 66.9 to 62.3), confirming that the structural arrangement of the query is as vital as the model's underlying parameters. Additionally, the "fuzzy operation" served as an effective regularizer, ensuring that entity embeddings did not drift from their linguistic meanings during training.
Conclusion and Future Work
BMKGC demonstrates that clever prompting and simple dropout-based augmentation can significantly enhance the performance of description-based KGC models. While the model currently faces some computational overhead due to the dual-encoder setup and augmentation passes, future research may focus on integrating structural topology more deeply or utilizing "hard negative" sampling to further refine the model's discriminative power in dense graphs.
Summary updated