Manuscript Offprint
arXiv:2610.37237GraphRAGProv: GraphRAG Meets How-Provenance
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.
Wadie El Amrani
Independent
Toulouse, France
Luis Galárraga
INRIA
Rennes, France
(a) Source-grounded RDF statement occurrences (symbolic chunks)

(b) Query execution and provenance
q: What is the nationality of the director of Kafr Kasem?
Q: SELECT ?nationality WHERE {
:KafrKasem :director ?director .
?director :nationality ?nationality .
}
(?nationality) = :Lebanese
Figure 1: (a) Source-grounded RDF statement occurrences constructed from text. (b) SPARQL question answering and provenance tracing from answer bindings to RDF occurrences and exact source text evidence.
Abstract
GraphRAG systems often use knowledge graphs to retrieve relevant context for an LLM that produces the final answer. That makes answers more inscrutable and therefore less appealing for domains where transparency is paramount. We present GRAPHRAGPROV, an architecture that executes SPARQL queries over source-grounded RDF graphs to compute answers and their how-provenance polynomials. These polynomials record which statement occurrences were used and how they were combined. Because each occurrence is linked to its source text, users can follow these links to check whether the extracted statements reflect the text and whether the query combines them to answer the question. Querying thereby becomes a way to inspect and evaluate the text-to-graph transformation. Our interactive demo examines 400 cases from two multi-hop QA benchmarks, revealing extraction and query errors even when the final answer is correct.
1 Introduction
GraphRAG uses graph structure to connect information across a corpus of text. Microsoft GraphRAG builds entity relation graphs and community summaries, while HippoRAG builds an OpenIE graph and uses Personalized PageRank for retrieval [3, 6]. In many such architectures, the graph determines what evidence reaches an LLM, but the LLM still produces the final answer. A retrieved path or subgraph may therefore show what evidence was available to the LLM without specifying how the returned value was computed. This is limiting in critical settings such as medical diagnosis or computational justice, where the computation leading to an answer may itself need to be verified.
One approach is to produce the answer by querying the graph itself. This requires representing facts from the text documents as explicit statements in a data graph, such as subject-predicate-object triples in RDF. A question can then be translated into SPARQL and evaluated by a graph database engine, so that the query result is the final answer [7, 10]. While this approach is well established when a knowledge graph already exists [4, 7], applying it to document collections requires constructing the graph from text first, as in Neo4j's LLM Graph Builder [9] and KAG [8]. KAG reports answering questions from retrieved subgraphs in 33%, 34%, and 18% of cases on HotpotQA, 2WikiMultiHopQA, and MuSiQue, respectively, and supplements graph reasoning with text retrieval when it yields no results. GRAPHRAGPROV instead uses an LLM to translate questions into SPARQL, with the returned bindings constituting the answers and no text retrieval or LLM generation as a fallback. To make these computations inspectable, we augment query evaluation with database how-provenance [5], which identifies the contributing statements and records how they were combined. The database computes both the answers and their derivations, without requiring an LLM to interpret retrieved context. Each returned binding is annotated with a polynomial over statement identifiers:
El Amrani and Galárraga
(a) Graph construction

(b) Query generation and execution
Figure 2: GraphRAGProv architecture. An LLM extracts semantic statements and their textual evidence. The localizer resolves evidence to exact source spans for RDF-star materialization. An LLM generates SPARQL, which NPCs rewrites to compute answer bindings and how-provenance.
multiplication records joint use, while addition records alternative derivations. NPCs [2] computes these annotations by query rewriting over reified RDF statements.
A derivation identifies the statements used to compute an answer, but does not establish whether those statements are supported by the source text. GRAPHRAGPROV makes this interpretation inspectable by preserving each extraction as a statement occurrence linked to its source passage and evidence spans. The extractor supplies quotations for the subject, predicate, and object; a deterministic localizer resolves them to exact character spans, and RDF-star reification preserves the occurrence identifier and its source links. NPCs [2] uses these identifiers in provenance polynomials, so following a factor recovers both the assertion used in the computation and the original text against which that assertion can be checked.
Together, query execution, how-provenance, and textual grounding provide a way to inspect and evaluate the text-to-graph transformation. The extractor may misread a passage, entity identifiers may be inconsistent, or the generated SPARQL may fail to capture the question. This explicit chain allows users to examine whether the contributing statements reflect the source text and whether the query combines them as intended.
The present demonstration lets users move across this complete chain: question → SPARQL → answer binding → provenance polynomial → RDF occurrence → exact source spans and modify either the question or the SPARQL query to observe how the answer and its derivation change. We examine the availability and diagnostic value of this trace on 400 cases from 2WikiMultiHopQA and MuSiQue.
Query execution. Figure 2(b) shows the answering process. Given a question q and the constructed graph, an LLM generates a SPARQL query Q, which GraphDB executes to obtain answer bindings . NPCs [2] rewrites the query to additionally compute how provenance . For the Kafr Kasem example, the database returns Lebanese, with . Multiplication represents the joint use of statement occurrences, while addition represents alternative derivations [5]. Each provenance identifier resolves to its source evidence, completing the trace in Figure 1(b):
3 Demonstration
The live demonstration is publicly accessible, and the source code is available under the MIT license.
GraphRAGProv: GraphRAG Meets How-Provenance

Figure 3: GRAPHRAGProv interactive workbench. Users can inspect SPARQL queries, follow answer derivations through how-provenance, and highlight source expressions associated with participating RDF statements.
User Experience. Figure 3 shows the GraphRAGProv workbench. Users can explore recorded cases from 2WikiMultiHopQA and MuSiQue, each containing the benchmark question, source paragraphs, and constructed RDF graph. Selecting a graph statement highlights its supporting text and vice versa. Users can inspect the LLM-generated SPARQL query, execute it, and examine the returned answers and how-provenance polynomials. Selecting a provenance factor reveals the contributing statement and its textual evidence. The workbench also allows editing natural-language questions or SPARQL queries to observe changes in answers and derivations.
Implementation. GraphDB stores the RDF graphs, with named graphs separating source paragraphs. The React frontend communicates with a FastAPI backend. SPARQL queries are rewritten using a Rust implementation of NPCS to compute answer bindings and how-provenance. Graph construction and query generation use DeepSeek-V4-Flash. The extraction and query-generation prompts can be found in the source code.
4 Evaluation
Experimental setting. We examine 200 compositional questions from 2WikiMultiHopQA and 200 answerable questions from Musique. For each case, the graph is constructed from its designated supporting passages, excluding document retrieval from the experiment. Graph construction and SPARQL generation use DeepSeek-V4-Flash, with access to the benchmark question, expected answer, and reasoning evidence. This supervised setting allows us to examine the resulting graphs and computations, but does not establish generalization to unseen questions. We retain the first query that passes mechanical validation and executes, without retrying based on answer correctness.
Trace availability. Table 1 reports the number of cases reaching each stage. A complete trace requires every factor in the decoded derivations to resolve to its statement occurrence and matching source spans. Complete traces are available for 193 of 200 2Wiki cases and 118 of 200 MuSiQue cases. All 311 decoded traces pass the occurrence and source-span checks, and their answer bindings match ordinary query execution. Sixteen MuSiQue cases return an answer without decoded provenance.
Case inspection. Table 2 illustrates what can be learned by inspecting the computation and its sources. In Meesaya Murukku, the answer is correct and the cited word “Indian” exists at the recorded offsets, but it describes the film rather than its director. The error lies in the interpretation of the text, not in provenance resolution. Labyrinth reveals a different problem: the query returns the correct year using two individually supported assertions, yet never establishes that Acornsoft published the game. Its provenance faithfully records the executed computation, but that computation does not express the question. In contrast, the Caledon River case yields a sufficient derivation from one passage containing both required
https://github.com/wadie999/sparql-prov
https://github.com/wadie999/graphragprov/blob/main/src/graphragprov/extraction/prompt.py
https://github.com/wadie999/graphragprov/blob/main/src/graphragprov/qaagent/prompt.py
El Amrani and Galárraga
| Stage | 2Wiki | MuSiQue | Total |
|---|---|---|---|
| Cases | 200 | 200 | 400 |
| SPARQL executed | 200 | 198 | 398 |
| Answer returned | 193 | 134 | 327 |
| Provenance decoded | 193 | 118 | 311 |
| Complete text trace | 193 | 118 | 311 |
Table 1: Answer-to-source trace availability.
relations, despite the benchmark designating two supporting passages.
Missing answers. An empty result provides no answer derivation to inspect. In Aldobrandino, the father relation and birth date are present in the graph, but attached to different IRIs representing the same person. The resulting join fails despite the required information being extracted. This failure is identified by inspecting the graph and query directly, rather than following provenance of a nonexistent result.
| Question and case ID | Inspection finding |
|---|---|
| Meesaya Murukku (2Wiki)Which country is its director from?ba413fca0bd911eba7f7acde48001122 | Correct answer, India, but the cited text describes the film as Indian, not its director. |
| Labyrinth (MuSiQue)When did its publisher cease operating?2hop__170823_120171 | Correct answer, 1986, but the query omits the game-publisher relation. |
| Aldobrandino (2Wiki)When was his father born?96a72db40bdd11eba7f7acde48001122 | Two IRIs represent the same father, preventing the join. |
| Caledon River (MuSiQue)Where is the source of the receiving river?2hop__207597_63853 | One passage supports both required relations, although the benchmark designates two. |
Table 2: Representative cases. Red identifies an unsupported assertion, an incorrect query, or an empty result; gray indicates unavailable provenance stages. Questions are abbreviated, and case IDs identify the saved experiments.
5 Conclusion
An executable query answers what it asks of a graph, not necessarily what the user asked of the original text: answering the original question also requires the graph to preserve the relevant knowledge and the query to express the intended computation. GRAPHRAGPROV makes this distinction inspectable. SPARQL specifies the computation, how-provenance identifies the contributing statement occurrences, and symbolic chunks connect them to their textual origins. These connections allow users to inspect the interpretations made by the LLM during graph construction. Our demonstrations show why these layers must be examined together: supported statements may participate in an incorrect query, correct answers may depend on unsupported interpretations, and missing answers may result from inconsistent entity representations rather than absent knowledge. Provenance exposes the chain to help users locate and diagnose failures.
References
[1] Gabor Angeli, Melvin Jose Johnson Premkumar, and Christopher D. Manning. 2015. Leveraging Linguistic Structure for Open Domain Information Extraction. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers). Association for Computational Linguistics, 344–354. doi:10.3115/v1/P15-1034
[2] Zubaria Asma, Daniel Hernández, Luis Galárraga, Giorgos Flouris, Irini Fundulaki, and Katja Hose. 2024. NPCS: Native Provenance Computation for SPARQL. In Proceedings of the ACM Web Conference 2024. 2085–2093. doi:10.1145/3589334.3645557
[3] Darren Edge, Ha Trinh, Newman Cheng, Joshua Bradley, Alex Chao, Apurva Mody, Steven Truitt, Dasha Metropolitansky, Robert Osazuwa Ness, and Jonathan Larson. 2024. From Local to Global: A Graph RAG Approach to Query-Focused Summarization. arXiv preprint arXiv:2404.16130 (2024).
[4] Yanlin Feng, Simone Papicchio, and Sajjadur Rahman. 2025. CypherBench: Towards Precise Retrieval over Full-scale Modern Knowledge Graphs in the LLM Era. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, Vienna, Austria, 8934–8958. doi:10.18653/v1/2025.acl-long.438
[5] Todd J. Green, Gregory Karvounarakis, and Val Tannen. 2007. Provenance Semirings. In Proceedings of the 26th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems. 31–40. doi:10.1145/1265530.1265535
[6] Bernal Jiménez Gutiérrez, Yiheng Shu, Yu Gu, Michihiro Yasunaga, and Yu Su. 2024. HippoRAG: Neurobiologically Inspired Long-Term Memory for Large Language Models. In Advances in Neural Information Processing Systems, Vol. 37. doi:10.52202/079017-1902
[7] Yunshi Lan, Gaole He, Jinhao Jiang, Jing Jiang, Wayne Xin Zhao, and Ji-Rong Wen. 2021. A Survey on Complex Knowledge Base Question Answering: Methods, Challenges and Solutions. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence. 4483–4491. doi:10.24963/ijcai.2021/611
[8] Lei Liang, Zhongpu Bo, Zhengke Gui, Zhongshu Zhu, Ling Zhong, Peilong Zhao, Mengshu Sun, Zhiqiang Zhang, Jun Zhou, Wenguang Chen, Wen Zhang, and Huajun Chen. 2025. KAG: Boosting LLMs in Professional Domains via Knowledge Augmented Generation. In Companion Proceedings of the ACM on Web Conference 2025. Association for Computing Machinery, New York, NY, USA, 334–343. doi:10.1145/3701716.3715240
[9] Neo4j Labs. 2024. LLM Graph Builder: Neo4j Graph Construction from Unstructured Data Using LLMs. GitHub repository. https://github.com/neo4j-labs/llm-graph-builder Accessed 2026-08-29.
[10] Boci Peng, Yun Zhu, Yongchao Liu, Xiaohe Bo, Haizhou Shi, Chuntao Hong, Yan Zhang, and Siliang Tang. 2025. Graph Retrieval-Augmented Generation: A Survey. ACM Transactions on Information Systems 44, 2, Article 35 (2025), 52 pages. doi:10.1145/3777378
[11] Yuzhao Yang, Genlang Chen, Binhua He, and Yan Zhao. 2026. Grounded Knowledge Graph Extraction via LLMs: An Anchor-Constrained Framework with Provenance Tracking. Computers 15, 3 (2026), 178. doi:10.3390/computers15030178