SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2606.00610 · 2026

MemGraphRAG: Memory-based Multi-Agent System for Graph Retrieval-Augmented Generation

Qinggang Zhang, Jinsong Su, Zerui Chen, Zhishang Xiang, Yunbo Tang, Chuanjie Wu

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2606.00610.json · badge: /api/ran/2606.00610.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
XMUDeepLIT/MemGraphRAG canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
load_openie_results Ran
ran; our contract draft was wrong, not the code
XMUDeepLIT/MemGraphRAG/code/src/Memory.py
code served (permissive licence) · get_code("29a45b7da8401ed8")
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 dict. 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 json
import tempfile
import os

# Create a temporary JSON file with OpenIE results
temp_dir = tempfile.mkdtemp()
openie_results = {
    "docs": [
        {
            "docid": "doc1",
            "sentences": [
                {
                    "text": "The quick brown fox jumps over the lazy dog",
                    "tuples": [
                        {"arg1": "The quick brown fox", "rel": "jumps over", "arg2": "the lazy dog"}
                    ]
                }
            ]
        },
        {
            "docid": "doc2",
            "sentences": [
                {
                    "text": "John loves Mary",
                    "tuples": [
                        {"arg1": "John", "rel": "loves", "arg2": "Mary"}
                    ]
                }
            ]
        }
    ]
}

# Write the temporary JSON file
temp_path = os.path.join(temp_dir, "openie_results.json")
with open(temp_path, 'w', encoding='utf-8') as f:
    json.dump(openie_results, f)

ARGS = {
    "path": temp_path
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
make_cache_embed Ran
ran; our contract draft was wrong, not the code
XMUDeepLIT/MemGraphRAG/code/src/embedding_model/base.py
code served (permissive licence) · get_code("24b1b1fe74f82908")
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 function. 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
import numpy as np
import tempfile
import os

torch.manual_seed(0)

# Create a simple encode function that returns embeddings
def simple_encode_func(**kwargs):
    prompts = kwargs.get('prompts', [])
    # Return a list of numpy arrays (embeddings)
    embeddings = [np.random.randn(4).astype(np.float32) for _ in prompts]
    return embeddings

# Create a temporary cache file
temp_dir = tempfile.gettempdir()
cache_file = os.path.join(temp_dir, "test_cache_embed.db")

# Clean up if it exists
if os.path.exists(cache_file):
    os.remove(cache_file)
if os.path.exists(cache_file + '.lock'):
    os.remove(cache_file + '.lock')

ARGS = {
    'encode_func': simple_encode_func,
    'cache_file_name': cache_file,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
filelock, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
mean_pooling Ran
ran; our contract draft was wrong, not the code
XMUDeepLIT/MemGraphRAG/code/src/embedding_model/Contriever.py
pointer only (licence: MIT); the stored copy get_code serves, from chenyiqun/MMOA-RAG, is pointer only (licence: NONE) · get_code("fe0e2df4d9cb5edd")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from chenyiqun/MMOA-RAG, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mean_pooling Ran
ran; our contract draft was wrong, not the code
XMUDeepLIT/MemGraphRAG/code/src/embedding_model/BGE.py
code served (permissive licence) · get_code("482812b35d0ebc18")
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 Tensor, ndim 2, dtype family float, shape (2, 3) 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 torch

torch.manual_seed(0)

# token_embeddings: shape (batch_size, seq_length, embedding_dim)
# mask: shape (batch_size, seq_length) with 1s for valid tokens, 0s for padding

token_embeddings = torch.randn(2, 4, 3)  # batch=2, seq_len=4, embedding_dim=3
mask = torch.tensor([
    [1, 1, 1, 0],  # first sequence has 3 valid tokens
    [1, 1, 0, 0]   # second sequence has 2 valid tokens
], dtype=torch.long)

ARGS = {
    "token_embeddings": token_embeddings,
    "mask": mask
}
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 Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) 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
resolve_bge_large_en_v15_repo Ran
ran; our contract draft was wrong, not the code
XMUDeepLIT/MemGraphRAG/code/src/embedding_model/BGE.py
code served (permissive licence) · get_code("5231d69fb74ea349")
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 os
import tempfile

# Create a temporary directory to test the local path resolution
temp_dir = tempfile.mkdtemp()

# Test case 1: Simple shorthand that should resolve to full HF ID
model_name_shorthand = 'bge-large-en-v1.5'

# Test case 2: Full HF ID (should return as-is)
model_name_full = 'BAAI/bge-large-en-v1.5'

# Test case 3: Local directory path
model_name_local = temp_dir

# Test case 4: Empty string
model_name_empty = ''

# Test case 5: Path with backslashes (will be normalized)
model_name_backslash = 'some\\path\\bge-large-en-v1.5'

# Use the shorthand case as the main test
ARGS = {
    'model_name': 'bge-large-en-v1.5'
}
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
split_text Ran
ran; our contract draft was wrong, not the code
XMUDeepLIT/MemGraphRAG/code/index.py
code served (permissive licence) · get_code("5d30b7275852c019")
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 float; 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


class MockTokenizer:
    """Stand-in tokenizer that implements the methods used by split_text."""
    
    def __init__(self):
        self.model_max_length = 512
        # Simple mock: map characters to token IDs
        self.char_to_id = {chr(i): i for i in range(32, 127)}
        self.id_to_char = {i: chr(i) for i in range(32, 127)}
    
    def encode(self, text, add_special_tokens=False):
        """Convert text to token IDs."""
        # Simple encoding: each character maps to an ID
        token_ids = []
        for char in text:
            if char in self.char_to_id:
                token_ids.append(self.char_to_id[char])
            else:
                token_ids.append(ord('?'))
        return token_ids
    
    def decode(self, token_ids, skip_special_tokens=False, clean_up_tokenization_spaces=False):
        """Convert token IDs back to text."""
        chars = []
        for token_id in token_ids:
            if token_id in self.id_to_char:
                chars.append(self.id_to_char[token_id])
        result = ''.join(chars)
        if clean_up_tokenization_spaces:
            result = result.replace('  ', ' ')
        return result


# Create test arguments
ARGS = {
    'text': 'Hello world this is a test string for tokenization',
    'tokenizer': MockTokenizer(),
    'chunk_size': 10,
    'overlap': 2
}
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 float — 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
build_two_layer_memory_from_raw_openie Not yet run
unverified (harvested, no recorded run)
XMUDeepLIT/MemGraphRAG/code/src/Memory.py
code served (permissive licence) · get_code("795865289a7a214f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 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, 1 later) and 4 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
mean_pooling 15 other papers
15 dated earlier
2304.11406 (2023-04)
LaMP: When Large Language Models Meet Personalization
2305.18395 (2023-05)
Knowledge-Augmented Reasoning Distillation for Small Language Models in Knowledge-Intensive Tasks
2308.04275 (2023-08)
In-Context Alignment: Chat with Vanilla Language Models Before Fine-Tuning
and 12 more not named here
make_cache_embed 1 other paper
1 dated earlier
2602.01965 (2026-02)
Breaking the Static Graph: Context-Aware Traversal for Robust Retrieval-Augmented Generation
mean_pooling 1 other paper
1 later
2608.04488 (2026-08)
Energy-and Memory-Efficient PEFT Methods for Personalized On-Device SLMs on Consumer GPUs

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

Retrieval-Augmented Generation (RAG) has become an essential method for mitigating hallucinations in Large Language Models (LLMs) by leveraging external knowledge. Although effective for simple queries, traditional RAG struggles with large-scale, unstructured corpora where information is highly fragmented. Graphbased RAG (GraphRAG) incorporates knowledge graphs to capture structural relationships, enabling more comprehensive retrieval for complex reasoning. However, existing GraphRAG methods rely on isolated, fragment-level extraction for graph construction, lacking a global perspective on the whole corpus. As a result, these methods frequently lead to thematically inconsistent, logically conflicting, and structurally fragmented graphs that degrade retrieval performance. In this paper, we propose MemGraphRAG, a novel framework that introduces a memory-based multi-agent system to ensure high-quality graph construction. Specifically, MemGraphRAG employs a collaborative society of agents supported by shared memory, which provides a unified global context throughout the extraction process. This mechanism allows agents to dynamically resolve logical conflicts and maintain structural connectivity throughout the corpus. Furthermore, we propose a memory-aware hierarchical retrieval algorithm tailored for the constructed graph. Extensive experiments on multiple benchmarks demonstrate that MemGraphRAG outperforms the state-of-the-art baseline models with comparable efficiency. Our code is available at https://github.com/XMUDeepLIT/MemGraphRAG.

For agents

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

get_harvested_code_for_paper("2606.00610")
get_code_for_paper("2606.00610")
have("2606.00610")

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

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

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

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

Connect an agent — have() is free.