OneKE: A Dockerized Schema-Guided LLM Agent-based Knowledge Extraction System

Yujie Luo, Xiangyuan Ru, Kangwei Liu, Lin Yuan, Mengshu Sun, Ningyu Zhang, Lei Liang, Zhiqiang Zhang, Jun Zhou, Lanning Wei, Da Zheng, Haofen Wang, Huajun Chen · DOI

Abstract: We introduce OneKE, a dockerized schema-guided knowledge extraction system, which can extract knowledge from the Web and raw PDF Books, and support various domains (science, news, etc.). Specifically, we design OneKE with multiple agents and a configure knowledge base. Different agents perform their respective roles, enabling support for various extraction scenarios. The configure knowledge base facilitates schema configuration, error case debugging and correction, further improving the performance. Empirical evaluations on benchmark datasets demonstrate OneKE's efficacy, while case studies further elucidate its adaptability to diverse tasks across multiple domains, highlighting its potential for broad applications. We have open-sourced the Code at https://github.com/zjunlp/OneKE and released a Video at http://oneke.openkg.cn/demo.mp4.

Introduction

Knowledge Extraction (KE) is a fundamental pillar for modern AI applications, including Knowledge Graph construction and Retrieval-Augmented Generation (RAG). However, transitioning KE from research to real-world application presents significant challenges: handling complex, unstructured data formats like messy HTML or multi-page PDFs, and overcoming the "black box" nature of LLM-based tools that often require expensive fine-tuning for error correction. OneKE addresses these pain points by providing a robust, dockerized multi-agent system designed for end-to-end information extraction and automated schema generation.

Methodology

OneKE employs a multi-agent architecture supported by a Configure Knowledge Base. The system is divided into three specialized agents that coordinate to transform raw data into structured knowledge:

  • Schema Agent: Acts as the architect, utilizing LangChain-based loaders to ingest various file formats (PDF, Word, HTML). It performs "Self Schema Deduction" to create structured templates using Pydantic objects based on user instructions.
  • Extraction Agent: The primary processing unit, supporting both open-source (LLaMA, Qwen) and proprietary (GPT-4) models. It utilizes Case Retrieval to search a repository for similar successful extractions, providing the model with effective few-shot reasoning paths.
  • Reflection Agent: Serves as a quality controller by identifying uncertain results through self-consistency checks. It retrieves "Bad Cases" (past errors) to allow the system to "reflect" and correct its current output.
The multi-agent architecture of OneKE, featuring Schema, Extraction, and Reflection agents.

The entire pipeline is dockerized, ensuring a "plug-and-play" deployment experience that maintains environment consistency across different infrastructures.

Experimental Evaluation

The authors evaluated OneKE on two primary benchmarks: CrossNER (cross-domain Named Entity Recognition) and NYT-11-HRL (Relation Extraction). The evaluation, conducted using LLaMA-3-8B and GPT-4-turbo, highlighted the tangible benefits of the agentic approach.

Performance comparison on CrossNER and NYT-11-HRL datasets showing the impact of Case Retrieval and Reflection.

Key Results

  • Case Retrieval Performance: This component proved to be the most significant performance driver, particularly for complex Relation Extraction tasks where reasoning paths are non-obvious.
  • The Value of Reflection: The "Case Reflection" mechanism consistently improved F1 scores across all tasks, validating the utility of a secondary pass that specifically considers prior mistakes.
  • Handling Long Contexts: Qualitative case studies demonstrated OneKE's ability to process a 17-page PDF of Harry Potter, successfully extracting characters and settings through effective chunking and agent coordination.

Discussion and Insights

OneKE introduces several innovative concepts to the KE field. By treating Schema-as-Code (via Pydantic), the system ensures that LLM outputs are valid, serializable data ready for database integration. Furthermore, the focus on Negative Feedback Loops—learning from what the system did wrong previously—is highly effective at preventing hallucinations. Finally, the system's Format Agnosticism bridges the gap between raw documents and LLM-ready text, a critical step for real-world utility.

Limitations and Future Work

While OneKE is a powerful framework, future development will focus on multimodal extraction to analyze charts and tables within documents. Additionally, the team aims to optimize the balance between the computational cost of multi-agent reflection rounds and processing speed. OneKE remains an active open-source project to keep pace with the evolving LLM landscape.

Summary updated

BibTeX
@inproceedings{luo2024oneke,
  author = {Yujie Luo and Xiangyuan Ru and Kangwei Liu and Lin Yuan and Mengshu Sun and Ningyu Zhang and Lei Liang and Zhiqiang Zhang and Jun Zhou and Lanning Wei and Da Zheng and Haofen Wang and Huajun Chen},
  title = {{OneKE: A Dockerized Schema-Guided LLM Agent-based Knowledge Extraction System}},
  booktitle = {The Web Conference},
  year = {2024},
  doi = {10.1145/3701716.3715189},
}
Figure