SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2607.26339 · 2026

RAGuard: A Layered Defense Framework for Retrieval-Augmented Generation Systems Against Data Poisoning

Vincent Li, Pushkal Kumar, Tucker Nielson, Tanish Kolhe, Shubham Zala

arXiv · PDF · Open in the Atlas

Code that ran

13 of 14 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, 0 violated it and 0 have no contract verdict; 11 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2607.26339.json · badge: /api/ran/2607.26339.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
RAGuard-AI/RAGuard canonical (classifier label)
classifier basis: census
13 ran · 1 no recorded run
FunctionStatusWhere it lives
bm25_topk Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/run_eval.py
code served (permissive licence) · get_code("91f383fbaf3371b9")
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

# Analyze the function:
# - query: a string that gets .lower() and .split() called on it
# - corpus: an iterable of strings that get .lower() and .count(t) called on them
# - k: an integer for slicing

ARGS = {
    "query": "the quick brown fox",
    "corpus": [
        "the quick brown fox jumps over the lazy dog",
        "a quick brown fox",
        "the lazy dog sleeps",
        "fox and dog",
        "quick quick quick",
        "brown brown brown brown"
    ],
    "k": 5
}
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
cosine Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/zkip.py
code served (permissive licence) · get_code("cf8c7150e4ab53bb")
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 numpy as np

# Create two sample numpy arrays for the cosine similarity function
a = np.array([1.0, 2.0, 3.0, 4.0])
b = np.array([5.0, 6.0, 7.0, 8.0])

ARGS = {
    "a": a,
    "b": b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
em Ran
ran, honoured the contract we drafted
RAGuard-AI/RAGuard/defences/scorer.py
code served (permissive licence) · get_code("81076a2476f2505d")
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 int, ndim 0, dtype family int, 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

def _norm(s: str) -> str:
    s = s.lower()
    s = re.sub('[^a-z0-9\\s]', '', s)
    return ' '.join(s.split())

def em(pred: str, golds: list[str]) -> int:
    p = _norm(pred)
    return int(any((p == _norm(g) for g in golds)))

# Setup code
pred = "Hello, World!"
golds = ["hello world", "HELLO WORLD!", "goodbye"]

ARGS = {
    "pred": pred,
    "golds": golds,
}
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 int, ndim 0, dtype family int, 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
evaluate_bert Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/defences/bert_classifier.py
code served (permissive licence) · get_code("5d651d0039786fb0")
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 torch
import torch.nn as nn
import numpy as np
from sklearn.preprocessing import StandardScaler

torch.manual_seed(0)
np.random.seed(0)

# Create a small BERT-like model that outputs 2 classes
class SimpleModel(nn.Module):
    def __init__(self, input_dim=4, num_classes=2):
        super().__init__()
        self.fc1 = nn.Linear(input_dim, 8)
        self.fc2 = nn.Linear(8, num_classes)
    
    def forward(self, x):
        x = torch.relu(self.fc1(x))
        x = self.fc2(x)
        return x

# Create model instance
model = SimpleModel(input_dim=4, num_classes=2)

# Create a scaler that has transform method
scaler = StandardScaler()
X_train = np.random.randn(10, 4).astype(np.float32)
scaler.fit(X_train)

# Create small test data: 2 samples with 4 features
X = np.random.randn(2, 4).astype(np.float32)
y = np.array([0, 1])

device = 'cpu'

ARGS = {
    'model': model,
    'scaler': scaler,
    'X': X,
    'y': y,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — 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
f1 Ran
ran, honoured the contract we drafted
RAGuard-AI/RAGuard/defences/scorer.py
code served (permissive licence) · get_code("c31fa0dc73b0f2e6")
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 torch
import re

def _norm(s: str) -> str:
    s = s.lower()
    s = re.sub('[^a-z0-9\\s]', '', s)
    return ' '.join(s.split())

def f1(pred: str, golds: list[str]) -> float:
    p = _norm(pred).split()
    if not p:
        return 0.0
    best = 0.0
    for g in golds:
        g = _norm(g).split()
        if not g:
            continue
        common = {}
        for t in set(p):
            common[t] = min(p.count(t), g.count(t))
        overlap = sum(common.values())
        prec = overlap / len(p)
        rec = overlap / len(g)
        if prec + rec > 0:
            best = max(best, 2 * prec * rec / (prec + rec))
    return best

ARGS = {
    "pred": "The quick brown fox jumps",
    "golds": [
        "The quick brown fox jumps over the lazy dog",
        "A quick fox jumps"
    ]
}
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 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
get_feature_importance Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/defences/classifier.py
code served (permissive licence) · get_code("0987423f71997748")
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 numpy as np
from sklearn.linear_model import LogisticRegression

# Create a mock classifier with coef_ attribute
clf = LogisticRegression()

# We need to fit it with dummy data to populate coef_
# Create 8 features (one for each FEATURE_KEY)
X_dummy = np.random.randn(10, 8)
y_dummy = np.random.randint(0, 2, 10)
clf.fit(X_dummy, y_dummy)

ARGS = {
    'clf': clf
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
group_by_field Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/datasets/make_splits.py
code served (permissive licence) · get_code("0cb69b02b952e6fe")
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 defaultdict. 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
from collections import defaultdict
from typing import Iterable, Dict, List, Any

# Construct test data for group_by_field function
items = [
    {"name": "alice", "age": 30, "city": "NYC"},
    {"name": "bob", "age": 25, "city": "LA"},
    {"name": "charlie", "age": 30, "city": "NYC"},
    {"name": "david", "city": "Chicago"},  # missing age field
    {"name": "eve"},  # missing both age and city
]

field = "age"

ARGS = {
    "items": items,
    "field": field,
}
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 defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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_dataset Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/run_eval.py
code served (permissive licence) · get_code("44b364cc1662e154")
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 os
import json
import tempfile
import shutil

# Create a temporary directory for datasets
temp_dir = tempfile.mkdtemp()
datasets_dir = os.path.join(temp_dir, "datasets")
os.makedirs(datasets_dir, exist_ok=True)

# Create sample JSONL files
sample_data = [
    {"text": "example 1", "label": 0},
    {"text": "example 2", "label": 1}
]

# Create clean dataset
clean_path = os.path.join(datasets_dir, "test_clean.jsonl")
with open(clean_path, 'w') as f:
    for item in sample_data:
        f.write(json.dumps(item) + '\n')

# Create poisoned dataset (10% poison ratio)
poisoned_path = os.path.join(datasets_dir, "test_10.jsonl")
with open(poisoned_path, 'w') as f:
    for item in sample_data:
        f.write(json.dumps(item) + '\n')

# Change to temp directory so relative path works
original_cwd = os.getcwd()
os.chdir(temp_dir)

ARGS = {
    "name": "test",
    "poison_ratio": 0.1
}
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 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
load_dataset Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/run_eval_combined_v2.py
code served (permissive licence) · get_code("6fdb338a20943930")
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 os
import json
import tempfile
import random

# Create temporary directory and dataset files for testing
tmpdir = tempfile.mkdtemp()
os.makedirs(f'{tmpdir}/datasets', exist_ok=True)
os.makedirs(f'{tmpdir}/datasets/poisoned', exist_ok=True)

# Create a clean dataset file
clean_data = [
    {'query': 'test query 1', 'gold_doc': 'gold document 1', 'poison_doc': 'poison 1', 'poison_type': 'type_a'},
    {'query': 'test query 2', 'gold_doc': 'gold document 2', 'poison_doc': 'poison 2', 'poison_type': 'type_b'},
    {'query': 'test query 3', 'gold_doc': 'gold document 3', 'poison_doc': 'poison 3', 'poison_type': 'type_a'},
] * 200  # Create 600 samples

clean_path = f'{tmpdir}/datasets/nq_clean.jsonl'
with open(clean_path, 'w') as f:
    for item in clean_data:
        f.write(json.dumps(item) + '\n')

# Create a poisoned dataset file
poisoned_data = [
    {'query': 'poisoned query 1', 'gold_doc': 'gold doc 1', 'poison_doc': 'poison doc 1', 'poison_type': 'backdoor'},
    {'query': 'poisoned query 2', 'gold_doc': 'gold doc 2', 'poison_doc': 'poison doc 2', 'poison_type': 'backdoor'},
    {'query': 'poisoned query 3', 'gold_doc': 'gold doc 3', 'poison_doc': 'poison doc 3', 'poison_type': 'backdoor'},
] * 200  # Create 600 samples

poisoned_path = f'{tmpdir}/datasets/poisoned/nq_poisoned.jsonl'
with open(poisoned_path, 'w') as f:
    for item in poisoned_data:
        f.write(json.dumps(item) + '\n')

# Also create beir clean and poisoned datasets
beir_clean_path = f'{tmpdir}/datasets/beir_clean.jsonl'
with open(beir_clean_path, 'w') as f:
    for item in clean_data:
        f.write(json.dumps(item) + '\n')

beir_poisoned_path = f'{tmpdir}/datasets/poisoned/beir_poisoned.jsonl'
with open(beir_poisoned_path, 'w') as f:
    for item in poisoned_data:
        f.write(json.dumps(item) + '\n')

# Change to temporary directory so relative paths work
original_cwd = os.getcwd()
os.chdir(tmpdir)

ARGS = {
    'name': 'nq',
    'poison_ratio': 0.5,
    'seed': 13,
    'min_eval_samples': 500,
    'beir_scale_vs_nq': 1.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 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
load_feature_table Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/defences/bert_classifier.py
code served (permissive licence) · get_code("e44390a1ed1e2cfc")
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 json
import numpy as np
import tempfile
import os

# Create a temporary JSONL file with sample data
temp_dir = tempfile.mkdtemp()
temp_path = os.path.join(temp_dir, "test_features.jsonl")

# Write sample data to the temp file
sample_data = [
    {
        "rank_pos": 1.0,
        "flip_wrong_to_right": 0.0,
        "em_delta": 0.5,
        "f1_delta": 0.3,
        "entropy_delta": 0.2,
        "sim_q": 0.8,
        "sim_ans": 0.7,
        "sim_z": 0.6,
        "label_is_poison": 0
    },
    {
        "rank_pos": 2.0,
        "flip_wrong_to_right": 1.0,
        "em_delta": 0.4,
        "f1_delta": 0.2,
        "entropy_delta": 0.1,
        "sim_q": 0.9,
        "sim_ans": 0.8,
        "sim_z": 0.7,
        "label_is_poison": 1
    },
    {
        "rank_pos": 3.0,
        "flip_wrong_to_right": 0.0,
        "em_delta": 0.6,
        "f1_delta": 0.4,
        "entropy_delta": 0.3,
        "sim_q": 0.7,
        "sim_ans": 0.6,
        "sim_z": 0.5,
        "label_is_poison": 0
    },
    {
        "rank_pos": 4.0,
        "flip_wrong_to_right": 1.0,
        "em_delta": 0.3,
        "f1_delta": 0.1,
        "entropy_delta": 0.05,
        "sim_q": 0.85,
        "sim_ans": 0.75,
        "sim_z": 0.65,
        "label_is_poison": 1
    }
]

with open(temp_path, 'w') as f:
    for sample in sample_data:
        f.write(json.dumps(sample) + '\n')

ARGS = {
    "path": temp_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
split_groups Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RAGuard-AI/RAGuard/datasets/make_splits.py
code served (permissive licence) · get_code("c4aada83da34342a")
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. 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

# Construct valid arguments for split_groups
group_keys = ['group_a', 'group_b', 'group_c', 'group_d', 'group_e', 'group_f']
ratios = [0.6, 0.2, 0.2]
rng = random.Random(42)

ARGS = {
    'group_keys': group_keys,
    'ratios': ratios,
    'rng': rng
}
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 list — a list 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
train_bert Ran
ran; our contract draft was wrong, not the code
RAGuard-AI/RAGuard/defences/bert_classifier.py
code served (permissive licence) · get_code("f5afb6fc044bb7b8")
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, 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 torch.nn as nn
import numpy as np
from torch.utils.data import DataLoader, TensorDataset
from sklearn.preprocessing import StandardScaler

torch.manual_seed(0)
np.random.seed(0)

# Create small synthetic dataset
X = np.random.randn(10, 8).astype(np.float32)
y = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1], dtype=np.int64)

ARGS = {
    'X': X,
    'y': y,
    'epochs': 2,
    'batch_size': 2,
    'learning_rate': 0.001,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
train_logreg Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RAGuard-AI/RAGuard/defences/classifier.py
code served (permissive licence) · get_code("cc5b7100997b65a0")
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, 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 numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import StandardScaler

np.random.seed(0)

# Create small synthetic dataset
# X: 10 samples, 4 features
X = np.random.randn(10, 4).astype(np.float32)

# y: 10 binary labels (0 or 1)
y = np.random.randint(0, 2, size=10)

ARGS = {
    'X': X,
    'y': y,
    'C': 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
zkip_scores Not yet run
unverified (harvested, no recorded run)
RAGuard-AI/RAGuard/zkip.py
code served (permissive licence) · get_code("b964030e79fbbb92")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 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 14 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-22.

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) systems ground large language models (LLMs) in external corpora, but this reliance exposes them to corpus poisoning: maliciously injected passages that manipulate retrieved evidence. We introduce RAGuard, a layered defense against factual corpus-poisoning attacks on RAG pipelines. The first layer adversarially fine-tunes a dense retriever on synthetic poisoned documents (fabricated facts, contradictions, and reasoning traps), teaching it to downrank malicious passages before generation. The second layer, the Zero-Knowledge Inference Patch (ZKIP), is a label-free, black-box filter: for each retrieved document, it performs a leave-one-out decode and scores the document by the semantic shift and output-entropy change that its removal induces. ZKIP requires no poison labels, no ground-truth answers, and no access to model internals; it compares the model's own answers under counterfactual contexts. On poisoned Natural Questions at 5-30% poison ratios, adversarial retriever training alone reduces but does not eliminate attack success, while ZKIP drives the measured attack success rate to 0.000 in every defended configuration, keeping Recall@5 within 0.03 of the clean-corpus baseline. Supervised analyses on both Natural Questions and BEIR (NFCorpus) confirm that the counterfactual signals ZKIP relies on carry learnable poison structure. The defense costs k+1 generator passes per query (6× for k=5); we analyze batching and early-stopping approximations that reduce this overhead. We also show that keyword-preserving poisons leave lexical retrievers such as BM25 essentially unaffected, an observation that delineates the boundary of the threat model. Code, datasets, and evaluation harnesses are released for reproducibility. An earlier version of this work was accepted to the NeurIPS 2025 Workshop on Responsible Foundation Models (ResponsibleFM) and AAAI 2026 Workshop on New Frontiers in Information Retrieval (FrontierIR). Code, datasets, and evaluation artifacts: https://github.com/RAGuard-AI/RAGuard.

For agents

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

get_harvested_code_for_paper("2607.26339")
get_code_for_paper("2607.26339")
have("2607.26339")

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

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

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

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

Connect an agent — have() is free.