SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.20724 · ICLR · 2025

Simple is Effective: The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation

Pan Li, Siqi Miao, Mufei Li

arXiv · PDF · Open in the Atlas

Code that ran

9 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 6 failures of our instrument; 6 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2410.20724.json · badge: /api/ran/2410.20724.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Graph-COM/SubgraphRAG canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
graph-com/subgraphrag community
Papers with Code archive
0 ran · 3 no recorded run
FunctionStatusWhere it lives
collate_retriever Ran
ran; our contract draft was wrong, not the code
Graph-COM/SubgraphRAG/retrieve/src/dataset/retriever.py
code served (permissive licence) · get_code("8c5cdfd40b64ee0e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct a sample dict that matches what collate_retriever expects
sample = {
    'h_id_list': [1, 2, 3],
    'r_id_list': [4, 5],
    't_id_list': [6, 7, 8, 9],
    'q_emb': torch.randn(4),
    'entity_embs': torch.randn(5, 6),
    'non_text_entity_list': [1, 2],
    'relation_embs': torch.randn(3, 6),
    'topic_entity_one_hot': torch.randn(7),
    'target_triple_probs': torch.randn(2),
    'a_entity_id_list': [10, 11, 12]
}

# The function expects data to be a list (it accesses data[0])
data = [sample]

ARGS = {
    'data': data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
eval_acc Ran
ran, honoured the contract we drafted
Graph-COM/SubgraphRAG/reason/metrics/evaluate_results.py
code served (permissive licence) · get_code("e8b1bf34a1cb6dc9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import string

def normalize(s: str) -> str:
    """Lower text and remove punctuation, articles and extra whitespace."""
    s = s.lower()
    exclude = set(string.punctuation)
    s = ''.join((char for char in s if char not in exclude))
    s = re.sub('\\b(a|an|the)\\b', ' ', s)
    s = re.sub('\\b(<pad>)\\b', ' ', s)
    s = ' '.join(s.split())
    return s

def match(s1: str, s2: str) -> bool:
    s1 = normalize(s1)
    s2 = normalize(s2)
    return s2 in s1

def eval_acc(prediction, answer):
    matched = 0.0
    for a in answer:
        if match(prediction, a):
            matched += 1
    return matched / len(answer)

# Setup code
prediction = "The quick brown fox jumps over the lazy dog"
answer = [
    "quick brown fox",
    "lazy dog",
    "nonexistent phrase"
]

ARGS = {
    "prediction": prediction,
    "answer": answer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_reasoning_paths Ran
ran; our contract draft was wrong, not the code
Graph-COM/SubgraphRAG/reason/preprocess/prepare_data.py
code served (permissive licence) · get_code("de4fa8c6d43e92ba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def extract_reasoning_paths(text):
    pattern = 'Reasoning Paths:(.*?)\\n\\nQuestion:'
    match = re.search(pattern, text, re.DOTALL)
    if match:
        reasoning_paths = match.group(1).strip()
        return reasoning_paths
    else:
        return None

# Create valid arguments for the function
text_with_reasoning = """Some preamble here.
Reasoning Paths:
Path 1: Start with A, then go to B
Path 2: Start with C, then go to D
Multiple reasoning steps here.

Question: What is the answer?"""

ARGS = {
    "text": text_with_reasoning
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
match Ran
ran, violated the contract we drafted
Graph-COM/SubgraphRAG/reason/metrics/evaluate_results.py
code served (permissive licence) · get_code("f75dc97b8ef40987")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import string

def normalize(s: str) -> str:
    """Lower text and remove punctuation, articles and extra whitespace."""
    s = s.lower()
    exclude = set(string.punctuation)
    s = ''.join((char for char in s if char not in exclude))
    s = re.sub('\\b(a|an|the)\\b', ' ', s)
    s = re.sub('\\b(<pad>)\\b', ' ', s)
    s = ' '.join(s.split())
    return s

def match(s1: str, s2: str) -> bool:
    s1 = normalize(s1)
    s2 = normalize(s2)
    return s2 in s1

ARGS = {
    "s1": "The quick brown fox jumps over the lazy dog",
    "s2": "quick brown fox"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize Ran
ran; our contract draft was wrong, not the code
Graph-COM/SubgraphRAG/reason/metrics/evaluate_results.py
code served (permissive licence) · get_code("65f5735d2fdf887d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import string

torch_imported = False
try:
    import torch
    torch_imported = True
except ImportError:
    pass

# The normalize function takes a single parameter: s (a string)
# Reading the body, it:
# - calls s.lower()
# - iterates through characters
# - uses string.punctuation
# - applies regex substitutions
# - uses s.split() and ' '.join()
# All of these are standard string operations

ARGS = {
    "s": "The quick brown fox jumps over the lazy dog. A <pad> an."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
remove_duplicates Ran
ran; our contract draft was wrong, not the code
Graph-COM/SubgraphRAG/reason/metrics/evaluate_results_corrected.py
code served (permissive licence) · get_code("ef25b6bc0f20fd61")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function remove_duplicates takes an input_list and removes duplicate items
# while preserving order. It uses:
# - iteration over the list
# - membership testing with 'in' operator on items
# - append() method on result list
# - add() method on a set

# Create a simple input list with some duplicates
# Using hashable items (integers, strings, tuples) that support 'in' operator
input_list = [1, 2, 3, 2, 4, 1, 5, 3, 6]

ARGS = {
    "input_list": input_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
remove_same_head_tail Ran
ran, honoured the contract we drafted
Graph-COM/SubgraphRAG/reason/preprocess/prepare_prompts.py
code served (permissive licence) · get_code("eb1396e410d9258d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct triplets - each triplet is a tuple of (head, relation, tail)
triplets = [
    (0, 1, 2),
    (2, 1, 0),  # Same head and tail as first, different order - should be filtered
    (3, 4, 5),
    (5, 4, 3),  # Same head and tail as third, different order - should be filtered
    (1, 2, 3),
]

mode = 'rmht'

ARGS = {
    'triplets': triplets,
    'mode': mode,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
triplet_to_str Ran
ran; our contract draft was wrong, not the code
Graph-COM/SubgraphRAG/reason/preprocess/prepare_prompts.py
code served (permissive licence) · get_code("00d642ca06785bce")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function triplet_to_str accesses triplet[0], triplet[1], and triplet[2]
# and converts them to strings. A triplet can be a tuple, list, or any indexable
# sequence of three elements.

triplet = (42, "hello", 3.14)

ARGS = {
    "triplet": triplet
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
unique_preserve_order Ran
ran; our contract draft was wrong, not the code
Graph-COM/SubgraphRAG/reason/preprocess/prepare_prompts.py
code served (permissive licence) · get_code("736e6887c841cf2a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function unique_preserve_order takes an input_list parameter
# and removes duplicates while preserving order.
# It iterates through items, checks if they're in a set, and adds them to output.
# The items need to be hashable (support 'in' operator with sets).

# Valid input: a list of hashable items (strings, ints, tuples, etc.)
input_list = [1, 2, 3, 2, 4, 1, 5, 3, 2]

ARGS = {
    "input_list": input_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DDE Not yet run
unverified (harvested, no recorded run)
graph-com/subgraphrag/retrieve/src/model/retriever.py
code served (permissive licence) · get_code("550b5f94b8beddc9")
How it ran

no invocation recorded.

PEConv Not yet run
unverified (harvested, no recorded run)
graph-com/subgraphrag/retrieve/src/model/retriever.py
code served (permissive licence) · get_code("d880094e7f8ff325")
How it ran

no invocation recorded.

Retriever Not yet run
unverified (harvested, no recorded run)
graph-com/subgraphrag/retrieve/src/model/retriever.py
code served (permissive licence) · get_code("a0086a56c06edbff")
How it ran

no invocation recorded.

add_good_triplets_from_rog Not yet run
unverified (harvested, no recorded run)
Graph-COM/SubgraphRAG/reason/preprocess/prepare_data.py
code served (permissive licence) · get_code("e9ac43b7da6ba57c")
How it ran

no invocation recorded.

get_outputs Not yet run
unverified (harvested, no recorded run)
Graph-COM/SubgraphRAG/reason/llm_utils.py
code served (permissive licence) · get_code("d55e014013622a43")
How it ran

no invocation recorded.

get_subgraphs Not yet run
unverified (harvested, no recorded run)
Graph-COM/SubgraphRAG/reason/preprocess/prepare_data.py
code served (permissive licence) · get_code("e10c90222af8eebc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 12 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
match 2 other papers
1 dated earlier, 1 same year, order not determinable
2024.findings-emnlp.927 (2024 (year only))
Less is More: Making Smaller Language Models Competent Subgraph Retrievers for Multi-hop KGQA
2402.11199 (2024-02)
Direct Evaluation of Chain-of-Thought in Multi-hop Reasoning with Knowledge Graphs
eval_acc 1 other paper
1 dated earlier
2402.11199 (2024-02)
Direct Evaluation of Chain-of-Thought in Multi-hop Reasoning with Knowledge Graphs
normalize 1 other paper
1 same year, order not determinable
2024.findings-emnlp.927 (2024 (year only))
Less is More: Making Smaller Language Models Competent Subgraph Retrievers for Multi-hop KGQA

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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 (MLP) 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 needs 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. Our implementation is available at https://github.com/Graph-COM/SubgraphRAG.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.20724")
get_code_for_paper("2410.20724")
have("2410.20724")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2410.20724.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2410.20724.svg)](https://syntology.ai/paper/2410.20724)

Connect an agent — have() is free.