SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2506.05154 · ICLR · 2025

Resisting Contextual Interference in RAG via Parametric-Knowledge Reinforcement

Fei Sun, Chenyu Lin, Yilin Wen, Du Su, Hexiang Tan, Muhan Chen, Chenfu Bao, Zhonghou Lyu

arXiv · PDF · Open in the Atlas

Code that ran

3 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-24; 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/2506.05154.json · badge: /api/ran/2506.05154.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
lcy80366872/knowledgeable-r1 canonical (classifier label)
classifier basis: classifier_2025
3 ran · 2 no recorded run
FunctionStatusWhere it lives
calculate_metrics_for_dataset Ran
ran; our contract draft was wrong, not the code
lcy80366872/knowledgeable-r1/get_metric.py
code served (permissive licence) · get_code("74058a584804bb52")
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) and returned DataFrame. 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 pandas as pd
import numpy as np

# Create a sample dataframe with required columns
np.random.seed(0)

n_rows = 20

df = pd.DataFrame({
    'query_only': np.random.choice([True, False], n_rows),
    'is_cf': np.random.choice([True, False], n_rows),
    'method_a': np.random.rand(n_rows),
    'method_b': np.random.rand(n_rows),
    'method_c': np.random.rand(n_rows),
})

dataset_name = "test_dataset"

all_methods = ["method_a", "method_b", "method_c", "method_d"]

ARGS = {
    "df": df,
    "dataset_name": dataset_name,
    "all_methods": all_methods,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
create_summary_tables Ran
ran; our contract draft was wrong, not the code
lcy80366872/knowledgeable-r1/get_metric.py
code served (permissive licence) · get_code("216d106095f0f128")
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) 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 numpy as np
import pandas as pd
from collections import defaultdict

# Construct valid arguments for create_summary_tables

# dataset_results: dict mapping dataset_name -> dict of method -> list of correct predictions
dataset_results = {
    "dataset_1": {
        "method_a": [True, False, True, True],
        "method_b": [True, True, False],
        "method_c": [False, True, True, True, False]
    },
    "dataset_2": {
        "method_x": [True, False],
        "method_y": [True, True, True, False]
    }
}

# dataset_is_cf: dict mapping dataset_name -> list of is_cf boolean values
# Only include for datasets where we want the 'is_cf' column
dataset_is_cf = {
    "dataset_1": [True, False, True, True, False],
    "dataset_2": [False, True]
}

ARGS = {
    "dataset_results": dataset_results,
    "dataset_is_cf": dataset_is_cf
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, pandas — 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
process_results_folder Ran
ran; our contract draft was wrong, not the code
lcy80366872/knowledgeable-r1/get_metric.py
code served (permissive licence) · get_code("b05420ebe972b7e7")
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) 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 with test data
temp_root = tempfile.mkdtemp()

# Create method subdirectories
method1_dir = os.path.join(temp_root, "method1")
method2_dir = os.path.join(temp_root, "method2")
os.makedirs(method1_dir)
os.makedirs(method2_dir)

# Create test JSON files for method1
dataset1_data = {
    "results": [
        {"correct": True, "is_cf": False},
        {"correct": False, "is_cf": True},
        {"correct": True, "is_cf": False},
    ]
}
with open(os.path.join(method1_dir, "dataset1.json"), "w") as f:
    json.dump(dataset1_data, f)

dataset2_data = {
    "results": [
        {"correct": True, "is_cf": True},
        {"correct": True, "is_cf": False},
    ]
}
with open(os.path.join(method1_dir, "dataset2.json"), "w") as f:
    json.dump(dataset2_data, f)

# Create test JSON files for method2
dataset1_data_m2 = {
    "results": [
        {"correct": False, "is_cf": True},
        {"correct": True, "is_cf": False},
    ]
}
with open(os.path.join(method2_dir, "dataset1.json"), "w") as f:
    json.dump(dataset1_data_m2, f)

dataset2_data_m2 = {
    "results": [
        {"correct": False},
        {"correct": True},
    ]
}
with open(os.path.join(method2_dir, "dataset2.json"), "w") as f:
    json.dump(dataset2_data_m2, f)

ARGS = {
    "root_folder": temp_root
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, pandas — 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
get_rope_index Not yet run
unverified (harvested, no recorded run)
lcy80366872/knowledgeable-r1/verl/models/transformers/qwen2_vl.py
code served (permissive licence) · get_code("627247bc47104fec")
How it ran

no invocation recorded.

qwen2_vl_attn_forward Not yet run
unverified (harvested, no recorded run)
lcy80366872/knowledgeable-r1/verl/models/transformers/qwen2_vl.py
code served (permissive licence) · get_code("1e90bebc7c04c766")
How it ran

no invocation recorded.

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, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 2 the same month, 2 later) and 3 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
get_rope_index 7 other papers
2 dated earlier, 1 the same month, 3 later, 1 undated
2504.15716 (2025-04)
DianJin-R1: Evaluating and Enhancing Financial Reasoning in Large Language Models
2505.16282 (2025-05)
ARPO:End-to-End Policy Optimization for GUI Agents with Experience Replay
2506.01908 (2025-06)
Reinforcement Learning Tuning for VideoLLMs: Reward Design and Data Efficiency
and 4 more not named here
qwen2_vl_attn_forward 3 other papers
1 dated earlier, 1 the same month, 1 later
2505.16282 (2025-05)
ARPO:End-to-End Policy Optimization for GUI Agents with Experience Replay
2506.01908 (2025-06)
Reinforcement Learning Tuning for VideoLLMs: Reward Design and Data Efficiency
2605.07465 (2026-05)
SEIF: Self-Evolving Reinforcement Learning for Instruction Following

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

Retrieval-augmented generation (RAG) improves performance on knowledgeintensive tasks but can be derailed by wrong, irrelevant, or conflicting retrieved text, causing models to rely on inaccurate evidence and cascade errors. We propose Knowledgeable-R1, a reinforcement-learning framework that explicitly trains large language models to use parametric knowledge (PK) to resist contextual interference while still exploiting external context when it is reliably helpful. Knowledgeable-R1 introduces a joint sampling scheme that generates paired responses with and without retrieval, and learns both local advantages (within each decoding regime) and global advantages under the same input to quantify when to ignore misleading context versus adopt it. We employ an asymmetric advantage transformation that amplifies exploratory behaviors toward parametric knowledge. Experiments show that Knowledgeable-R1 significantly improves robustness and reasoning accuracy in knowledge conflict scenarios and general RAG scenarios, outperforming SOTA baselines by +22.89% in counterfactual scenarios, and without degradation when the retrieved context is fully accurate. Our code are available at https://github.com/lcy80366872/knowledgeable-R1.

For agents

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

get_harvested_code_for_paper("2506.05154")
get_code_for_paper("2506.05154")
have("2506.05154")

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

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

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

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

Connect an agent — have() is free.