Abstract
While textual information significantly enhances the performance of pre-trained language models (PLMs) in knowledge graph completion (KGC), the static and noisy nature of existing corpora collected from Wikipedia articles or synsets definitions often limits the potential of PLM-based KGC models. To surmount these challenges, we introduce the Contextualization Distillation strategy, a versatile plug-in-and-play approach compatible with both discriminative and generative KGC frameworks. Our method begins by instructing large language models (LLMs) to transform compact, structural triplets into context-rich segments. Subsequently, we introduce two tailored auxiliary tasks—reconstruction and contextualization—allowing smaller KGC models to assimilate insights from these enriched triplets. Comprehensive evaluations across diverse datasets and KGC techniques highlight the efficacy and adaptability of our approach, revealing consistent performance enhancements irrespective of underlying pipelines or architectures. Moreover, our analysis makes our method more explainable and provides insight into how to generate high-quality corpora for KGC, as well as the selection of suitable distillation tasks.
Introduction
Knowledge Graph Completion (KGC) is the task of predicting missing links in a graph, such as predicting the tail in a triplet like (J.G. Ballard, place_of_birth, ?). While modern approaches use Pre-trained Language Models (PLMs) to leverage textual descriptions of entities, they face significant hurdles due to the quality of existing text corpora.
As illustrated above, existing descriptions (often from Wikipedia) suffer from three major issues:
- Succinctness: Descriptions are frequently too brief to capture complex relationships.
- Static Nature: Descriptions do not change based on the specific relationship being queried.
- Noise: Automatic entity alignment often pulls irrelevant data, such as confusing a city with a movie of the same name.
Methodology: Contextualization Distillation
To address these challenges, we propose Contextualization Distillation (CD), a "plug-and-play" strategy that uses Large Language Models (LLMs) to transform sparse triplets into rich, descriptive paragraphs.
The process follows three main steps:
- Context Extraction: We prompt a high-capacity LLM (e.g., PaLM2-540B) to take a structural triplet and turn it into a coherent, descriptive paragraph. This "contextualized triplet" explains the entities and their specific relationship in a fluent format.
- Generating Paths: We found that asking for a single, coherent paragraph containing both entity and triplet descriptions ($T \rightarrow (ED, TD)$) worked best for distillation.
- Multi-task Learning: To distill this knowledge into smaller KGC models (like BERT or BART), we introduce two auxiliary tasks:
- Reconstruction (for Discriminative Models): Uses Masked Language Modeling (MLM) where the model must predict missing words in the LLM-generated paragraph.
- Contextualization (for Generative Models): The model is trained to generate the descriptive paragraph when given the raw triplet.
Key Results and Insights
Evaluations on gold-standard benchmarks (WN18RR and FB15k-237N) show that the CD method provides consistent improvements across all tested baselines. For instance, KG-BERT saw a 31.7% improvement in MRR on WN18RR, and KG-S2S-CD reached a new peak H@10 of 50.2 on FB15k-237N.
Our analysis revealed several critical insights:
- LLMs as Teachers, Not Doers: LLMs are better at explaining knowledge than retrieving it for specific KGC tasks. Distilling their explanations into smaller models yields better results than using the LLM directly.
- Coherence over Complexity: Simple, descriptive text is more effective for distillation than complex "Chain-of-Thought" rationales. Smaller models struggle with intricate logic but thrive on clear, descriptive context.
- The "Anti-Noise" Effect: LLM-generated descriptions are cleaner than scraped data. Because the LLM is prompted with the specific triplet, it generates a description that is "aware" of the relationship, avoiding the ambiguity of homonyms.
- Faster Convergence: Adding the distillation task helps models converge to their best performance in fewer training epochs.
Conclusion
Contextualization Distillation effectively bridges the gap between structural knowledge and textual richness. By leveraging LLMs to generate relationship-aware descriptions, we overcome the limitations of static and noisy corpora. Future work will explore expanding this method to temporal knowledge graphs and few-shot scenarios.
Summary updated