DO-RAG: A Domain-Specific QA Framework Using Knowledge Graph-Enhanced Retrieval-Augmented Generation

David Osei Opoku, Ming Sheng, Yong Zhang2025 · DOI

TL;DR

This paper introduces DO-RAG, a novel framework for domain-specific question answering that significantly improves factual accuracy by integrating knowledge graphs with retrieval-augmented generation (RAG). DO-RAG automates the creation of dynamic, multi-level knowledge graphs from unstructured documents and fuses this structured knowledge with semantic search to generate highly precise and grounded answers, mitigating common LLM hallucinations.

What Problem Does This Paper Address?

Current question-answering (QA) systems, especially those operating in specialized domains (like technical manuals or scientific literature), face a critical challenge: balancing generative fluency with factual accuracy. While large language models (LLMs) have become incredibly adept at generating human-like text, they often struggle with domain-specific terminology, complex reasoning, and can "hallucinate" information not present in their training data. Retrieval-Augmented Generation (RAG) has emerged as a solution by grounding LLM responses in retrieved documents. However, existing RAG frameworks often fail to capture the intricate relationships within technical documents, leading to fragmented information and persistent inaccuracies. Furthermore, manually constructing and maintaining knowledge graphs (KGs), which offer structured, relational knowledge, is a labor-intensive and scalability-limiting process. This paper aims to bridge this gap by proposing a framework that automates KG construction and effectively integrates it with RAG for robust, domain-specific QA.

Methods

DO-RAG employs a four-stage pipeline:

  1. Multimodal Document Ingestion and Chunking: The system processes diverse data types (text, tables, images, code) and segments them into manageable chunks, retaining metadata for traceability.
  2. Agentic, Multi-Level Knowledge Graph Construction: This is a core innovation. DO-RAG uses a hierarchical, multi-agent system (High-Level, Mid-Level, Low-Level, and Covariate Agents) to automatically extract entities, their relationships, and attributes from the ingested documents. This process creates a dynamic, structured knowledge graph that captures fine-grained operational details and dependencies.
  3. Hybrid Retrieval Fusion: At query time, DO-RAG first decomposes the user's query into sub-queries. It then performs a hybrid retrieval that combines:
  4. Graph Traversal: Navigating the constructed KG to find relevant entities and relationships.
  5. Semantic Vector Search: Using dense embeddings to find semantically similar document chunks. The results from both retrieval methods are fused to create a rich, context-aware prompt for the LLM.

  6. Grounded Answer Generation and Refinement: The LLM generates an initial answer based on the fused context. This is followed by a crucial grounded refinement step. This stage cross-verifies the generated answer against the knowledge graph and iteratively corrects any inconsistencies or hallucinations, ensuring factual accuracy. The system also generates follow-up questions to enhance user engagement.

Datasets

The paper evaluated DO-RAG on two datasets:

  • SunDB Dataset: This is the primary dataset, derived from a distributed relational database management system. It includes technical manuals, system logs, and specifications with embedded tables and code.
  • Electrical Dataset: A secondary dataset comprising manuals and schematics with diagrams.

Each dataset contained 245 expert-curated questions with ground-truth answers, annotated with source locations for validation. The paper does not introduce a new benchmark dataset but uses existing domain-specific data for evaluation.

Key Insights and Ideas

  • Automated, Multi-Level KG Construction: The agentic pipeline for KG construction is a significant advancement. It moves beyond static, manually curated KGs to dynamic, automatically updated knowledge structures that capture complex relationships from multimodal data.
  • Hybrid Retrieval for Comprehensive Context: Simply relying on either vector search or KG traversal is insufficient. DO-RAG's fusion of both ensures that both explicit semantic similarities and structured relational knowledge contribute to the LLM's prompt, leading to more informed generation.
  • Grounded Refinement as a Hallucination Killer: The post-generation refinement step, which actively cross-verifies LLM outputs against the KG, is critical for ensuring factual accuracy. This iterative correction mechanism directly addresses the hallucination problem in LLMs.
  • Plug-and-Play Modularity: The framework is designed to be adaptable, allowing for the integration of diverse LLMs and retrieval modules without extensive retraining, which is crucial for practical deployment.

Key Results

DO-RAG demonstrated impressive performance on the SunDB and Electrical domains:

  • Near-perfect Contextual Recall (CR): Achieved 1.000 in many configurations, indicating that all relevant information was retrieved.
  • Over 94% Answer Relevancy (AR): The generated answers were highly aligned with the user's queries.
  • Outperformance of Baselines: DO-RAG outperformed existing RAG platforms like FastGPT, TiDB.AI, and Dify.AI by up to 33.38% in composite scores.
  • Impact of KG Integration: Internal comparisons showed that integrating the knowledge graph significantly improved Contextual Recall and Contextual Precision for LLMs.

Limitations and Future Work

  • LLM Creativity and Hallucinations: Despite grounding, creative LLMs like DeepSeek-R1 occasionally introduced hallucinations, suggesting that prompt engineering for stricter factual adherence needs further refinement.
  • Dataset Size: The datasets, while expert-curated, were limited to 245 questions per domain, which might not cover all rare or edge-case queries, potentially impacting generalizability.
  • Computational Overhead: The multi-agent extraction and hybrid retrieval processes, while optimized, still represent significant computational overhead, especially for real-time updates in large-scale deployments.

Future work will focus on:

  • Enhanced Hallucination Mitigation: Stricter prompt engineering to prioritize factual adherence.
  • Dataset Expansion: Including more diverse and edge-case queries to improve robustness.
  • Scalability Improvements: Exploring distributed processing and adaptive caching mechanisms to reduce latency and enhance scalability.

Summary updated

Abstract

Domain-specific QA systems require not just generative fluency but high factual accuracy grounded in structured expert knowledge. While recent Retrieval-Augmented Generation (RAG) frameworks improve context recall, they struggle with integrating heter
BibTeX
@misc{opoku2025do,
  author = {David Osei Opoku and Ming Sheng and Yong Zhang},
  title = {{DO-RAG: A Domain-Specific QA Framework Using Knowledge Graph-Enhanced Retrieval-Augmented Generation}},
  year = {2025},
  doi = {10.36227/techrxiv.174837976.69904638/v1},
}
Figure