← all repositories
OpenSPG/KAG

Symbolic Reasoning for RAG That Goes Beyond Vector Search

KAG exists because vector-similarity RAG stumbles on multi-hop questions and GraphRAG chokes on OpenIE noise.

8.9k stars Python RAG · SearchLanguage Models
KAG
Not currently ranked — collecting fresh signals.
star history

What it does

KAG is a framework layered on the OpenSPG knowledge-graph engine and LLMs, aimed at vertical-domain Q&A. It ingests everything from news and logs to transactions and expert rules, then unifies them into a business knowledge graph via schema-free extraction or schema-constrained construction. At query time, its kg-solver translates natural-language questions into symbolic logical forms and executes a hybrid pipeline of exact-match retrieval, text retrieval, graph traversal, and numerical calculation.

The interesting bit

Rather than betting everything on embedding similarity, KAG uses a logical-form-guided solver with planning, reasoning, and retrieval operators. It also cross-indexes graph nodes with raw text chunks, letting the system hop between symbolic reasoning and language-based evidence without losing the original context.

Key highlights

  • Supports both schema-free information extraction and schema-constrained expert-knowledge construction on the same entity or event types.
  • Organizes knowledge along a DIKW hierarchy (data, information, knowledge, wisdom) designed to be LLM-friendly.
  • The solver mixes four problem-solving modes: vector/text retrieval, knowledge-graph reasoning, language reasoning, and numerical calculation.
  • Release notes cite an 89% reduction in knowledge-construction token costs in “Lightweight Build” mode, and an open_benchmark directory for SOTA comparisons.
  • Offers an MCP interface for agent workflows and decouples knowledge bases from applications so one app can query multiple KBs.

Caveats

  • The kag-model component is still closed-source; only kg-builder and kg-solver are available so far.
  • It is tightly coupled to the OpenSPG engine and expects Docker-based deployment, so it is not a drop-in library for existing RAG stacks.
  • The README claims “significantly better than the current SOTA method” but does not show specific benchmark figures in the provided text.

Verdict

If you are building professional-domain Q&A—finance, legal, operations—and need multi-hop logical reasoning rather than vector guesswork, KAG is worth evaluating. If you need a quick, framework-agnostic RAG plug-in, look elsewhere.

Frequently asked

What is OpenSPG/KAG?
KAG exists because vector-similarity RAG stumbles on multi-hop questions and GraphRAG chokes on OpenIE noise.
Is KAG open source?
Yes — OpenSPG/KAG is open source, released under the Apache-2.0 license.
What language is KAG written in?
OpenSPG/KAG is primarily written in Python.
How popular is KAG?
OpenSPG/KAG has 8.9k stars on GitHub.
Where can I find KAG?
OpenSPG/KAG is on GitHub at https://github.com/OpenSPG/KAG.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.