SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2601.20209 · 2026

SPARK: Strategic Policy-Aware Exploration via Dynamic Branching for Long-Horizon Agentic Learning

Shuo Yang, Shuai Zhang, Jianhua Tao, Zhengqi Wen, Jinyang Wu, Yuhao Shen, Changpeng Yang

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 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; 6 failures of our instrument; 4 no recorded run), measured 2026-11-23; 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/2601.20209.json · badge: /api/ran/2601.20209.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
jinyangwu/SPARK canonical (classifier label)
classifier basis: census
8 ran · 4 no recorded run
FunctionStatusWhere it lives
build_search_envs Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jinyangwu/SPARK/agent_system/environments/env_package/search/envs_spark.py
code served (permissive licence) · get_code("a0d548c7992b5c81")
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 SearchMultiProcessEnv. 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.

from omegaconf import DictConfig, ListConfig
from copy import deepcopy
import numpy as np

# Create a minimal mock SearchEnv class since we can't import the real one
class MockSearchEnv:
    def __init__(self, cfg):
        self.cfg = cfg
    
    def reset(self, extras):
        pass
    
    def step(self, action):
        return {
            'observations': [{'content': 'mock response'}],
            'reward': 0.5,
            'done': False,
            'metadata': {'test_key': 'test_value'},
            'postprocessed_action': action
        }

# Mock the import path
import sys
from unittest.mock import MagicMock

mock_module = MagicMock()
mock_module.SearchEnv = MockSearchEnv
sys.modules['agent_system'] = MagicMock()
sys.modules['agent_system.environments'] = MagicMock()
sys.modules['agent_system.environments.env_package'] = MagicMock()
sys.modules['agent_system.environments.env_package.search'] = MagicMock()
sys.modules['agent_system.environments.env_package.search.third_party'] = MagicMock()
sys.modules['agent_system.environments.env_package.search.third_party.skyrl_gym'] = MagicMock()
sys.modules['agent_system.environments.env_package.search.third_party.skyrl_gym.envs'] = MagicMock()
sys.modules['agent_system.environments.env_package.search.third_party.skyrl_gym.envs.search'] = MagicMock()
sys.modules['agent_system.environments.env_package.search.third_party.skyrl_gym.envs.search.env'] = mock_module

# Create a minimal env_config DictConfig
search_config = DictConfig({
    'search_url': ['http://localhost:8000'],
    'other_param': 'value'
})

env_config = DictConfig({
    'max_steps': 10,
    'search': search_config
})

ARGS = {
    'seed': 42,
    'env_num': 1,
    'group_n': 2,
    'is_train': True,
    'env_config': env_config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
agent_system, gym, numpy, omegaconf — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SearchMultiProcessEnv — a SearchMultiProcessEnv output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SearchMultiProcessEnv 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
compute_reward Ran
ran, honoured the contract we drafted
jinyangwu/SPARK/agent_system/environments/env_package/alfworld/envs_spark.py
code served (permissive licence) · get_code("bcf675e5b7ccd7fd")
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 numpy as np

torch.manual_seed(0)

# Construct the 'info' dict that the function expects
# The function accesses info['won'] and info['goal_condition_success_rate']
info = {
    'won': 1,  # Boolean-like value that can be cast to float
    'goal_condition_success_rate': 0.85  # Float value for success rate
}

# Define ARGS mapping all parameters of compute_reward
ARGS = {
    'info': info,
    'multi_modal': False
}
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 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
compute_reward Ran
ran, honoured the contract we drafted
jinyangwu/SPARK/agent_system/environments/env_package/sciworld/envs_spark.py
code served (permissive licence) · get_code("724e8c51164a5ff8")
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 numpy as np

# Construct the info dict that the function expects
# The function accesses info['won'] and converts it to float
# 'won' should be a boolean or numeric value
info = {
    'won': True
}

# Construct ARGS with all parameters
ARGS = {
    'info': info,
    'multi_modal': False
}
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 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
compute_spark_outcome_advantage Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jinyangwu/SPARK/spark/core_spark.py
code served (permissive licence) · get_code("9ecc67b7ec75744a")
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 3, 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

torch.manual_seed(0)

# Batch size: 2, sequence length: 4, token reward dim: 3
batch_size = 2
seq_length = 4
token_reward_dim = 3

# token_level_rewards: shape (batch_size, token_reward_dim) or similar
# Looking at the code: token_level_rewards.shape[-1] is response_length
# and token_level_rewards.sum(dim=-1) gives scores of shape (batch_size,)
token_level_rewards = torch.randn(batch_size, seq_length)

# step_rewards: same shape as token_level_rewards (used with .sum(dim=-1))
step_rewards = torch.randn(batch_size, seq_length)

# response_mask: shape (batch_size, response_length) where response_length = seq_length
response_mask = torch.ones(batch_size, seq_length)

# index: np.array of shape (batch_size,) with group indices
index = np.array([0, 1], dtype=np.int64)

# reasoning_modes: np.array of shape (batch_size,) with mode identifiers
reasoning_modes = np.array([0, 1], dtype=np.int64)

# traj_id: optional np.array
traj_id = np.array([0, 1], dtype=np.int64)

# epsilon: small float for numerical stability
epsilon = 1e-6

# step_advantage_w: weight for step advantages
step_advantage_w = 1.0

# mode: normalization mode
mode = 'mean_norm'

ARGS = {
    'token_level_rewards': token_level_rewards,
    'step_rewards': step_rewards,
    'response_mask': response_mask,
    'index': index,
    'epsilon': epsilon,
    'step_advantage_w': step_advantage_w,
    'mode': mode,
    'reasoning_modes': reasoning_modes,
    'traj_id': traj_id,
}
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 tuple, ndim 3, 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
episode_norm_reward Ran
ran; our contract draft was wrong, not the code
jinyangwu/SPARK/spark/core_spark.py
code served (permissive licence) · get_code("ba8b13be2b285005")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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 numpy as np

torch.manual_seed(0)

# token_level_rewards: shape (batch_size, response_length)
# batch_size=2, response_length=4
token_level_rewards = torch.randn(2, 4)

# response_mask: shape (batch_size, response_length) with binary values
response_mask = torch.ones(2, 4)

# index: numpy array mapping each batch item to a prompt id
# We'll have 2 batch items, with ids 0 and 1 (to test both single and multi cases)
index = np.array([0, 0])

# epsilon: small float for numerical stability
epsilon = 1e-6

# remove_std: boolean flag
remove_std = True

ARGS = {
    "token_level_rewards": token_level_rewards,
    "response_mask": response_mask,
    "index": index,
    "epsilon": epsilon,
    "remove_std": remove_std,
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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_obs_image Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jinyangwu/SPARK/agent_system/environments/env_package/alfworld/envs_spark.py
code served (permissive licence) · get_code("ff393d027b482fe9")
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 Tensor, ndim 4, dtype family int, shape (2, 4, 3, 3) as a later run recorded it. 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, 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 torch.nn as nn
from PIL import Image
import numpy as np

torch.manual_seed(0)

class MockEnv:
    def get_frames(self):
        # Return a list of PIL Images (2 frames, each 4x3 RGB)
        frame1 = Image.fromarray(np.random.randint(0, 256, (4, 3, 3), dtype=np.uint8))
        frame2 = Image.fromarray(np.random.randint(0, 256, (4, 3, 3), dtype=np.uint8))
        return [frame1, frame2]

env = MockEnv()

ARGS = {
    "env": env
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family int, shape (2, 4, 3, 3) — shape (2, 4, 3, 3) 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_config_file Ran
ran; our contract draft was wrong, not the code
jinyangwu/SPARK/agent_system/environments/env_package/alfworld/envs_spark.py
code served (permissive licence) · get_code("3127633565ff7913")
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 os
import yaml
import tempfile

# Create a temporary directory and config file
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, 'test_config.yaml')

# Write a valid YAML config file
config_content = """
model:
  name: test_model
  layers: 3
  hidden_dim: 128
training:
  batch_size: 32
  learning_rate: 0.001
  epochs: 10
"""

with open(config_path, 'w') as f:
    f.write(config_content)

# Define ARGS dict with the path parameter
ARGS = {
    'path': config_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
to_hashable Ran
ran; our contract draft was wrong, not the code
jinyangwu/SPARK/gigpo/core_gigpo.py
code served (permissive licence) · get_code("ce13314a36eff98b")
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 numpy as np

# Test cases for to_hashable function
ARGS = {
    "x": {
        "int": 42,
        "float": 3.14,
        "str": "hello",
        "bool": True,
        "numpy_int": np.int32(5),
        "numpy_float": np.float64(2.71),
        "numpy_array": np.array([[1, 2], [3, 4]]),
        "list_mixed": [1, "two", 3.0, True],
        "tuple_mixed": (42, "test", np.float32(1.5)),
        "nested_list": [[1, 2], [3, 4], ["a", "b"]],
        "dict_simple": {"key1": 10, "key2": "value"},
        "dict_nested": {"a": 1, "b": {"c": 2, "d": "three"}},
        "complex_nested": {
            "list": [1, 2, np.array([5, 6])],
            "dict": {"x": np.int64(7), "y": [8, 9]},
            "scalar": 3.14,
        },
    }
}
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
build_sciworld_envs Not yet run
unverified (harvested, no recorded run)
jinyangwu/SPARK/agent_system/environments/env_package/sciworld/envs_spark.py
code served (permissive licence) · get_code("6ffebe5c30651f10")
How it ran

no invocation recorded.

build_webshop_envs Not yet run
unverified (harvested, no recorded run)
jinyangwu/SPARK/agent_system/environments/env_package/webshop/envs_spark.py
code served (permissive licence) · get_code("e0b40ceedda532ac")
How it ran

no invocation recorded.

compute_gigpo_outcome_advantage Not yet run
unverified (harvested, no recorded run)
jinyangwu/SPARK/gigpo/core_gigpo.py
code served (permissive licence) · get_code("c8e5b3681d41b8a9")
How it ran

no invocation recorded.

process_trajectory_spark_rewards Not yet run
unverified (harvested, no recorded run)
jinyangwu/SPARK/spark/core_spark.py
code served (permissive licence) · get_code("889a20a56139e47b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 1 later) and 10 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
to_hashable 10 other papers
3 dated earlier, 1 the same month, 6 later · 4 only as an assembly brick
2505.10978 (2025-05)
Group-in-Group Policy Optimization for LLM Agent Training
2509.13347 (2025-09)
OpenHA: A Series of Open-Source Hierarchical Agentic Models in Minecraft
2512.14157 (2025-12)
Ophiuchus: Incentivizing Tool-augmented "Think with Images" for Joint Medical Segmentation, Understanding and Reasoning
and 7 more not named here
compute_gigpo_outcome_advantage 1 other paper
1 dated earlier
2509.13347 (2025-09)
OpenHA: A Series of Open-Source Hierarchical Agentic Models in Minecraft

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

Repositories linked to this paper

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

Abstract

Reinforcement learning has empowered large language models to act as intelligent agents, yet training them for long-horizon tasks remains challenging due to the scarcity of highquality trajectories, especially under limited resources. Existing methods typically scale up rollout sizes and indiscriminately allocate computational resources among intermediate steps. Such attempts inherently waste substantial computation budget on trivial steps while failing to guarantee sample quality. To address this, we propose SPARK (Strategic Policy-Aware ex-ploRation via Key-state dynamic branching), a novel framework that selectively branches at critical decision states for resource-efficient exploration. Our key insight is to activate adaptive branching exploration at critical decision points to probe promising trajectories, thereby achieving precise resource allocation that prioritizes sampling quality over blind coverage. This design leverages the agent's intrinsic decisionmaking signals to reduce dependence on human priors, enabling the agent to autonomously expand exploration and achieve stronger generalization. Experiments across diverse tasks (e.g., embodied planning), demonstrate that SPARK achieves superior success rates with significantly fewer training samples, exhibiting robust generalization even in unseen scenarios. Our code and checkpoints are available at https://github.com/jinyangwu/SPARK. * Equal Contribution.

For agents

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

get_harvested_code_for_paper("2601.20209")
get_code_for_paper("2601.20209")
have("2601.20209")

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

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

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

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

Connect an agent — have() is free.