SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.14146 · EMNLP · 2025

s3: You Don't Need That Much Data to Train a Search Agent via RL

Jiawei Han, Jimeng Sun, Zifeng Wang, Pengcheng Jiang, Jiacheng Lin, Jinfeng Xiao, Xueqiang Xu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 2 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/2505.14146.json · badge: /api/ran/2505.14146.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
pat-jj/s3 marked official in Papers with Code
Papers with Code archive
7 ran · 2 no recorded run
FunctionStatusWhere it lives
DataProto Ran
ran on a synthesized input · constructed an object; no result was computed
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("3ddd2f19ce79889e")
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 an instance of its own class, DataProto: the run constructed the object and did not call it, so no result was computed. 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 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 tensordict import TensorDict
from dataclasses import dataclass, field
from typing import Dict

torch.manual_seed(0)

# Create a small TensorDict with distinct dimensions
batch_tensor_dict = TensorDict(
    {
        "obs": torch.randn(2, 4),  # batch_size=2, feature_dim=4
        "action": torch.randn(2, 3),  # batch_size=2, action_dim=3
        "reward": torch.randn(2, 1),  # batch_size=2, scalar reward
    },
    batch_size=[2],
)

# Create non_tensor_batch with numpy arrays
non_tensor_batch = {
    "episode_id": np.array([0, 1], dtype=object),
    "timestep": np.array([10, 20], dtype=object),
}

# Create meta_info dictionary
meta_info = {
    "dataset_name": "test_dataset",
    "version": 1,
    "split": "train",
}

ARGS = {
    "batch": batch_tensor_dict,
    "non_tensor_batch": non_tensor_batch,
    "meta_info": meta_info,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensordict, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataProto — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DataProto output the recorded ndim 1 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
DataProtoItem Ran
ran on a synthesized input · constructed an object; no result was computed
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("c184c5af900dddb0")
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 an instance of its own class, DataProtoItem: the run constructed the object and did not call it, so no result was computed. 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
from tensordict import TensorDict
from typing import Dict, Any

torch.manual_seed(0)

# Create a small TensorDict batch
batch_data = {
    "observation": torch.randn(2, 4),
    "action": torch.randn(2, 3),
    "reward": torch.randn(2, 1),
}
batch = TensorDict(batch_data, batch_size=[2])

# Create non-tensor batch dictionary
non_tensor_batch = {
    "episode_id": [1, 2],
    "done": [False, True],
    "info": ["sample1", "sample2"],
}

# Create meta info dictionary
meta_info = {
    "source": "training",
    "timestamp": 1234567890,
    "version": "1.0",
}

ARGS = {
    "batch": batch,
    "non_tensor_batch": non_tensor_batch,
    "meta_info": meta_info,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensordict, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataProtoItem — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DataProtoItem 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
GenerationConfig Ran
ran on a synthesized input · constructed an object; no result was computed
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("a93d6a0502295f81")
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 an instance of its own class, GenerationConfig: the run constructed the object and did not call it, so no result was computed. 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 dataclasses import dataclass

torch.manual_seed(0)

ARGS = {
    'max_turns': 5,
    'max_start_length': 128,
    'max_prompt_length': 512,
    'max_response_length': 256,
    'max_obs_length': 1024,
    'num_gpus': 1,
    'no_think_rl': False,
    'search_url': 'http://localhost:8000',
    'topk': 3,
    'include_information': True,
    'generator_llm': 'Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4',
    'output_context_dir': '/tmp/output_context'
}
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 GenerationConfig — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GenerationConfig 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
list_of_dict_to_dict_of_list Ran
ran; our contract draft was wrong, not the code
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("8709d15899e3d6a2")
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

torch.manual_seed(0)

# Construct a list of dictionaries with various data types
list_of_dicts = [
    {"a": 1, "b": "hello", "c": torch.tensor([1.0, 2.0, 3.0, 4.0])},
    {"a": 2, "b": "world", "c": torch.tensor([5.0, 6.0, 7.0, 8.0])},
    {"a": 3, "b": "test", "c": torch.tensor([9.0, 10.0, 11.0, 12.0])},
]

ARGS = {
    "list_of_dict": list_of_dicts
}
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 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
union_numpy_dict Ran
ran; our contract draft was wrong, not the code
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("0ee139479f9aed81")
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

# Create two dictionaries with numpy arrays
# The function checks if keys exist in both dicts and validates they're equal
# Then it performs a union operation

tensor_dict1 = {
    'array_a': np.array([1, 2, 3, 4]),
    'array_b': np.array([[1, 2], [3, 4]]),
}

tensor_dict2 = {
    'array_a': np.array([1, 2, 3, 4]),  # Same as in tensor_dict1
    'array_c': np.array([5, 6, 7, 8]),  # New key
}

ARGS = {
    'tensor_dict1': tensor_dict1,
    'tensor_dict2': tensor_dict2,
}
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 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
union_tensor_dict Ran
ran; our contract draft was wrong, not the code
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("21331a58f93375e4")
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 TensorDict. 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
from tensordict import TensorDict

torch.manual_seed(0)

# Create two TensorDicts with identical batch size
batch_size = torch.Size([2])

# First tensor dict with some keys
tensor_dict1 = TensorDict(
    {
        "shared_key": torch.randn(2, 4),
        "key1": torch.randn(2, 3),
    },
    batch_size=batch_size,
)

# Second tensor dict with overlapping and new keys
tensor_dict2 = TensorDict(
    {
        "shared_key": tensor_dict1["shared_key"].clone(),  # Same tensor values
        "key2": torch.randn(2, 5),
    },
    batch_size=batch_size,
)

ARGS = {
    "tensor_dict1": tensor_dict1,
    "tensor_dict2": tensor_dict2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensordict, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TensorDict — a TensorDict 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
union_two_dict Ran
ran; our contract draft was wrong, not the code
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("084b70223fc68422")
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 numpy as np
from typing import Dict, Any

torch.manual_seed(0)

# Create two dictionaries with overlapping and non-overlapping keys
# The function checks that values for overlapping keys are equal

dict1 = {
    "key1": "value1",
    "key2": 42,
    "key3": [1, 2, 3],
    "shared_key": "shared_value"
}

dict2 = {
    "key4": 3.14,
    "key5": {"nested": "dict"},
    "shared_key": "shared_value"  # Same key and value as dict1
}

ARGS = {
    "dict1": dict1,
    "dict2": dict2
}
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 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
LLMGenerationManager Not yet run
unverified (harvested, no recorded run)
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("a42a0e447f1a6c68")
How it ran

no invocation recorded.

collate_fn Not yet run
unverified (harvested, no recorded run)
pat-jj/s3/s3/llm_agent/generation_s3.py
code served (permissive licence) · get_code("90f6865eb340d338")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 7 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 5 the same month, 7 later) and 2 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
union_tensor_dict
brick of this paper's assembly: helper
64 other papers
12 dated earlier, 13 the same month, 35 later, 1 same year, order not determinable, 3 undated · 4 only as an assembly brick
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
and 61 more not named here
DataProtoItem
brick of this paper's assembly: helper
4 other papers
1 the same month, 3 later · 1 only as an assembly brick
2505.17447 (2025-05)
LeTS: Learning to Think-and-Search via Process-and-Outcome Reward Hybridization
2506.05316 (2025-06)
Improving Data Efficiency for LLM Reinforcement Fine-tuning Through Difficulty-targeted Online Data Selection and Rollout Replay
2603.02146 (2026-03)
LongRLVR: Long-Context Reinforcement Learning Requires Verifiable Context Rewards
and 1 more not named here
collate_fn
brick of this paper's assembly: helper
4 other papers
1 the same month, 3 later
2505.17447 (2025-05)
LeTS: Learning to Think-and-Search via Process-and-Outcome Reward Hybridization
2506.05316 (2025-06)
Improving Data Efficiency for LLM Reinforcement Fine-tuning Through Difficulty-targeted Online Data Selection and Rollout Replay
2603.02146 (2026-03)
LongRLVR: Long-Context Reinforcement Learning Requires Verifiable Context Rewards
and 1 more not named here
list_of_dict_to_dict_of_list
brick of this paper's assembly: helper
4 other papers
1 the same month, 3 later · 4 only as an assembly brick
2505.17447 (2025-05)
LeTS: Learning to Think-and-Search via Process-and-Outcome Reward Hybridization
2506.05316 (2025-06)
Improving Data Efficiency for LLM Reinforcement Fine-tuning Through Difficulty-targeted Online Data Selection and Rollout Replay
2603.02146 (2026-03)
LongRLVR: Long-Context Reinforcement Learning Requires Verifiable Context Rewards
and 1 more not named here
union_two_dict
brick of this paper's assembly: helper
4 other papers
1 the same month, 3 later · 1 only as an assembly brick
2505.17447 (2025-05)
LeTS: Learning to Think-and-Search via Process-and-Outcome Reward Hybridization
2506.05316 (2025-06)
Improving Data Efficiency for LLM Reinforcement Fine-tuning Through Difficulty-targeted Online Data Selection and Rollout Replay
2603.02146 (2026-03)
LongRLVR: Long-Context Reinforcement Learning Requires Verifiable Context Rewards
and 1 more not named here
DataProto
brick of this paper's assembly: helper
1 other paper
1 later
2506.05316 (2025-06)
Improving Data Efficiency for LLM Reinforcement Fine-tuning Through Difficulty-targeted Online Data Selection and Rollout Replay
union_numpy_dict
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2506.05316 (2025-06)
Improving Data Efficiency for LLM Reinforcement Fine-tuning Through Difficulty-targeted Online Data Selection and Rollout Replay

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) systems empower large language models (LLMs) to access external knowledge during inference. Recent advances have enabled LLMs to act as search agents via reinforcement learning (RL), improving information acquisition through multi-turn interactions with retrieval engines. However, existing approaches either optimize retrieval using search-only metrics (e.g., NDCG) that ignore downstream utility or fine-tune the entire LLM to jointly reason and retrieve-entangling retrieval with generation and limiting the real search utility and compatibility with frozen or proprietary models. In this work, we propose s3, a lightweight, modelagnostic framework that decouples the searcher from the generator and trains the searcher using a Gain Beyond RAG reward: the improvement in generation accuracy over naïve RAG. s3 requires only 2.4k training samples to outperform baselines trained on over 70× more data, consistently delivering stronger downstream performance across six general QA and five medical QA benchmarks. 1 Retrieval Generation Retrieval Generation Retrieval Generation distill SFT Active RAG (Zero-Shot) Retrieval Generation Generation Outcome as Signal (e.g., Search-R1) RL Retrieval Generation Retrieval Outcome as Signal (e.g., DeepRetrieval) RL Retrieval RL s3: Gain Beyond RAG as Signal Generation Classic RAG Pre-RLVR

For agents

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

get_harvested_code_for_paper("2505.14146")
get_code_for_paper("2505.14146")
have("2505.14146")

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

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

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

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

Connect an agent — have() is free.