KAG框架如何实现多跳推理?2026年垂直知识库解决方案
KAG is a logical reasoning and Q&A framework based on OpenSPG engine and large language models, designed to build solutions for vertical domain knowledge bases. It overcomes traditional RAG limitations and supports multi-hop reasoning.
原文翻译: KAG是基于OpenSPG引擎和大语言模型的逻辑推理与问答框架,用于构建垂直领域知识库的解决方案。它克服了传统RAG的局限性,支持多跳推理。
English | 简体中文 | 日本語版ドキュメント
1. 什么是 KAG?
KAG 是一个基于 OpenSPG 引擎和大语言模型的逻辑推理与问答框架,用于构建垂直领域知识库的逻辑推理与问答解决方案。KAG 能够有效克服传统 RAG 向量相似度计算的模糊性以及 GraphRAG 因 OpenIE 引入的噪声问题。KAG 支持逻辑推理、多跳事实问答等,其性能显著优于当前的 SOTA 方法。
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.
KAG 的目标是在专业领域构建一个知识增强的 LLM 服务框架,支持逻辑推理、事实问答等。KAG 深度融合了知识图谱的逻辑性与事实性特征。其核心特性包括:
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)
- 概念语义推理的知识对齐:缓解由 OpenIE 引起的噪声问题 (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! 🌟
2. 核心特性
2.1 知识表示
在私有知识库场景中,非结构化数据、结构化信息与业务专家经验往往并存。KAG 参考 DIKW 层次模型,将 SPG 升级为对 LLM 友好的版本。
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.
对于新闻、事件、日志、书籍等非结构化数据,以及交易、统计、审批等结构化数据,连同业务经验和领域知识规则,KAG 采用版面分析、知识抽取、属性归一化、语义对齐等技术,将原始业务数据和专家规则整合为统一的业务知识图谱。
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.
这使得在同一知识类型(例如实体类型、事件类型)上兼容无模式信息抽取和模式约束的专家知识构建,并支持图结构与原始文本块之间的交叉索引表示。
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 逻辑形式引导的混合推理
KAG 提出了一种逻辑形式引导的混合求解与推理引擎。
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 different operators, such as exact match retrieval, text retrieval, numerical calculation or semantic reasoning, so as to realize the integration of four different problem solving processes: Retrieval, Knowledge Graph reasoning, language reasoning and numerical calculation.
3. 发布说明
3.1 最新更新
- 2025.06.27 : 发布 KAG 0.8.0 版本
- 扩展了两种模式:私有知识库(包含结构化与非结构化数据)和公共网络知识库,支持通过 MCP 协议集成 LBS、WebSearch 等公共数据源。
- 增强了私有知识库索引能力,内置了 Outline、Summary、KnowledgeUnit、AtomicQuery、Chunk、Table 等基础索引类型。
- 解耦了知识库与应用:知识库管理私有数据(结构化与非结构化)和公共数据;应用可关联多个知识库,并根据知识库构建时建立的索引类型自动适配相应的检索器进行数据召回。
- 全面拥抱 MCP,使 KAG 驱动的推理问答(通过 MCP 协议)能够在智能体工作流中运行。
- 完成了 KAG-Thinker 模型的适配。通过广度问题分解、深度解决方案推导、知识边界确定和抗噪声检索结果等方面的优化,在多轮迭代思维框架的指导下,提升了框架推理范式的稳定性和逻辑严谨性。
- 2025.06.27 : Released KAG 0.8.0 Version
- Expanded two modes: Private Knowledge Base (including structured & unstructured data) and Public Network Knowledge Base, supporting integration of LBS, WebSearch, and other public data sources via MCP protocol.
- Enhanced Private Knowledge Base indexing capabilities, with built-in fundamental index types such as Outline, Summary, KnowledgeUnit, AtomicQuery, Chunk, and Table.
- Decoupled knowledge bases from applications: Knowledge Bases manage private data (structured & unstructured) and public data; Applications can associate with multiple knowledge bases and automatically adapt corresponding retrievers for data recall based on index types established during knowledge base construction.
- Fully embraced MCP, enabling KAG-powered inference QA (via MCP protocol) within agent workflows.
- Completed adaptation for the KAG-Thinker model. Through optimizations in breadth-wise problem decomposition, depth-wise solution derivation, knowledge boundary determination, and noise-resistant retrieval results, the framework's reasoning paradigm stability and logical rigor have been improved under the guidance of multi-round iterative thinking frameworks.
- 2025.06.27 : Released KAG 0.8.0 Version
- 2025.04.17 : 发布 KAG 0.7 版本
- 首先,我们重构了 KAG-Solver 框架。增加了对静态和迭代两种任务规划模式的支持,同时为推理阶段实现了更严谨的知识分层机制。
- 其次,我们优化了产品体验:在推理阶段引入了“简单模式”和“深度推理”双模式,并支持流式推理输出、自动渲染图谱索引以及将生成内容链接到原始参考。
- 在 KAG 仓库顶层添加了 open_benchmark 目录,在同一基准下比较各种 RAG 方法,以达到最先进的(SOTA)结果。
- 引入了“轻量级构建”模式,将知识构建的 token 成本降低了 89%。
- 2025.04.17 : Released KAG 0.7 Version
- First, we refactored the KAG-Solver framework. Added support for two task planning modes, static and iterative, while implementing a more rigorous knowledge layering mechanism for the reasoning phase.
- Second, we optimized the product experience: introduced dual modes—"Simple Mode" and "Deep Reasoning"—during the reasoning phase, along with support for streaming inference output, automatic rendering of graph indexes, and linking generated content to original references.
- Added an open_benchmark directory to the top level of the KAG repository, comparing various RAG methods under the same base to achieve state-of-the-art (SOTA) results.
- Introduced a "Lightweight Build" mode, reducing knowledge construction token costs by 89%.
- 2025.04.17 : Released KAG 0.7 Version
- 2025.01.07 : 支持领域知识注入、领域模式定制、QFS 任务支持、可视化查询分析,启用模式约束的抽取模式等。
2025.01.07 : Support domain knowledge injection, domain schema customization, QFS tasks support, Visual query analysis, enables schema-constraint mode for extraction, etc.
- 2024.11.21 : 支持 Word 文档上传、模型调用并发设置、用户体验优化等。
2024.11.21 : Support Word docs upload, model invoke concurrency setting, User experience optimization, etc.
- 2024.10.25 : KAG 初始版本发布
2024.10.25 : KAG initial release
3.2 未来计划
- 我们将继续专注于增强大模型利用外部知识库的能力。我们的目标是实现大模型与符号知识的双向增强与无缝集成,提升专业场景下推理与问答的事实性、严谨性和一致性。我们也将持续发布更新,以突破能力边界并推动在垂直领域的应用。
We will continue to focus on enhancing large models' ability to leverage external knowledge bases. Our goal is to achieve bidirectional enhancement and seamless integration between large models and symbolic knowledge, improving the factuality, rigor, and consistency of reasoning and Q&A in professional scenarios. We will also keep releasing updates to push the boundaries of capability and drive adoption in vertical domains.
4. 快速开始
4.1 产品模式(面向普通用户)
4.1.1 引擎与依赖镜像安装
- 推荐系统版本:
macOS 用户:macOS Monterey 12.6 或更高版本 Linux 用户:CentOS 7 / Ubuntu 20.04 或更高版本 Windows 用户:Windows 10 LTSC 2021 或更高版本macOS User:macOS Monterey 12.6 or later
Linux User:CentOS 7 / Ubuntu 20.04 or later
Windows User:Windows 10 LTSC 2021 or later - 软件要求:
macOS / Linux 用户:Docker,Docker Compose Windows 用户:WSL 2 / Hyper-V,Docker,Docker ComposemacOS / Linux User:Docker,Docker Compose
Windows User:WSL 2 / Hyper-V,Docker,Docker Compose
使用以下命令下载 docker-compose.yml 文件,并使用 Docker Compose 启动服务。
Use the following commands to download the docker-compose.yml file and launch the services with Docker Compose.
# 设置 HOME 环境变量(仅 Windows 用户需要执行此命令)
# set HOME=%USERPROFILE%
curl -sSL https://raw.githubusercontent.com/OpenSPG/openspg/refs/heads/master/dev/release/docker-compose-west.yml -o docker-compose-west.yml
docker compose -f docker-compose-west.yml up -d
4.1.2 使用产品
使用浏览器导航至 KAG 产品的默认 URL:[http
常见问题(FAQ)
KAG是什么,它和传统RAG有什么区别?
KAG是基于OpenSPG引擎和大语言模型的逻辑推理与问答框架,用于构建垂直领域知识库解决方案。它克服了传统RAG向量相似度计算的模糊性,支持多跳推理。
KAG的核心特性有哪些?
KAG深度融合知识图谱的逻辑性与事实性特征,支持逻辑形式引导的混合推理和多跳事实问答,性能显著优于当前SOTA方法。
如何开始使用KAG?
可通过GitHub获取最新版本,参考用户指南和快速开始文档,也可加入Discord社区获取支持。KAG采用Apache 2.0开源协议。
版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。
文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。
若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。 也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。


