KERAG (Knowledge-Enhanced Retrieval-Augmented Generation) is an implementation of the paper arXiv:2509.04716. It boosts QA coverage by expanding a subgraph around query entities from a knowledge graph, then using LLMs to score relevance and generate answers with Chain-of-Thought reasoning.
Four-phase pipeline
- Planning — Identifies key entities in the query
- Retrieval — Expands a multi-hop neighbourhood in the knowledge graph via SPARQL (or REST APIs)
- Filtering — LLM-based relevance scoring trims noise from the retrieved subgraph
- Summarization — CoT-based answer generation grounded in the filtered evidence
What makes it useful
- Multi-hop neighbourhood expansion so the answer doesn’t depend on a single node match
- Async throughout — full
async/awaitsupport for high-throughput workloads - Multi-provider: OpenAI, Anthropic (Claude), Google (Gemini), xAI (Grok)
- SPARQL knowledge bases and REST API-based graph systems both supported
- 100% success rate across workflow, chain, and core tests (64.4% overall coverage)
The codebase is designed to be extended — swap in a custom knowledge base, add a new LLM provider, or plug it into an existing RAG stack.