Skip to main content
QUICK REVIEW

[Paper Review] KnowGPT: Knowledge Graph based Prompting for Large Language Models

Qinggang Zhang, Junnan Dong|arXiv (Cornell University)|Dec 11, 2023
Topic ModelingComputer Science4 citations
TL;DR

KnowGPT is a black-box knowledge injection framework that enhances large language models (LLMs) like ChatGPT and GPT-4 via knowledge graphs (KGs) using only API access. It uses deep reinforcement learning to extract relevant reasoning paths from KGs and a Multi-Armed Bandit (MAB) to automatically construct optimal prompts, achieving a 23.7% average improvement over ChatGPT and 91.6% accuracy on OpenbookQA—near human-level performance.

ABSTRACT

Large Language Models (LLMs) have demonstrated remarkable capabilities in many real-world applications. Nonetheless, LLMs are often criticized for their tendency to produce hallucinations, wherein the models fabricate incorrect statements on tasks beyond their knowledge and perception. To alleviate this issue, researchers have explored leveraging the factual knowledge in knowledge graphs (KGs) to ground the LLM's responses in established facts and principles. However, most state-of-the-art LLMs are closed-source, making it challenging to develop a prompting framework that can efficiently and effectively integrate KGs into LLMs with hard prompts only. Generally, existing KG-enhanced LLMs usually suffer from three critical issues, including huge search space, high API costs, and laborious prompt engineering, that impede their widespread application in practice. To this end, we introduce a novel Knowledge Graph based PrompTing framework, namely KnowGPT, to enhance LLMs with domain knowledge. KnowGPT contains a knowledge extraction module to extract the most informative knowledge from KGs, and a context-aware prompt construction module to automatically convert extracted knowledge into effective prompts. Experiments on three benchmarks demonstrate that KnowGPT significantly outperforms all competitors. Notably, KnowGPT achieves a 92.6% accuracy on OpenbookQA leaderboard, comparable to human-level performance.

Motivation & Objective

  • To address the limitation of black-box LLMs, such as ChatGPT and GPT-4, which cannot be fine-tuned and lack access to internal parameters.
  • To improve factual accuracy in question answering by injecting domain-specific knowledge from knowledge graphs (KGs) without modifying the LLM weights.
  • To overcome the challenges of selecting relevant KG triples and constructing effective prompts for LLMs under input length constraints.
  • To develop a framework that dynamically selects optimal prompt templates and path extraction strategies per question using reinforcement learning and bandit algorithms.
  • To achieve performance comparable to human-level benchmarks on open-domain and domain-specific question-answering tasks.

Proposed method

  • A deep reinforcement learning (RL) agent is trained to extract informative, concise reasoning paths from knowledge graphs (KGs) by navigating from question entities to answer entities.
  • A custom reward function is designed to maximize path reachability, context-relatedness, and conciseness, guiding the RL policy to learn effective path selection.
  • A Multi-Armed Bandit (MAB) framework is employed to dynamically select the best combination of path extraction strategies and prompt templates for each input question.
  • The MAB balances exploration and exploitation to optimize prompt construction, adapting to question-specific characteristics without requiring model fine-tuning.
  • The framework is deployed using only LLM APIs, making it compatible with closed-source models like GPT-4 and ChatGPT.
  • The system is evaluated on three benchmark datasets: CSQA, OpenbookQA, and MedQA, using ConceptNet and USMLE as source KGs.
Figure 1 : A real-world question from OpenbookQA. ChatGPT could effectively correct the answer given the scientific reasoning background from ConceptNet ( blue : question concepts, red : answers, grey : entities not present in questions).
Figure 1 : A real-world question from OpenbookQA. ChatGPT could effectively correct the answer given the scientific reasoning background from ConceptNet ( blue : question concepts, red : answers, grey : entities not present in questions).

Experimental results

Research questions

  • RQ1Can a black-box knowledge injection framework effectively enhance LLM performance in question answering without access to model weights?
  • RQ2How can relevant knowledge be efficiently extracted from large-scale knowledge graphs under strict input length constraints?
  • RQ3What prompt construction strategy maximizes LLM performance when integrating factual knowledge from KGs?
  • RQ4Can a dynamic, adaptive prompt generation method outperform static prompt templates in complex reasoning tasks?
  • RQ5To what extent can such a framework close the factual accuracy gap between LLMs and human-level performance?

Key findings

  • KnowGPT achieves a 23.7% average improvement over ChatGPT on three benchmark datasets, demonstrating significant gains in factual accuracy.
  • On the OpenbookQA leaderboard, KnowGPT attains 91.6% accuracy, which is comparable to human-level performance.
  • The framework improves performance by 2.9% over GPT-4, indicating effectiveness even against state-of-the-art models.
  • The MAB-based prompt construction strategy outperforms static templates, with the full KnowGPT system achieving 82.7% accuracy on CSQA and 92.4% on MedQA.
  • Ablation studies confirm that both the RL path extraction and MAB prompt selection components are essential, with each contributing significantly to the final performance.
  • Case studies show that prompt format critically affects LLM outputs, and KnowGPT’s automatic format selection consistently outperforms fixed templates like triples or graph descriptions.
Figure 2 : The overall architecture of our proposed black-box knowledge injection framework, i.e., KnowGPT . Given the question context and answer choices, we retrieve a question-specific subgraph from the real-world KG. Path Extraction is first dedicated to searching for the most informative and co
Figure 2 : The overall architecture of our proposed black-box knowledge injection framework, i.e., KnowGPT . Given the question context and answer choices, we retrieve a question-specific subgraph from the real-world KG. Path Extraction is first dedicated to searching for the most informative and co

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.