OpenSPG /KAG
KAG is a logical form-guided reasoning and retrieval framework based on OpenSPG engine and LLMs. It is used to build logical reasoning and factual Q&A solutions for professional domain knowledge bases. It can effectively overcome the shortcomings of the traditional RAG vector similarity calculation model.
★ 9,173⑂ 722👁 75⑃ 275● 456▤ 6
+0
日增长
9,173
stars
722
forks
75
watchers
275
prs
456
issues
6
releases
README
KAG: Knowledge Augmented Generation
English |
简体中文 |
日本語版ドキュメント
1. What is KAG?
KAG is a logical reasoning and Q&A framework based on the OpenSPG engine and large language models, which is used to build logical reasoning and Q&A solutions for vertical domain knowledge bases. KAG can effectively overcome the ambiguity of traditional RAG vector similarity calculation and the noise problem of GraphRAG introduced by OpenIE. KAG supports logical reasoning and multi-hop fact Q&A, etc., and is significantly better than the current SOTA method.
The goal of KAG is to build a knowledge-enhanced LLM service framework in professional domains, supporting logical reasoning, factual Q&A, etc. KAG fully integrates the logical and factual characteristics of the KGs. Its core features include:
- Knowledge and Chunk Mutual Indexing structure to integrate more complete contextual text information
- Knowledge alignment using conceptual semantic reasoning to alleviate the noise problem caused by OpenIE
- Schema-constrained knowledge construction to support the representation and construction of domain expert knowledge
- Logical form-guided hybrid reasoning and retrieval to support logical reasoning and multi-hop reasoning Q&A
⭐️ Star our repository to stay up-to-date with exciting new features and improvements! Get instant notifications for new releases! 🌟
!Star KAG
2. Core Features
2.1 Knowledge Representation
In the context of private knowledge bases, unstructured data, structured information, and business expert experience often coexist. KAG references the DIKW hierarchy to upgrade SPG to a version that is friendly to LLMs.
For unstructured data such as news, events, logs, and books, as well as structured data like transactions, statistics, and approvals, along with business experience and domain knowledge rules, KAG employs techniques such as layout analysis, knowledge extraction, property normalization, and semantic alignment to integrate raw business data and expert rules into a unified business knowledge graph.
!KAG Diagram
This makes it compatible with schema-free information extraction and schema-constrained expertise construction on the same knowledge type (e. G., entity type, event type), and supports the cross-index representation between the graph structure and the original text block.
This mutual index representation is helpful to the construction of inverted index based on graph structure, and promotes the unified representation and reasoning of logical forms.
2.2 Mixed Reasoning Guided by Logic Forms
!Logical Form Solver
KAG proposes a logically formal guided hybrid solution and inference engine.
The engine includes three types of operators: planning, reasoning, and retrieval, which transform natural language problems into problem solving processes that combine language and notation.
In this process, each step can use diffTop issues
#493感觉更新到0.7版本抽取的效果变差很多,有没有大佬也碰到这个问题呀27 comments · 2025-04-25#572ollama18 comments · 2025-06-07#634开发者模式新建知识库,再产品模型应用里,用这个知识库没效果14 comments · 2025-07-07#627[Bug] [Module Name] 在前端配置嵌入模型时报错14 comments · 2025-07-02#523unknown error <class 'RuntimeError'>:invalid vectorizer config:object of type 'NoneType' has no len()14 comments · 2025-05-07#5650.7.1版本构建完知识库,使用自己部署的vllm Qwen3模型进行问答,检索知识库检索不出来chunk12 comments · 2025-05-29#614[Bug] [Module Name] 项目创建失败10 comments · 2025-06-29#513Current UI and Documentation is not matching9 comments · 2025-05-04
Discussions
#744图谱抽取0 comments · 2026-04-09#697How to start the MCPServer in KAG0 comments · 2025-09-09#6720.8.0版本,无法配置ollama模型1 comments · 2025-08-03#671无法配置LLM模型1 comments · 2025-08-02#649昇腾适配0 comments · 2025-07-16#576无法连接到no4j,新安装的,no4j正常启动了,但是生成答案的时候提示无法连接到no4j1 comments · 2025-06-09#474not support ollama chat model can and api llm reach the spg0 comments · 2025-04-22#466not support ollama local embedding model ?0 comments · 2025-04-21
Latest release
Version 0.8.0 v0.8.0 2025-06-28Version 0.8.0 (2025-06-27) 1、Overview We are excited to announce the official release of KAG version 0.8. This update focuses on continuously enhancing the consistency, rigor, and accuracy of large model knowledge base-driven reasoning and question-answering. It also introduces several significant new features and capabilities. First, we have upgraded the capabilities of the KAG knowledge base. We have expanded support for two modes: private domain knowledge bases (including structured and unstructured data) and public domain knowledge bases. This includes the ability to integrate public