TL;DR
This paper introduces LP-BERT, a novel multi-task pre-training language model for knowledge graph completion. By combining masked language modeling with new masked entity and relation tasks, LP-BERT effectively learns both contextual and structural information from knowledge graphs. This approach significantly improves performance, especially for unseen entities, and achieves state-of-the-art results on several benchmark datasets.
What Problem Does This Paper Address?
Knowledge graphs (KGs) are powerful for representing relationships between entities, but they are often incomplete. The task of "link prediction" aims to fill these gaps by predicting missing relationships between entities. Traditional methods like translational distance models struggle with entities not seen during training. While semantic matching methods can handle unseen entities, they typically require massive datasets for training, which are often impractical to obtain. This paper tackles the challenge of achieving high performance in link prediction, particularly for unseen entities, without relying on prohibitively large datasets.
Methods
The core of the proposed solution is LP-BERT, a model that operates in two main phases: multi-task pre-training and knowledge graph fine-tuning.
Multi-task Pre-training: LP-BERT leverages a transformer-based architecture and introduces three pre-training tasks that are trained in parallel:
- Masked Language Model (MLM): This is a standard task where random tokens in the input sequence are masked, and the model learns to predict them based on context.
- Masked Entity Model (MEM): This novel task masks either the head or tail entity within a triple (e.g.,
[MASK], R, Et) and trains the model to predict the masked entity. This helps the model learn entity-specific semantic information. - Masked Relation Model (MRM): Another novel task, MRM masks the relation in a triple (e.g., Eh,
[MASK], Et) and trains the model to predict the relation. This focuses on learning relational semantics.
The input to these tasks is a concatenated sequence of entity descriptions, relations, and entity texts from a triple.
Knowledge Graph Fine-tuning: * Triple-style Negative Sampling: Inspired by contrastive learning, the authors propose a batch-wise negative sampling strategy. Instead of generating negative samples individually, they interleave positive samples within a batch to create many negative pairs efficiently. This significantly increases the proportion of negative samples without substantially increasing training time. * Triple Augmentation: To further improve robustness and diversity, they introduce data augmentation using inverse relationships. For a triple (Eh, R, Et), they create a new triple (Et, R_rev, Eh), where R_rev is the inverse of R. * Fine-tuning Loss: A dual distance calculation method is used to jointly compute the loss, incorporating both cosine similarity and Euclidean distance between encoded representations of head-relation and tail entities.
Datasets
The proposed LP-BERT model was evaluated on three widely-used knowledge graph datasets:
- WN18RR: Derived from WordNet, it focuses on English phrases and semantic relations.
- FB15k-237: A subset of Freebase, containing real-world named entities and their relations. Both WN18RR and FB15k-237 are cleaned versions that remove inverse relations and data leakage.
- UMLS: A smaller KG containing medical semantic entities and their relations.
The paper also discusses experiments on unseen entities by re-splitting these datasets.
Key Insights and Ideas
- Multi-task Pre-training for KG: The core idea of using multiple, specialized pre-training tasks (MEM and MRM) alongside MLM is crucial. This allows the model to learn not just textual context but also the specific structural and semantic nuances of knowledge graphs, which is vital for link prediction.
- Efficient Negative Sampling: The batch-wise triple-style negative sampling is a clever way to overcome the data scarcity problem for semantic matching models. By generating many negative samples from a single batch, it dramatically increases training signal without a proportional increase in computation.
- Handling Unseen Entities: The pre-training approach, particularly the MEM and MRM tasks, demonstrably improves the model's ability to generalize to entities not encountered during training, a significant limitation of many prior methods.
- Data Augmentation with Inverse Relations: Using inverse relations is a simple yet effective technique to enrich the training data and make the model more robust to different relational patterns.
Key Results
LP-BERT achieved state-of-the-art (SOTA) performance on the WN18RR and FB15k-237 datasets.
- On WN18RR, the Hits@10 indicator was improved by 5% over the previous SOTA.
- On UMLS, LP-BERT achieved 100% accuracy on the Hits@10 metric.
- The model also demonstrated superior performance in handling unseen entities compared to both translational distance and other semantic matching models.
- LP-BERT achieved this performance with significantly fewer parameters than previous SOTA semantic matching models like StAR.
- The multi-task pre-training strategy was shown to be more effective than using only MLM or other individual pre-training tasks.
Limitations and Future Work
- Performance on Mean Rank: While LP-BERT excels in top-K recall metrics (Hits@N), its performance on the mean rank (MR) metric for unseen entities was noted to be worse than other metrics, indicating that it still struggles with precisely ranking the correct entity among many possibilities for some failed cases.
- Future Work: The authors suggest exploring more diverse pre-training tasks and increasing model parameter size to enable LP-BERT to store larger graph knowledge. They also mention the potential for further optimization of the pre-training and fine-tuning strategies.
Summary updated