KnowLA: Enhancing Parameter-efficient Finetuning with Knowledgeable Adaptation

Xindi Luo, Zequn Sun, Jing Zhao, Zhe Zhao, Wei Hu

Abstract

Parameter-efficient finetuning (PEFT) is a key technique for adapting large language models (LLMs) to downstream tasks. In this paper, we study leveraging knowledge graph embeddings to improve the effectiveness of PEFT. We propose a knowledgeable adaptation method called KnowLA. It inserts an adaptation layer into an LLM to integrate the embeddings of entities appearing in the input text. The adaptation layer is trained in combination with LoRA on instruction data. Experiments on six benchmarks with two popular LLMs and three knowledge graphs demonstrate the effectiveness and robustness of KnowLA. We show that KnowLA can help activate the relevant parameterized knowledge in an LLM to answer a question without changing its parameters or input prompts.

Introduction

While Large Language Models (LLMs) like Llama 2 possess vast amounts of information, they often struggle with factual accuracy, hallucinations, or failing to recall specific knowledge during downstream tasks. The current standard for adapting these models is Parameter-Efficient Finetuning (PEFT), specifically LoRA (Low-Rank Adaptation). However, standard PEFT is "knowledge-blind"—it updates a small set of weights based on text patterns but does not explicitly leverage structured, trustworthy sources like Knowledge Graphs (KGs). Previous attempts to inject KGs into models required full-model finetuning, which is computationally prohibitive for LLMs with billions of parameters. KnowLA addresses this by injecting structured knowledge into LLMs without losing the efficiency of PEFT.

Methodology

KnowLA introduces an adaptation layer inserted between the decoder layers of an LLM (specifically after the 32nd layer in Llama 2-7B). The process follows four main steps:

  1. Entity Linking: Important tokens in the input text are matched to entities in a KG (e.g., ConceptNet or Wikidata) using a text-rank algorithm.
  2. LLM Encoding: The input text is processed through the LLM's standard layers to produce hidden state representations.
  3. Knowledge Mapping & Injection: Since KG embeddings (like TransE) and LLM hidden states live in different mathematical spaces, KnowLA uses a SwiGLU-based MLP to project KG embeddings into the LLM’s semantic space.
  4. Knowledge Fusion: To prevent "noisy" or irrelevant entities from degrading performance, the authors introduce a Knowledge Sentinel. This mechanism uses an attention-like calculation to decide how much weight to give to the external KG embedding versus the original LLM representation.

Crucially, the LLM parameters and the KG embeddings remain frozen. Only the KnowLA adaptation layer and the LoRA adapters are trained, making the process highly efficient.

Experimental Setup

The researchers evaluated KnowLA across six diverse benchmarks:

  • Commonsense Reasoning: CommonsenseQA and SIQA (Social Interaction QA).
  • General Knowledge: BIG-Bench Hard (BBH).
  • Knowledge Base QA (KBQA): WebQuestionSP.
  • Closed-book QA: TriviaQA and TruthfulQA (to measure truthfulness and hallucination).

They utilized three different Knowledge Graphs for embeddings: WordNet, ConceptNet, and Wikidata. The method proved stable across different base models (LLaMA 1 vs. Llama 2), different instruction datasets (Alpaca vs. Vicuna), and different PEFT variants (LoRA vs. AdaLoRA).

Key Insights and Results

Superior Performance and Efficiency

On CommonsenseQA, KnowLA (using ConceptNet) achieved 58.39% accuracy, outperforming the standard Alpaca2 (LoRA) baseline of 56.92%. Furthermore, a KnowLA-enhanced model with a smaller LoRA rank (r=16) often outperformed a standard LoRA model with a larger rank (r=32). This suggests that structured knowledge is a more parameter-efficient way to improve performance than simply adding more trainable weights.

Activation of Latent Knowledge

One of the most striking findings is that KnowLA does not just "add" new facts; it helps the LLM recall knowledge it already has. By analyzing the Feed-Forward Network (FFN) layers, the authors found that KnowLA significantly increases the "change" in hidden states in the upper layers of the model, suggesting it activates latent parameterized knowledge that the input prompt alone could not reach.

Comparison with RAG

KnowLA outperformed Retrieval-Augmented Generation (RAG) methods like KAPING and Contriever. Unlike RAG, which modifies the input prompt and consumes valuable context window space, KnowLA works internally within the model's layers, providing a more seamless integration of external knowledge.

Conclusion and Future Work

KnowLA demonstrates that aligning KG embeddings with LLM internal representations can significantly enhance model performance on reasoning and QA tasks. While the current implementation focuses on single KGs, the authors identified that merging multiple KGs can introduce noise. Future work will explore Mixture of Experts (MoE) to better integrate multiple KGs and investigate incremental updates, allowing the model to learn new KG facts without retraining the entire adaptation layer.

Summary updated

Abstract

Parameter-efficient finetuning (PEFT) is a key technique for adapting large language models (LLMs) to downstream tasks. In this paper, we study leveraging knowledge graph embeddings to improve the effectiveness of PEFT. We propose a knowledgeable adaptation method called KnowLA. It inserts an adaptation layer into an LLM to integrate the embeddings of entities appearing in the input text. The adaptation layer is trained in combination with LoRA on instruction data. Experiments on six benchmarks with two popular LLMs and three knowledge graphs demonstrate the effectiveness and robustness of KnowLA. We show that \modelname can help activate the relevant parameterized knowledge in an LLM to answer a question without changing its parameters or input prompts.
BibTeX
@inproceedings{luo2024knowla,
  author = {Xindi Luo and Zequn Sun and Jing Zhao and Zhe Zhao and Wei Hu},
  title = {{KnowLA: Enhancing Parameter-efficient Finetuning with Knowledgeable Adaptation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=i9aM2K3gYO},
}
Figure