SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.19029 · 2026

Adaptive Memory and Reflection Multi-Agent System for Medical Question Answering

Xinqi Fan, Xueli Chen, Luoxiao Yang, Pradeep Murugesan

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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/2608.19029.json · badge: /api/ran/2608.19029.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
mm-air/AMR-Agent canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
evaluate_accuracy Ran
ran, honoured the contract we drafted
mm-air/AMR-Agent/evaluate.py
code served (permissive licence) · get_code("6cb12c37db26f8c7")
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 json
import tempfile
from pathlib import Path

# Create a temporary JSON file with sample results
temp_dir = tempfile.TemporaryDirectory()
temp_path = Path(temp_dir.name) / "results.json"

# Create sample results data
sample_results = [
    {
        "ground_truth": "HELLO WORLD",
        "system_answer": "hello world"
    },
    {
        "ground_truth": "PYTHON",
        "system_answer": "PYTHON"
    },
    {
        "ground_truth": "TEST CASE",
        "system_answer": "wrong answer"
    },
    {
        "ground_truth": "  WHITESPACE  ",
        "system_answer": "whitespace"
    }
]

# Write the sample results to the temporary file
with temp_path.open('w', encoding='utf-8') as f:
    json.dump(sample_results, f)

# Define ARGS with the file path parameter
ARGS = {
    "file_path": str(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 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
format_questions_for_llm Ran
ran; our contract draft was wrong, not the code
mm-air/AMR-Agent/data_loader.py
code served (permissive licence) · get_code("ecef11f6e4389e7c")
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 random
from typing import Dict, Any

random.seed(0)

# Create a sample for 'medqa' dataset
medqa_sample = {
    'question': 'What is the primary treatment for hypertension?',
    'options': {
        'A': 'Lifestyle modifications and dietary changes',
        'B': 'Antihypertensive medications',
        'C': 'Regular exercise only',
        'D': 'Surgical intervention'
    }
}

ARGS = {
    'sample': medqa_sample,
    'dataset_name': 'medqa'
}
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
load_medmcqa_data Ran
ran; our contract draft was wrong, not the code
mm-air/AMR-Agent/data_loader.py
code served (permissive licence) · get_code("98a25d768c26e4ed")
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 os
import json
import tempfile
from typing import List, Dict, Any

# Create a temporary directory structure with sample data
temp_dir = tempfile.mkdtemp()
data_dir = os.path.join(temp_dir, 'data', 'medmcqa')
os.makedirs(data_dir, exist_ok=True)

# Create a sample train.jsonl file with MedMCQA format
train_file_path = os.path.join(data_dir, 'train.jsonl')

sample_data = [
    {
        "id": 1,
        "question": "What is the primary cause of condition X?",
        "opa": "Option A description",
        "opb": "Option B description",
        "opc": "Option C description",
        "opd": "Option D description",
        "cop": 0,
        "exp": "The correct answer is A because..."
    },
    {
        "id": 2,
        "question": "Which treatment is most effective for Y?",
        "opa": "Treatment option 1",
        "opb": "Treatment option 2",
        "opc": "Treatment option 3",
        "opd": "Treatment option 4",
        "cop": 2,
        "exp": "The correct answer is C because..."
    },
    {
        "id": 3,
        "question": "What is the mechanism of drug Z?",
        "opa": "Mechanism 1",
        "opb": "Mechanism 2",
        "opc": "Mechanism 3",
        "opd": "Mechanism 4",
        "cop": 1,
        "exp": "The correct answer is B because..."
    },
    {
        "id": 4,
        "question": "Which finding is characteristic of disease W?",
        "opa": "Finding 1",
        "opb": "Finding 2",
        "opc": "Finding 3",
        "opd": "Finding 4",
        "cop": 3,
        "exp": "The correct answer is D because..."
    },
    {
        "id": 5,
        "question": "What is the epidemiology of condition V?",
        "opa": "Epidemiological fact 1",
        "opb": "Epidemiological fact 2",
        "opc": "Epidemiological fact 3",
        "opd": "Epidemiological fact 4",
        "cop": 0,
        "exp": "The correct answer is A because..."
    }
]

# Write sample data to train.jsonl
with open(train_file_path, 'w', encoding='utf-8') as f:
    for item in sample_data:
        f.write(json.dumps(item) + '\n')

ARGS = {
    'dataset_name': 'medmcqa',
    'base_data_path': temp_dir
}
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 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
load_medqa_data Ran
ran; our contract draft was wrong, not the code
mm-air/AMR-Agent/data_loader.py
code served (permissive licence) · get_code("2aa6540e40a9edff")
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 os
import json
import tempfile
import shutil

# Create a temporary directory structure for test
temp_dir = tempfile.mkdtemp()
base_data_path = temp_dir
dataset_name = "medqa"

# Create the expected directory structure
data_dir = os.path.join(base_data_path, "data", dataset_name)
os.makedirs(data_dir, exist_ok=True)

# Create sample test.jsonl file
test_file_path = os.path.join(data_dir, "test.jsonl")
test_samples = [
    {
        "question": "What is the treatment for hypertension?",
        "answer_idx": 0,
        "answer": "ACE inhibitors",
        "options": ["ACE inhibitors", "Antibiotics", "Antihistamines"]
    },
    {
        "question": "Which vitamin deficiency causes scurvy?",
        "answer_idx": 1,
        "answer": "Vitamin C",
        "options": ["Vitamin A", "Vitamin C", "Vitamin D"]
    }
]

with open(test_file_path, 'w', encoding='utf-8') as f:
    for sample in test_samples:
        f.write(json.dumps(sample) + '\n')

# Create sample train.jsonl file
train_file_path = os.path.join(data_dir, "train.jsonl")
train_samples = [
    {
        "question": "What is the normal blood glucose level?",
        "answer_idx": 2,
        "answer": "70-100 mg/dL fasting",
        "options": ["50-70 mg/dL", "100-150 mg/dL", "70-100 mg/dL fasting"]
    },
    {
        "question": "Which organ produces insulin?",
        "answer_idx": 0,
        "answer": "Pancreas",
        "options": ["Pancreas", "Liver", "Kidney"]
    },
    {
        "question": "What is the primary function of hemoglobin?",
        "answer_idx": 0,
        "answer": "Oxygen transport",
        "options": ["Oxygen transport", "Immune response", "Digestion"]
    }
]

with open(train_file_path, 'w', encoding='utf-8') as f:
    for sample in train_samples:
        f.write(json.dumps(sample) + '\n')

ARGS = {
    "dataset_name": dataset_name,
    "base_data_path": base_data_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 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
normalize_answer Ran
ran; our contract draft was wrong, not the code
mm-air/AMR-Agent/evaluate.py
code served (permissive licence) · get_code("9fc3dafdabb9a23a")
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)

ARGS = {
    "value": "  hello world  "
}
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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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.

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-24.

Repositories linked to this paper

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

Abstract

Accurate and responsible medical question answering (QA) is important in healthcare, where complex cases require factual knowledge and nuanced reasoning. Existing medical QA systems, typically based on single-agent architectures and static retrieval, often lack adaptability, persistent memory, and structured decision-making. This work introduces an adaptive memory and reflection (AMR) agentic system, a multi-agent framework in which specialized agents use dedicated memory and reflection-based feedback to retrieve relevant prior cases and improve subsequent reasoning. Complexity assessment routes questions through solo, collaborative, or escalated workflows, while consensus and ethical overseer modules support reasoning consolidation and output review. Evaluation on MedQA and MedMCQA demonstrates strong performance compared with several baselines. Ablation studies show that combining agent-specific memory, reflection, and external retrieval yields the strongest performance. These findings highlight the potential of structured memory and feedback for developing more trustworthy medical agents. The source code is publicly available at https://github.com/mm-air/AMR-Agent.

For agents

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

get_harvested_code_for_paper("2608.19029")
get_code_for_paper("2608.19029")
have("2608.19029")

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

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

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

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

Connect an agent — have() is free.