TL;DR
This paper introduces DIFT, a novel framework for knowledge graph completion that finetunes large language models (LLMs) using "discrimination instructions." This approach avoids the common issue of LLMs generating incorrect entities by forcing them to choose from a curated list of candidates, leading to state-of-the-art results.
What Problem Does This Paper Address?
Knowledge graphs (KGs) are structured representations of real-world facts, but they are often incomplete. Knowledge graph completion aims to fill these gaps by predicting missing entities or relations. While recent methods leverage the power of large language models (LLMs) for this task, they often struggle with "grounding" – ensuring the LLM's generated text corresponds to actual entities in the KG. This can lead to errors where the LLM hallucinates entities or generates plausible but incorrect information. Existing approaches either rely on complex generation and grounding steps or require extensive, costly finetuning of LLMs.
Methods
DIFT tackles KG completion by finetuning LLMs with a specific type of instruction: discrimination instructions. The core idea is to guide the LLM to select the correct entity from a set of plausible candidates, rather than generating it freely.
Here's how it works:
- Candidate Generation: A lightweight, pre-trained KG embedding model (like TransE, SimKGC, or COLE) is used to identify a ranked list of m candidate entities for a given incomplete fact (e.g.,
(head_entity, relation, ?)). - Prompt Construction: A "discrimination instruction" is created. This prompt includes the original query, descriptive text about the head entity, relevant neighbor facts, and the list of candidate entities.
- LLM Finetuning: The LLM is finetuned using parameter-efficient methods (like LoRA) on these discrimination instructions. The LLM learns to pick the correct entity from the provided candidates.
- Truncated Sampling: To make finetuning more efficient and effective, DIFT employs a "truncated sampling" method. This technique selects high-confidence training samples based on the scores and ranks provided by the embedding-based model, reducing the amount of instruction data needed.
- Knowledge Adaptation: To further enhance the LLM's reasoning capabilities, KG embeddings from the embedding-based model are injected into the LLM. This helps the LLM leverage structural KG information alongside its pre-trained knowledge.
Datasets
The proposed DIFT framework was evaluated on two standard KG completion benchmark datasets:
- FB15K-237: A dataset derived from Freebase, focusing on real-world named entities and their relations.
- WN18RR: A dataset constructed from WordNet, containing English phrases and semantic relations.
These datasets are updated versions of older benchmarks, with inverse edges removed to prevent data leakage.
Key Insights and Ideas
- Discrimination over Generation: The key insight is that forcing LLMs to discriminate among candidates is more robust for KG completion than free-form generation, as it directly addresses the grounding problem.
- Efficiency through Truncated Sampling: The truncated sampling method is crucial for making LLM finetuning practical by focusing on high-quality instruction data.
- Synergy of Embedding Models and LLMs: DIFT demonstrates that combining the strengths of traditional KG embedding models (for candidate generation and scoring) with the broad knowledge and reasoning abilities of LLMs (for selection) yields superior results.
- LLM Generalization: The framework shows robustness across different versions of LLMs (e.g., LLaMA-2-7B-Chat vs. LLaMA-2-7B-Foundation), indicating its general applicability.
Key Results
DIFT achieved state-of-the-art performance on both FB15K-237 and WN18RR datasets, outperforming various embedding-based, generation-based, and LLM-based baselines.
- Hits@1 Improvement: DIFT significantly improved Hits@1 scores compared to baselines, particularly when compared to prompting LLMs like ChatGPT. For instance, on FB15K-237, DIFT achieved 0.364 Hits@1, and on WN18RR, it reached 0.616 Hits@1.
- Efficiency: The truncated sampling method and parameter-efficient finetuning (LoRA) contribute to making the finetuning process more efficient.
- Ablation Studies: All components of DIFT (truncated sampling, RC sampling, description, neighbors, and knowledge adaptation) were shown to contribute positively to performance, with truncated sampling having the most substantial impact.
- Qualitative Analysis: Case studies revealed that DIFT can leverage entity descriptions and external knowledge from LLMs to overcome limitations in KG data and make correct predictions where embedding-based models fail.
Limitations and Future Work
- Dataset Dependence: The performance improvement of certain components (like description) varied between datasets, suggesting that KG density and structure play a role.
- Candidate Order: While DIFT generally benefits from candidate order, shuffling candidates during finetuning can lead to performance drops, indicating the LLM learns preferences from the embedding model.
- Future Work: The authors plan to extend DIFT to other KG tasks, such as KG Question Answering (KGQA) and entity alignment. They also aim to explore further optimizations and applications of their framework.
Summary updated