KnowledGPT: Enhancing Large Language Models with Retrieval and Storage Access on Knowledge Bases

Xintao Wang, Qianwen Yang, Yongting Qiu, Jiaqing Liang, Qianyu He, Zhouhong Gu, Yanghua Xiao, Wei WangarXiv 2023 · DOI

Introduction

Large Language Models (LLMs) are powerful but often unreliable due to hallucinations, knowledge cut-offs, and difficulties in incorporating private data. While Retrieval-Augmented Generation (RAG) typically utilizes unstructured document search, KnowledGPT, a framework from Fudan University, bridges LLMs with structured Knowledge Bases (KBs). This system enables LLMs to retrieve information from public KBs and store new facts in a personalized, symbolic memory using "Program of Thought" prompting to generate Python code for KB access.

Problem Statement: The Limitations of Document Retrieval

Standard RAG systems often struggle with precision and interpretability. Knowledge Bases, which store information as entities and relationships, offer a more structured alternative. However, integrating KBs with LLMs presents three primary challenges:

  1. Complexity: Multi-hop queries require navigating multiple relational links.
  2. Ambiguity: Entity names (e.g., "Titanic") often refer to multiple distinct concepts.
  3. Expressiveness: Rigid "triple" formats (Subject-Predicate-Object) fail to capture natural language nuances.
KnowledGPT addresses challenges in complex questions, entity disambiguation, and knowledge representation compared to previous methods.

KnowledGPT introduces a robust three-step process: Search Code Generation, Search Execution, and Answer Generation.

Program of Thought (PoT) Prompting

Instead of direct natural language queries, KnowledGPT prompts the LLM to generate Python scripts. By providing a unified API (e.g., get_entity_info, find_relationship), the framework allows the model to use logical operations like loops and variables to navigate complex KB structures.

LLM-based Entity Linking

To resolve ambiguity, the system retrieves candidate entities and leverages the LLM's contextual understanding to select the correct one. This process ensures that the model links to the intended entity rather than just the most similar string.

The Entity Linking workflow uses specialized APIs and GPT-4 to disambiguate target entities from a list of candidates.

Personalized Knowledge Base (PKB)

KnowledGPT features a "writable" memory that extracts knowledge from text into three formats:

  • Entity Descriptions: Detailed encyclopedic text.
  • Relational Triples: Structured factual pairs.
  • Entity-Aspect Information: A hybrid format indexing text snippets by entity and specific "aspects" (e.g., "Socrates" + "Military Service").

Experimental Evaluation

The framework was evaluated using public KBs (Wikipedia, Wikidata, CN-DBPedia) and several benchmarks:

  • NLPCC 2016 KBQA: For standard KB question answering.
  • NLPCC-MH: A set of 59 multi-hop questions for complex reasoning.
  • HotpotQA: To test the "Knowledge Storage" capability by building a PKB from 100 documents.

Key Results and Insights

  • Superior Accuracy: On the NLPCC-100 (single-hop) dataset, KnowledGPT achieved an F1 score of 0.92, significantly outperforming BM25 (0.71) and embedding-based retrieval (0.31).
  • Multi-hop Mastery: It maintained a high F1 of 0.93 on the NLPCC-MH dataset, whereas traditional methods dropped below 0.44.
  • The Value of Aspects: Representing knowledge only as triples is restrictive. Adding "Entity-Aspect" information increased knowledge extraction recall from 0.53 to 0.86.
  • Introspection: An "introspection" step allows the model to evaluate its own generated code and retrieved data, reducing hallucinations.

Conclusion and Future Directions

KnowledGPT demonstrates that structured KB access and writable memory significantly enhance LLM performance on complex tasks. While currently reliant on high-cost models like GPT-4 for code generation, future work aims to fine-tune smaller, open-source models to perform these operations. Additionally, improving the system's ability to "re-plan" after failed searches remains a key area for development.

Summary updated

BibTeX
@misc{wang2023knowledgpt,
  author = {Xintao Wang and Qianwen Yang and Yongting Qiu and Jiaqing Liang and Qianyu He and Zhouhong Gu and Yanghua Xiao and Wei Wang},
  title = {{KnowledGPT: Enhancing Large Language Models with Retrieval and Storage Access on Knowledge Bases}},
  year = {2023},
  eprint = {2308.11761},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.11761},
}
Figure