{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/simple-is-effective-the-roles-of-graphs-and","title":"Simple Is Effective: The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation","arxiv_id":"2410.20724","date":"2024-10-28","proceeding":null,"authors":["Mufei Li","Siqi Miao","Pan Li"],"abstract":"Large Language Models (LLMs) demonstrate strong reasoning abilities but face limitations such as hallucinations and outdated knowledge. Knowledge Graph (KG)-based Retrieval-Augmented Generation (RAG) addresses these issues by grounding LLM outputs in structured external knowledge from KGs. However, current KG-based RAG frameworks still struggle to optimize the trade-off between retrieval effectiveness and efficiency in identifying a suitable amount of relevant graph information for the LLM to digest. We introduce SubgraphRAG, extending the KG-based RAG framework that retrieves subgraphs and leverages LLMs for reasoning and answer prediction. Our approach innovatively integrates a lightweight multilayer perceptron with a parallel triple-scoring mechanism for efficient and flexible subgraph retrieval while encoding directional structural distances to enhance retrieval effectiveness. The size of retrieved subgraphs can be flexibly adjusted to match the query's need and the downstream LLM's capabilities. This design strikes a balance between model complexity and reasoning power, enabling scalable and generalizable retrieval processes. Notably, based on our retrieved subgraphs, smaller LLMs like Llama3.1-8B-Instruct deliver competitive results with explainable reasoning, while larger models like GPT-4o achieve state-of-the-art accuracy compared with previous baselines -- all without fine-tuning. Extensive evaluations on the WebQSP and CWQ benchmarks highlight SubgraphRAG's strengths in efficiency, accuracy, and reliability by reducing hallucinations and improving response grounding.","url_abs":"https://arxiv.org/abs/2410.20724v3","url_pdf":"https://arxiv.org/pdf/2410.20724v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"simple-is-effective-the-roles-of-graphs-and","repo_url":"https://github.com/graph-com/subgraphrag","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"rag","task_name":"RAG"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"retrieval-augmented-generation","task_name":"Retrieval-augmented Generation"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bart","method_name":"BART"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"rag","method_name":"RAG"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.20724","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.20724"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/Graph-COM/SubgraphRAG","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/graph-com/subgraphrag","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":15},"by_repo_kind":{"official":{"samples":15,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"550b5f94b8beddc9","entry":"DDE","repo":"graph-com/subgraphrag","repo_kind":"official","path":"retrieve/src/model/retriever.py","file_url":"https://github.com/graph-com/subgraphrag/blob/HEAD/retrieve/src/model/retriever.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"550b5f94b8beddc9"}},{"code_sha256_prefix":"d880094e7f8ff325","entry":"PEConv","repo":"graph-com/subgraphrag","repo_kind":"official","path":"retrieve/src/model/retriever.py","file_url":"https://github.com/graph-com/subgraphrag/blob/HEAD/retrieve/src/model/retriever.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d880094e7f8ff325"}},{"code_sha256_prefix":"a0086a56c06edbff","entry":"Retriever","repo":"graph-com/subgraphrag","repo_kind":"official","path":"retrieve/src/model/retriever.py","file_url":"https://github.com/graph-com/subgraphrag/blob/HEAD/retrieve/src/model/retriever.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a0086a56c06edbff"}},{"code_sha256_prefix":"e9ac43b7da6ba57c","entry":"add_good_triplets_from_rog","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/preprocess/prepare_data.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/preprocess/prepare_data.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e9ac43b7da6ba57c"}},{"code_sha256_prefix":"8c5cdfd40b64ee0e","entry":"collate_retriever","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"retrieve/src/dataset/retriever.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/retrieve/src/dataset/retriever.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8c5cdfd40b64ee0e"}},{"code_sha256_prefix":"e8b1bf34a1cb6dc9","entry":"eval_acc","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/metrics/evaluate_results.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/metrics/evaluate_results.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e8b1bf34a1cb6dc9"}},{"code_sha256_prefix":"de4fa8c6d43e92ba","entry":"extract_reasoning_paths","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/preprocess/prepare_data.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/preprocess/prepare_data.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"de4fa8c6d43e92ba"}},{"code_sha256_prefix":"d55e014013622a43","entry":"get_outputs","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/llm_utils.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/llm_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d55e014013622a43"}},{"code_sha256_prefix":"e10c90222af8eebc","entry":"get_subgraphs","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/preprocess/prepare_data.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/preprocess/prepare_data.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e10c90222af8eebc"}},{"code_sha256_prefix":"f75dc97b8ef40987","entry":"match","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/metrics/evaluate_results.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/metrics/evaluate_results.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f75dc97b8ef40987"}},{"code_sha256_prefix":"65f5735d2fdf887d","entry":"normalize","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/metrics/evaluate_results.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/metrics/evaluate_results.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"65f5735d2fdf887d"}},{"code_sha256_prefix":"ef25b6bc0f20fd61","entry":"remove_duplicates","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/metrics/evaluate_results_corrected.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/metrics/evaluate_results_corrected.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ef25b6bc0f20fd61"}},{"code_sha256_prefix":"eb1396e410d9258d","entry":"remove_same_head_tail","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/preprocess/prepare_prompts.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/preprocess/prepare_prompts.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"eb1396e410d9258d"}},{"code_sha256_prefix":"00d642ca06785bce","entry":"triplet_to_str","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/preprocess/prepare_prompts.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/preprocess/prepare_prompts.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"00d642ca06785bce"}},{"code_sha256_prefix":"736e6887c841cf2a","entry":"unique_preserve_order","repo":"Graph-COM/SubgraphRAG","repo_kind":"official","path":"reason/preprocess/prepare_prompts.py","file_url":"https://github.com/Graph-COM/SubgraphRAG/blob/HEAD/reason/preprocess/prepare_prompts.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"736e6887c841cf2a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}