Abstract
Although large language models (LLMs) show remarkable capabilities and generalizability across various tasks, they are criticized for lack of expertise. One promising solution is to combine knowledge graphs (KGs) with LLMs, and recent studies focus on integrating KGs into LLMs through prompt-based methods. However, these approaches fail to use the structural information of the KGs, suffer from the problem of knowledge conflict, and over-reliance on super LLMs. To address these challenges, we propose KG-Adapter, a parameter-level KG integration method based on parameter-efficient fine-tuning (PEFT). Specifically, we introduce a novel adapter structure designed for decoder-only LLMs, which can encode KGs from both node-centered and relation-centered perspectives, and then perform joint reasoning with LLMs to generate responses end-to-end. Experiments with diverse models on four datasets for two different tasks all demonstrate significant improvements. With only 28M parameters trained, we make the 7B-parameter LLM outperform the previous full-parameter fine-tuned state-of-the-art method and comparable to the prompt-based ChatGPT methods.
Introduction
Large Language Models (LLMs) often struggle with domain-specific expertise and factual accuracy, leading to "hallucinations." Integrating Knowledge Graphs (KGs)—structured networks of facts—is a promising solution. However, existing methods typically rely on prompting (linearizing graph triplets into text) or full-parameter fine-tuning. Prompting often results in a loss of structural information and can lead to knowledge conflicts where the model ignores the provided context. Full-parameter fine-tuning, on the other hand, is computationally prohibitive for modern decoder-only architectures like Llama 2.
KG-Adapter addresses these issues by injecting structured KG information directly into the model's internal reasoning layers using parameter-efficient fine-tuning (PEFT). This approach preserves the rich relational connectivity inherent in the graph while keeping computational costs low.
Methodology
The KG-Adapter framework consists of two primary components designed to bridge the gap between linguistic sub-words and structured entities:
- Sub-word to Entity Hybrid Initialization (SEHI): This module fuses the LLM’s sub-word embeddings with pre-trained KG entity embeddings. This ensures that the initial representation captures both the textual context and the factual identity of graph nodes.
- The KG-Adapter Layer: Inserted between frozen LLM blocks, these layers perform node-centric encoding (using GNNs), relation-centric encoding (capturing triple representations), and joint reasoning via a bi-directional cross-attention mechanism.
By freezing the original LLM parameters and training only the 28M parameters within the adapters (approximately 0.4% of a 7B model), the system maintains efficiency while gaining deep structural knowledge.
Experimental Evaluation
The researchers evaluated KG-Adapter on two task types: Multiple-Choice Question Answering (MCQA) using OpenBookQA (OBQA) and CommonsenseQA (CSQA), and Knowledge Graph-based Question Answering (KGQA) using WebQuestionsSP (WQSP) and ComplexWebQuestions (CWQ).
Key Results
The results demonstrate that KG-Adapter significantly enhances LLM performance on knowledge-intensive tasks. On the OBQA dataset, Llama2-7B with KG-Adapter improved by 40.8 points over its base version. Notably, the 7B model with KG-Adapter outperformed ChatGPT and achieved results comparable to GPT-4 on specific benchmarks.
Discussion and Conclusion
The success of KG-Adapter highlights that preserving the graph structure during reasoning is superior to simple text linearization. By navigating multi-hop paths within the graph, the model avoids the pitfalls of "flat" text representations. Furthermore, the method effectively "anchors" the model in factual reality, mitigating hallucinations by providing a clear reasoning path through the KG.
While currently limited by hardware to models up to 13B parameters, the authors anticipate even greater gains when scaling to 70B+ models. Future work will focus on integrating more sophisticated retrieval techniques and denoising mechanisms to handle irrelevant graph nodes in complex datasets.
Summary updated