Papers › GNN-RAG: Graph Neural Retrieval for Large Language Model Reasoning

GNN-RAG: Graph Neural Retrieval for Large Language Model Reasoning

30 May 2024arXiv:2405.20139archive 2025-07-28

Costas Mavromatis, George Karypis

Knowledge Graphs (KGs) represent human-crafted factual knowledge in the form of triplets (head, relation, tail), which collectively form a graph. Question Answering over KGs (KGQA) is the task of answering natural questions grounding the reasoning to the information provided by the KG. Large Language Models (LLMs) are the state-of-the-art models for QA tasks due to their remarkable ability to understand natural language. On the other hand, Graph Neural Networks (GNNs) have been widely used for KGQA as they can handle the complex graph information stored in the KG. In this work, we introduce GNN-RAG, a novel method for combining language understanding abilities of LLMs with the reasoning abilities of GNNs in a retrieval-augmented generation (RAG) style. First, a GNN reasons over a dense KG subgraph to retrieve answer candidates for a given question. Second, the shortest paths in the KG that connect question entities and answer candidates are extracted to represent KG reasoning paths. The extracted paths are verbalized and given as input for LLM reasoning with RAG. In our GNN-RAG framework, the GNN acts as a dense subgraph reasoner to extract useful graph information, while the LLM leverages its natural language processing ability for ultimate KGQA. Furthermore, we develop a retrieval augmentation (RA) technique to further boost KGQA performance with GNN-RAG. Experimental results show that GNN-RAG achieves state-of-the-art performance in two widely used KGQA benchmarks (WebQSP and CWQ), outperforming or matching GPT-4 performance with a 7B tuned LLM. In addition, GNN-RAG excels on multi-hop and multi-entity questions outperforming competing approaches by 8.9--15.5% points at answer F1.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2405.20139")

Code

Syntology Ran 6 of 7 code samples harvested from 1 repository linked to this paper; 1 has no recorded run. Of those that ran: 6 ran with no contract checked.

By repository: official repository: 7 samples from 1 repository, 6 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

cmavro/gnn-rag officialmentioned in paperpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

7 samples harvested; 6 ran; 0 honoured the contract we drafted; 1 has no recorded run. Read from Syntology's graph 2026-09-25; that is when this build read the record, not when the samples ran.

6ran
1unverified

Licence: 7 of the 7 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from cmavro/gnn-rag. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

bool_flag cmavro/gnn-rag/gnn/parsing.py official repository ran no licence file found · pointer only · 9d12a8337900a239 · report
cal_accuracy cmavro/gnn-rag/gnn/evaluate.py official repository ran no licence file found · pointer only · e2b0054974cf0526 · report
create_logger cmavro/gnn-rag/gnn/utils.py official repository ran no licence file found · pointer only · a315b40cce5ae385 · report
f1_and_hits cmavro/gnn-rag/gnn/evaluate.py official repository ran no licence file found · pointer only · 9aa7cb6d0f2560d0 · report
get_dict cmavro/gnn-rag/gnn/utils.py official repository ran no licence file found · pointer only · 89b3368210f04f55 · report
load_dict cmavro/gnn-rag/gnn/dataset_load.py official repository ran no licence file found · pointer only · df9be8b9ddd85c0a · report
load_dict_int cmavro/gnn-rag/gnn/dataset_load.py official repository unverified no licence file found · pointer only · 5ca072611eda850e · report

Tasks

Graph Question AnsweringKnowledge GraphsLanguage ModelingLanguage ModellingLarge Language ModelNatural QuestionsQuestion AnsweringRAGRetrievalRetrieval-augmented Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionAttention DropoutBARTBERTBPEDense ConnectionsDropoutGPT-4Label SmoothingLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionPosition-Wise Feed-Forward LayerRAGResidual ConnectionSoftmaxTransformerWeight DecayWordPiece

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections