TL;DR
This paper introduces BYOKG-RAG, a novel framework that significantly improves Question Answering (QA) over custom Knowledge Graphs (KGs). By synergistically combining Large Language Models (LLMs) with specialized graph retrieval tools, BYOKG-RAG overcomes limitations of existing methods, leading to more robust and accurate answers, especially for complex queries and diverse KG structures.
What Problem Does This Paper Address?
Knowledge Graph Question Answering (KGQA) is challenging because KGs can have complex structures and semantic variations. Existing approaches often rely on LLM agents to navigate and retrieve information from KGs. However, this can lead to errors in entity linking and retrieval, and these methods struggle to generalize to custom KGs ("bring-your-own" KGs) that lack extensive training data. The core problem is how to effectively and robustly retrieve relevant information from diverse, custom KGs to answer natural language questions, especially when dealing with complex queries that go beyond simple fact retrieval.
Methods
BYOKG-RAG employs a two-stage approach:
- KG-Linker (LLM-driven artifact generation): An LLM is prompted to generate crucial "graph artifacts." These include:
- Entities: Identifying key entities from the question and context.
- Relation Paths: Suggesting plausible sequences of relationships to connect entities.
- Graph Queries: Generating executable queries (e.g., in OpenCypher) to retrieve information.
- Draft Answers: Providing initial answer candidates.
- Specialized Graph Retrievers: These artifacts are then fed into a toolkit of specialized graph tools. These tools perform:
- Entity Linking: Mapping LLM-generated entities to actual entities in the KG using string matching and embedding similarity.
- Path Retrieval: Executing LLM-generated relation paths and discovering alternative routes.
- Graph Query Retrieval: Executing generated graph queries against the KG.
- Triplet Retrieval: Capturing relevant facts at the triplet level, using both agentic (step-by-step LLM exploration) and scoring-based (semantic similarity) methods.
The retrieved context is then used iteratively to refine the LLM's artifact generation, leading to improved accuracy in subsequent steps. This multi-strategy approach aims for robustness and generalization.
Datasets
The paper evaluates BYOKG-RAG on several benchmarks:
- WebQSP & CWQ: Datasets answerable over the Freebase KG, involving general knowledge and multi-hop queries.
- WebQSP-IH & CWQ-IH: In-house subsets of WebQSP and CWQ.
- CronQuestions: Questions requiring temporal reasoning over a KG subset of Wikidata.
- MedQA: Questions extracted from USMLE exams, combined with the Disease DrugBank KG.
- Text2cypher: Emulates enterprise KG queries, using the Northwind dataset.
No new benchmarks were introduced.
Key Insights and Ideas
- Multi-strategy retrieval is key: Combining different retrieval methods (agentic, path-based, query-based, triplet-based) is more effective than relying on a single strategy, especially for diverse KG structures and query types.
- LLMs as artifact generators: Leveraging LLMs to generate intermediate graph artifacts (entities, paths, queries) acts as a powerful bridge between natural language questions and structured KG data.
- Iterative refinement improves accuracy: Using the context retrieved in earlier steps to refine the LLM's artifact generation in subsequent steps significantly boosts performance.
- Generalization to custom KGs: The framework's design, particularly its reliance on LLM-generated artifacts rather than KG-specific fine-tuning, allows it to perform well on "bring-your-own" KGs.
Key Results
- BYOKG-RAG outperforms the second-best graph retrieval method by an average of 4.5 percentage points across benchmarks.
- On Freebase-KG benchmarks (WebQSP-IH, CWQ-IH), BYOKG-RAG achieved 86.6% and 73.6% Hit rates, outperforming baselines.
- For temporal reasoning on CronQuestions, BYOKG-RAG achieved a 65.5% Hit rate, a significant gain over text-based retrieval.
- On the MedQA benchmark, BYOKG-RAG improved H@2 performance to 65.0% compared to graph-query's 59.2%.
- On enterprise KGs (Northwind), BYOKG-RAG achieved a 64.9% LLMaaJ score, outperforming graph-query.
- The framework shows robust performance across different LLM backbones (Claude-Sonnet-3.5, Claude-Haiku-3.5, Llama-3.3-70B).
- The scoring-based variant of BYOKG-RAG maintains strong performance while using significantly fewer LLM calls.
Limitations and Future Work
- Context Pruning: Without proper context pruning mechanisms, retrieved context can become too lengthy, potentially confusing LLMs with limited context-handling capabilities.
- KG as Sole Information Source: The current work considers the KG as the only source of external information.
- Future Work:
- Incorporate additional information sources, such as text databases, to enhance the framework's applications.
- Develop more sophisticated context pruning mechanisms.
Summary updated