TL;DR
KG-CF (Knowledge Graph Completion with Context Filtering) is a new framework that uses Large Language Models (LLMs) to clean up the "noise" in graph data before performing link prediction. By distilling an LLM’s reasoning into a smaller, faster classifier, the authors achieve state-of-the-art results in ranking-based entity prediction across both transductive and inductive settings.
What Problem Does This Paper Address?
Knowledge Graphs (KGs)—structured databases of facts like (Earth, orbits, Sun)—are almost always incomplete. Knowledge Graph Completion (KGC) aims to predict these missing links.
While LLMs have shown promise in KGC, they face two major hurdles:
- Noise in Context: To predict a link, models often look at surrounding paths in the graph. However, many of these paths are irrelevant "noise" that distracts the model.
- The Ranking Problem: Most LLM-based KGC research focuses on simple "True/False" classification of triplets. In the real world, we need models to rank thousands of candidates. LLMs are notoriously bad at generating precise numerical scores (floats) for ranking because they generate text token-by-token, leading to cumulative errors.
Methods
The authors propose a three-stage pipeline called KG-CF to bridge the gap between LLM reasoning and efficient entity ranking:
- Path Labeling (The Teacher): They sample paths between entities and ask an LLM to label them as "rational" or "irrational" based on whether the path logically supports the existence of a specific relation.
- Sequence Classifier Distillation (The Student): Since calling an LLM for every path in a massive graph is too expensive, they train a lightweight LSTM-based sequence classifier to mimic the LLM’s filtering logic. This "distilled" model can quickly filter out irrelevant graph contexts at scale.
- PLM Scoring (The Specialist): Finally, they train a Pretrained Language Model (BERT) specifically for scoring. This model takes the "rational" paths identified in the previous step and outputs a plausibility score. By using BERT for the final math and the LLM for the high-level logic, they get the best of both worlds.
Datasets
The framework was evaluated on three widely used benchmark knowledge graphs:
- WN18RR: Derived from WordNet, featuring hierarchical relations between words.
- FB15K-237: A subset of Freebase containing general-world knowledge.
- NELL-995: A dataset generated from web-crawled text, known for having rich textual descriptions of entities.
The models were tested in both transductive (predicting links between known entities) and inductive (predicting links for entities not seen during training) scenarios.
Key Insights and Ideas
- LLMs as Rationality Filters: Instead of asking an LLM "Is this triplet true?", the authors ask "Does this path make sense as evidence?" This leverages the LLM's strength in semantic reasoning while offloading the heavy lifting of ranking to more efficient models.
- Solving the "Float" Issue: By avoiding direct LLM-generated scores and instead using a BERT-based scorer trained on LLM-filtered data, the model avoids the "digit-by-digit" generation errors common in autoregressive models.
- Text Matters: The model performed exceptionally well on NELL-995. The authors attribute this to the fact that NELL-995 contains rich textual descriptions (e.g., "person Mexico Ryan Whitney"). LLMs are much better at reasoning over these descriptive strings than abstract ID-based entities.
Key Results
KG-CF consistently outperformed traditional embedding-based methods (like RotatE) and previous PLM-based methods (like BERTRL).
- Inductive Performance: On the WN18RR dataset, KG-CF achieved a Hits@1 of 78.5%, significantly higher than the previous state-of-the-art BERTRL (75.3%).
- Transductive Performance: On NELL-995, it reached a Mean Reciprocal Rank (MRR) of 82.0%, outperforming the strong TuckER baseline (80.0%).
- Ablation Study: Removing the "positive path filtering" (the LLM-guided cleaning) led to a performance drop, proving that the LLM's ability to prune irrelevant context is a core driver of the model's success.
Limitations and Future Work
The authors acknowledge a few areas for growth:
- Simple Paths Only: Currently, the model only uses simple linear paths as context. Real-world graph structures are more complex (e.g., ego-graphs or subgraphs), and incorporating these could further improve reasoning.
- Computational Cost of Labeling: While distillation helps, the initial phase still requires querying an LLM for a subset of paths, which can be resource-intensive depending on the scale of the graph.
- Context Selection: Future work will explore different types of graph contexts beyond just paths to see if other topological features provide better "rationality" signals for the LLM.
Summary updated