SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.03537 · ICLR · 2025

Ward: Provable RAG Dataset Inference via LLM Watermarks

Martin Vechev, Maximilian Baader, Nikola Jovanović, Robin Staab

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 0 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/2410.03537.json · badge: /api/ran/2410.03537.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
eth-sri/ward canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
expand_dict_over_key Ran
ran; our contract draft was wrong, not the code
eth-sri/ward/src/config/meta_config.py
code served (permissive licence) · get_code("3027055671300776")
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.

from copy import deepcopy
from typing import Any, Dict, List, Tuple

# Construct test arguments for expand_dict_over_key
d = {
    "model": {
        "learning_rate": 0.001,
        "layer_sizes": [64, 128, 256]
    },
    "training": {
        "epochs": 10,
        "batch_size": 32
    }
}

key = ("model", "layer_sizes")

ARGS = {
    "d": d,
    "key": key
}
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
expand_dicts_over_key Ran
ran; our contract draft was wrong, not the code
eth-sri/ward/src/config/meta_config.py
code served (permissive licence) · get_code("30082b4c248c1b16")
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.

from copy import deepcopy
from typing import Any, Dict, List, Tuple

# Construct valid arguments for expand_dicts_over_key
# The function takes:
# - dicts: List[Dict[str, Any]]
# - key: Tuple[str]

# Create a nested dict structure where the key points to a list
dict1 = {
    "model": "bert",
    "config": {
        "learning_rates": [0.001, 0.01, 0.1],
        "hidden_dim": 256
    },
    "batch_size": 32
}

dict2 = {
    "model": "gpt",
    "config": {
        "learning_rates": [0.0001, 0.0005],
        "hidden_dim": 512
    },
    "batch_size": 64
}

dicts = [dict1, dict2]
key = ("config", "learning_rates")

ARGS = {
    "dicts": dicts,
    "key": key
}
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
get_bandicts Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
eth-sri/ward/src/rag_system.py
code served (permissive licence) · get_code("ed944c4bffb92311")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from typing import Any, Dict, List

torch.manual_seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.vocab_size = 128010
    
    def _encode_batch(self, prompts: List[str], return_offsets: bool = False, return_inputs: bool = False):
        batch_size = len(prompts)
        # Create input_ids with the required patterns
        # Pattern 1: [128006, 882, 128007] for user start
        # Pattern 2: [128006, 78191, 128007] for assistant start
        
        input_ids_list = []
        for i in range(batch_size):
            # Build a sequence with both patterns and at least 10 tokens between them
            ids = torch.IntTensor([
                128006, 882, 128007,  # user_start_pattern at idx 0
                100, 101, 102, 103, 104, 105, 106, 107, 108, 109,  # 10+ tokens in between
                128006, 78191, 128007  # asst_start_pattern at idx 16
            ])
            input_ids_list.append(ids)
        
        # Stack into batch
        max_len = max(len(ids) for ids in input_ids_list)
        padded_ids = torch.zeros(batch_size, max_len, dtype=torch.int)
        for i, ids in enumerate(input_ids_list):
            padded_ids[i, :len(ids)] = ids
        
        batchenc = {
            'input_ids': input_ids_list
        }
        
        return None, batchenc

model = MockModel()
prompts = ["Hello world", "Test prompt"]

ARGS = {
    "model": model,
    "prompts": prompts
}
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 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
index_dict Ran
ran; our contract draft was wrong, not the code
eth-sri/ward/src/config/meta_config.py
code served (permissive licence) · get_code("0a14a852fc0dae57")
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
import numpy as np
from typing import Any, Dict, Tuple

torch.manual_seed(0)

# Construct a nested dictionary structure
nested_dict = {
    "level1": {
        "level2": {
            "level3": "target_value"
        }
    },
    "another_branch": {
        "data": 42
    }
}

# Define ARGS with a key that indexes into a leaf
ARGS = {
    "d": nested_dict,
    "key": ("level1", "level2", "level3")
}
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 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
is_pattern Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
eth-sri/ward/src/rag_system.py
code served (permissive licence) · get_code("ea86ca2f2c9bed9c")
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 torch

torch.manual_seed(0)

# Create a small input_ids tensor (shape: [10])
# This represents a sequence of token IDs
input_ids = torch.tensor([101, 2054, 2003, 1045, 1997, 2054, 2003, 1045, 1997, 102])

# Create an index that is valid for checking patterns
# idx must satisfy: idx >= 0 and idx <= input_ids.shape[0] - 3
idx = 2

# Create a pattern tensor (shape: [3]) to match against a window of input_ids
# This pattern will be compared against input_ids[idx:idx+3]
pattern = torch.tensor([2054, 2003, 1045])

ARGS = {
    "input_ids": input_ids,
    "idx": idx,
    "pattern": pattern,
}
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 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
load_data Ran
ran; our contract draft was wrong, not the code
eth-sri/ward/driver.py
code served (permissive licence) · get_code("c2299d0b8f737e84")
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 json
import tempfile
import os
from typing import Any, Dict, List

# Create a temporary directory with mock JSON files
temp_dir = tempfile.mkdtemp()

# Generate 3391 small JSON files with mock data
num_test_examples = 3391
for i in range(num_test_examples):
    filename = os.path.join(temp_dir, f'{i:04}.json')
    data = {
        'id': i,
        'text': f'example {i}',
        'value': i * 0.5
    }
    with open(filename, 'w') as f:
        json.dump(data, f)

ARGS = {
    'data_dir': 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 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 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
expand_dict_over_key 1 other paper
1 later
2505.11557 (2025-05)
AC-LORA: (Almost) Training-Free Access Control-Aware Multi-Modal LLMs
expand_dicts_over_key 1 other paper
1 later
2505.11557 (2025-05)
AC-LORA: (Almost) Training-Free Access Control-Aware Multi-Modal LLMs

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

RAG enables LLMs to easily incorporate external data, raising concerns for data owners regarding unauthorized usage of their content. The challenge of detecting such unauthorized usage remains underexplored, with datasets and methods from adjacent fields being ill-suited for its study. We take several steps to bridge this gap. First, we formalize this problem as (black-box) RAG Dataset Inference (RAG-DI). We then introduce a novel dataset designed for realistic benchmarking of RAG-DI methods, alongside a set of baselines. Finally, we propose WARD, a method for RAG-DI based on LLM watermarks that equips data owners with rigorous statistical guarantees regarding their dataset's misuse in RAG corpora. WARD consistently outperforms all baselines, achieving higher accuracy, superior query efficiency and robustness. Our work provides a foundation for future studies of RAG-DI and highlights LLM watermarks as a promising approach to this problem.

For agents

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

get_harvested_code_for_paper("2410.03537")
get_code_for_paper("2410.03537")
have("2410.03537")

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

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

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

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

Connect an agent — have() is free.