SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.11658 · 2026

Is Per-Agent Policy Composition Safe? Rethinking Successor-Feature Transfer in Cooperative Multi-Agent Reinforcement Learning

Sen Li, Zijian Zhao

arXiv · PDF · Open in the Atlas

Code that ran

12 of 15 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; 5 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 3 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/2608.11658.json · badge: /api/ran/2608.11658.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
RS2002/MA-USFA community
Papers with Code archive
12 ran · 3 no recorded run
FunctionStatusWhere it lives
GATLayer Ran
ran on a synthesized input
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("4a1bb946049ee916")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 5, 6) 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 torch.nn as nn

class GATLayer(nn.Module):
    """Single graph-attention layer (Velickovic et al. 2018), masked to a fixed
    1-hop adjacency.

    Each node aggregates a learned attention-weighted combination of its 1-hop
    neighbours' (and its own) transformed features. Attention logits for
    non-neighbour pairs are masked to -inf before the softmax, so a node only
    ever attends within its neighbourhood -- the "consider 1-hop neighbours"
    coupling the GAT variant is meant to add on top of the independent MLP.

    adj : [N, N] float {0,1} adjacency WITH self-loops (fixed, not learned).
    """

    def __init__(self, in_dim, out_dim, n_heads=4, concat=True, dropout=0.0, leaky_slope=0.2):
        super().__init__()
        self.n_heads = n_heads
        self.out_dim = out_dim
        self.concat = concat
        self.W = nn.Linear(in_dim, out_dim * n_heads, bias=False)
        self.a_src = nn.Parameter(torch.empty(n_heads, out_dim))
        self.a_dst = nn.Parameter(torch.empty(n_heads, out_dim))
        self.leaky = nn.LeakyReLU(leaky_slope)
        self.dropout = nn.Dropout(dropout)
        self.reset_parameters()

    def reset_parameters(self):
        nn.init.xavier_uniform_(self.W.weight)
        nn.init.xavier_uniform_(self.a_src)
        nn.init.xavier_uniform_(self.a_dst)

    def forward(self, h, adj):
        B, N, _ = h.shape
        Wh = self.W(h).view(B, N, self.n_heads, self.out_dim)
        Wh = Wh.permute(0, 2, 1, 3)
        src = (Wh * self.a_src.view(1, self.n_heads, 1, self.out_dim)).sum(-1)
        dst = (Wh * self.a_dst.view(1, self.n_heads, 1, self.out_dim)).sum(-1)
        e = self.leaky(src.unsqueeze(-1) + dst.unsqueeze(-2))
        mask = adj.unsqueeze(0).unsqueeze(0) > 0
        e = e.masked_fill(~mask, float('-inf'))
        attn = torch.softmax(e, dim=-1)
        attn = self.dropout(attn)
        out = torch.matmul(attn, Wh)
        out = out.permute(0, 2, 1, 3)
        if self.concat:
            return out.reshape(B, N, self.n_heads * self.out_dim)
        return out.mean(dim=2)


INIT_ARGS = {
    'in_dim': 4,
    'out_dim': 3,
    'n_heads': 2,
    'concat': True,
    'dropout': 0.1,
    'leaky_slope': 0.2,
}

ARGS = {
    'h': torch.randn(2, 5, 4),
    'adj': torch.ones(5, 5),
}

if __name__ == '__main__':
    layer = GATLayer(**INIT_ARGS)
    output = layer(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 5, {INIT_ARGS['n_heads'] * INIT_ARGS['out_dim']})")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 6) — shape (2, 5, 6) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
NeighborComposer Ran
ran on a synthesized input
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("3ce3bfc24e185c85")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, 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 torch.nn as nn
import torch.nn.functional as F

class MockSFNet(nn.Module):
    """Mock SF network for testing NeighborComposer."""
    def __init__(self, state_dim, action_dim, feat_dim):
        super().__init__()
        self.state_dim = state_dim
        self.action_dim = action_dim
        self.feat_dim = feat_dim
        self.q_net = nn.Linear(state_dim + feat_dim, action_dim)
    
    def q_values(self, state, w):
        """Compute base Q-values from state and task weights."""
        combined = torch.cat([state, w], dim=-1)
        return self.q_net(combined)

# Create mock SF network
state_dim = 5
action_dim = 3
feat_dim = 4
n_agents = 6

sf_net = MockSFNet(state_dim, action_dim, feat_dim)

# Create adjacency matrix (sparse, with self-loops)
adj = torch.eye(n_agents, dtype=torch.float32)
adj[0, 1] = 1.0
adj[1, 0] = 1.0
adj[1, 2] = 1.0
adj[2, 1] = 1.0
adj[3, 4] = 1.0
adj[4, 3] = 1.0
adj[4, 5] = 1.0
adj[5, 4] = 1.0

INIT_ARGS = {
    'sf_net': sf_net,
    'adj': adj.numpy(),
    'feat_dim': feat_dim,
    'hidden_dim': 16,
    'n_heads': 4,
    'use_agent_emb': True,
}

ARGS = {
    'state': torch.randn(2, n_agents, state_dim),
    'w': torch.randn(2, n_agents, feat_dim),
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SFQNet Ran
ran on a synthesized input
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("4a682b39c5f69bdb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 2, 3) 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 torch.nn as nn

class SFQNet(nn.Module):
    """Per-agent SUCCESSOR-FEATURE network: predicts psi(s, a) in R^K per action.

    Identical independent-learner backbone to :class:`MLPQNet` (parameters
    shared across agents, own-observation only, optional identity embedding) but
    the head emits ``action_dim * feat_dim`` values reshaped to
    ``[B, N, action_dim, feat_dim]`` -- the expected discounted feature vector
    psi_i(s_i, a). The task value is the closed form ``Q = psi . w`` computed by
    the caller, so ONE trained psi transfers to any task weighting w without
    retraining. Trained w-free (USFA): a fresh w is drawn per episode and the
    SF-TD target uses phi + gamma * psi(s2, a2) (see agent.py).

    Input  state : [B, N, state_dim]
    Output psi   : [B, N, action_dim, feat_dim]
    """

    def __init__(self, state_dim, action_dim, feat_dim, agent_num, hidden_dim=64, use_agent_emb=True):
        super().__init__()
        self.state_dim = state_dim
        self.action_dim = action_dim
        self.feat_dim = feat_dim
        self.agent_num = agent_num
        self.use_agent_emb = use_agent_emb
        in_dim = state_dim
        if use_agent_emb:
            self.agent_emb = nn.Embedding(agent_num, hidden_dim)
            in_dim = state_dim + hidden_dim
        self.net = nn.Sequential(nn.Linear(in_dim, hidden_dim), nn.ReLU(), nn.Linear(hidden_dim, hidden_dim), nn.ReLU(), nn.Linear(hidden_dim, action_dim * feat_dim))

    def _augment(self, state):
        if self.use_agent_emb:
            emb = self.agent_emb.weight.unsqueeze(0).expand(state.shape[0], -1, -1)
            state = torch.cat([state, emb], dim=-1)
        return state

    def forward(self, state):
        B, N, _ = state.shape
        x = self._augment(state)
        psi = self.net(x)
        return psi.view(B, N, self.action_dim, self.feat_dim)

    def q_values(self, state, w):
        """Closed-form transfer value Q = psi . w. ``w`` is [K] or [B,N,K]."""
        psi = self.forward(state)
        w_t = torch.as_tensor(w, dtype=psi.dtype, device=psi.device)
        if w_t.dim() == 1:
            return torch.einsum('bnak,k->bna', psi, w_t)
        return torch.einsum('bnak,bnk->bna', psi, w_t)


INIT_ARGS = {
    'state_dim': 5,
    'action_dim': 3,
    'feat_dim': 4,
    'agent_num': 2,
    'hidden_dim': 16,
    'use_agent_emb': True,
}

ARGS = {
    'state': torch.randn(2, 2, 5),
    'w': torch.randn(4),
}

METHOD = 'q_values'

if __name__ == '__main__':
    model = SFQNet(**INIT_ARGS)
    output = getattr(model, METHOD)(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 2, 3) — shape (2, 2, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
_letter_code_to_int Ran
ran, honoured the contract we drafted
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("50674a6011650f20")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned 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 torch

def _letter_code_to_int(text):
    """Map A->1, B->2, ..., AA->27 for grid-like IDs such as A0 / B12."""
    return sum((ord(ch.lower()) - 96 for ch in text))

ARGS = {
    "text": "A"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — 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
build_coupling_adjacency Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("8afd30c4658aa07d")
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

# Mock environment object for infer_topology_adjacency
class MockSUMOEnv:
    def __init__(self):
        self.sumo = MockTraCI()
        self.unwrapped = self

class MockTraCI:
    def __init__(self):
        self.edge = MockEdgeAPI()
        self.trafficlight = MockTrafficLightAPI()

class MockEdgeAPI:
    def getIDList(self):
        return ['edge_0', 'edge_1', 'edge_2', ':internal_0']
    
    def getFromJunction(self, edge_id):
        mapping = {
            'edge_0': ('intersection_0_0', 'intersection_1_0'),
            'edge_1': ('intersection_1_0', 'intersection_1_1'),
            'edge_2': ('intersection_0_1', 'intersection_1_1'),
            ':internal_0': (':', ':')
        }
        if edge_id in mapping:
            return mapping[edge_id][0]
        return 'unknown'
    
    def getToJunction(self, edge_id):
        mapping = {
            'edge_0': ('intersection_0_0', 'intersection_1_0'),
            'edge_1': ('intersection_1_0', 'intersection_1_1'),
            'edge_2': ('intersection_0_1', 'intersection_1_1'),
            ':internal_0': (':', ':')
        }
        if edge_id in mapping:
            return mapping[edge_id][1]
        return 'unknown'

class MockTrafficLightAPI:
    def getControlledLanes(self, tls_id):
        lanes_map = {
            'intersection_0_0': ['edge_0_0', 'edge_0_1'],
            'intersection_1_0': ['edge_1_0', 'edge_0_0'],
            'intersection_1_1': ['edge_1_0', 'edge_2_0']
        }
        return lanes_map.get(tls_id, [])

# Valid agent_ids in different formats
agent_ids_intersection = ['intersection_0_0', 'intersection_1_0', 'intersection_1_1']
agent_ids_grid = ['A0', 'B0', 'B1']
agent_ids_numeric = ['0_0', '1_0', '1_1']

# Create mock environment
mock_env = MockSUMOEnv()

ARGS = {
    'agent_ids': agent_ids_intersection,
    'env': mock_env,
    'method': 'auto'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, traci — 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_grid_adjacency Ran
ran, honoured the contract we drafted
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("866f08badb690ffc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 2, dtype family float, shape (3, 3) 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
import re

_ALNUM_PATTERN = re.compile('^([A-Za-z]+)[_\\-]?(\\d+)$')
_INTERSECTION_PATTERN = re.compile('^intersection_(\\d+)_(\\d+)$')
_NUM_PATTERN = re.compile('^(\\d+)[_\\-](\\d+)$')

def _letter_code_to_int(text):
    """Map A->1, B->2, ..., AA->27 for grid-like IDs such as A0 / B12."""
    return sum((ord(ch.lower()) - 96 for ch in text))

def parse_grid_coords(agent_ids):
    """Strict wrapper around try_parse_grid_coords (raises on failure)."""
    coords = try_parse_grid_coords(agent_ids)
    if coords is None:
        raise ValueError("Agent ids could not be parsed as grid coordinates. Supported patterns include 'intersection_<col>_<row>', 'A0', and '3_5'.")
    return coords

def try_parse_grid_coords(agent_ids):
    """Best-effort grid-coordinate parsing for several common ID formats.

    Supported patterns:
      * intersection_<col>_<row>
      * A0 / B12 / AA3
      * 3_5 / 12-4

    Returns a list of (x, y) tuples, or None if any ID cannot be parsed.
    """
    coords = []
    for aid in agent_ids:
        text = str(aid)
        m = _INTERSECTION_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((int(m.group(1)), int(m.group(2))))
            continue
        m = _ALNUM_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((_letter_code_to_int(m.group(1)), int(m.group(2))))
            continue
        m = _NUM_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((int(m.group(1)), int(m.group(2))))
            continue
        return None
    return coords

def build_grid_adjacency(agent_ids):
    """Build 4-neighbor (Manhattan) grid adjacency with self-loops."""
    coords = parse_grid_coords(agent_ids)
    n = len(coords)
    C = np.eye(n, dtype=np.float32)
    for i, (xi, yi) in enumerate(coords):
        for j in range(i + 1, n):
            xj, yj = coords[j]
            if abs(xi - xj) + abs(yi - yj) == 1:
                C[i, j] = 1.0
                C[j, i] = 1.0
    return C

# Test with intersection pattern
agent_ids_intersection = ['intersection_0_0', 'intersection_1_0', 'intersection_0_1']

# Test with letter-number pattern
agent_ids_letter = ['A0', 'B0', 'A1']

# Test with numeric pattern
agent_ids_numeric = ['0_0', '1_0', '0_1']

ARGS = {
    'agent_ids': agent_ids_intersection
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 3) — shape (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
describe_support Ran
ran; our contract draft was wrong, not the code
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("f2910b29b96ce200")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a small support matrix S
# The function expects S to be a 2D numpy array
# It computes row sums, checks if it's identity or all ones

# Create a simple support matrix (4x4) with some neighborhood structure
S = np.array([
    [1.0, 0.5, 0.0, 0.0],
    [0.5, 1.0, 0.5, 0.0],
    [0.0, 0.5, 1.0, 0.5],
    [0.0, 0.0, 0.5, 1.0]
], dtype=np.float32)

ARGS = {
    'S': S
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
infer_topology_adjacency Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("3c8af447ff59c187")
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

class MockTraciConnection:
    def __init__(self):
        self.edge = MockEdgeAPI()
        self.trafficlight = MockTrafficLightAPI()

class MockEdgeAPI:
    def __init__(self):
        self._edges = {
            'edge_0': ('tls_0', 'tls_1'),
            'edge_1': ('tls_1', 'tls_2'),
            'edge_2': ('tls_0', 'tls_0'),
        }
    
    def getIDList(self):
        return list(self._edges.keys())
    
    def getFromJunction(self, edge_id):
        return self._edges[edge_id][0]
    
    def getToJunction(self, edge_id):
        return self._edges[edge_id][1]

class MockTrafficLightAPI:
    def __init__(self):
        self._controlled = {
            'tls_0': ['edge_0_0', 'edge_0_1'],
            'tls_1': ['edge_1_0', 'edge_0_2'],
            'tls_2': ['edge_2_0'],
        }
    
    def getControlledLanes(self, tls_id):
        return self._controlled.get(tls_id, [])

class MockEnv:
    def __init__(self):
        self.sumo = MockTraciConnection()
        self.unwrapped = self

ARGS = {
    'env': MockEnv(),
    'agent_ids': ['tls_0', 'tls_1', 'tls_2'],
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, traci — 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
make_source_library Ran
ran, honoured the contract we drafted
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("cd42aa615faae74e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 2, dtype family float, shape (3, 5) 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

FEATURE_NAMES = ('queue', 'wait', 'pressure', 'speed', 'fairness')

W_FAIR = 0.0
W_PRESSURE = 1.5
W_QUEUE = 1.0
W_SPEED = 3.0
W_WAIT = 0.3

DEFAULT_W = np.array([-W_QUEUE, -W_WAIT, -W_PRESSURE, +W_SPEED, -W_FAIR], dtype=np.float32)

FEATURE_DIM = len(FEATURE_NAMES)

def make_source_library(emphasis=3.0, lib_size=None):
    """Return an [K, FEATURE_DIM] matrix of K source task profiles.

    Profiles: one specialist per non-zero DEFAULT_W term (queue / wait /
    pressure / speed) with that term's magnitude boosted by ``emphasis``, plus
    the balanced DEFAULT_W itself. Signs are always DEFAULT_W's.

    ``lib_size`` controls how many sources are returned (for K-sweep experiments).
    The full library has 5 profiles: 1 balanced + 4 specialists (queue/wait/
    pressure/speed). lib_size truncates from the front so that:
      K=1: balanced only
      K=2: balanced + queue-specialist
      K=3: balanced + queue + wait specialists
      K=4: balanced + queue + wait + pressure specialists   (default)
      K=5: all five (adds speed-specialist)
    If lib_size is None (default), all profiles are returned."""
    sign = np.sign(DEFAULT_W)
    base = np.abs(DEFAULT_W)
    sources = [DEFAULT_W.copy()]
    for j in range(FEATURE_DIM):
        if base[j] == 0:
            continue
        mag = base.copy()
        mag[j] = base[j] * emphasis
        sources.append((sign * mag).astype(np.float32))
    lib = np.stack(sources, axis=0).astype(np.float32)
    if lib_size is not None:
        assert 1 <= lib_size <= len(lib), f'lib_size={lib_size} out of range [1, {len(lib)}]'
        lib = lib[:lib_size]
    return lib


ARGS = {
    'emphasis': 2.5,
    'lib_size': 3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 5) — shape (3, 5) 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
parse_grid_coords Ran
ran, honoured the contract we drafted
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("6dc89f8bf2cdc7ed")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned list, ndim 2, dtype family int; 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 re

_ALNUM_PATTERN = re.compile('^([A-Za-z]+)[_\\-]?(\\d+)$')

_INTERSECTION_PATTERN = re.compile('^intersection_(\\d+)_(\\d+)$')

_NUM_PATTERN = re.compile('^(\\d+)[_\\-](\\d+)$')

def _letter_code_to_int(text):
    """Map A->1, B->2, ..., AA->27 for grid-like IDs such as A0 / B12."""
    return sum((ord(ch.lower()) - 96 for ch in text))

def try_parse_grid_coords(agent_ids):
    """Best-effort grid-coordinate parsing for several common ID formats.

    Supported patterns:
      * intersection_<col>_<row>
      * A0 / B12 / AA3
      * 3_5 / 12-4

    Returns a list of (x, y) tuples, or None if any ID cannot be parsed.
    """
    coords = []
    for aid in agent_ids:
        text = str(aid)
        m = _INTERSECTION_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((int(m.group(1)), int(m.group(2))))
            continue
        m = _ALNUM_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((_letter_code_to_int(m.group(1)), int(m.group(2))))
            continue
        m = _NUM_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((int(m.group(1)), int(m.group(2))))
            continue
        return None
    return coords

def parse_grid_coords(agent_ids):
    """Strict wrapper around try_parse_grid_coords (raises on failure)."""
    coords = try_parse_grid_coords(agent_ids)
    if coords is None:
        raise ValueError("Agent ids could not be parsed as grid coordinates. Supported patterns include 'intersection_<col>_<row>', 'A0', and '3_5'.")
    return coords


# Test with various valid ID formats
ARGS = {
    "agent_ids": ["intersection_0_1", "A0", "B12", "3_5", "12-4"]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 2, dtype family int — 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
sample_task Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("d759627c94c1f822")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 1, dtype family float, shape (5,) 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 a random number generator
rng = np.random.RandomState(42)

# Define base weights (optional parameter, defaults to abs(DEFAULT_W) if None)
base = np.array([1.0, 0.3, 1.5, 3.0, 0.0], dtype=np.float32)

# Define sign array (optional parameter, defaults to sign(DEFAULT_W) if None)
sign = np.array([-1.0, -1.0, -1.0, 1.0, -1.0], dtype=np.float32)

# Define scale tuple
scale = (0.5, 1.5)

ARGS = {
    'rng': rng,
    'base': base,
    'sign': sign,
    'scale': scale
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (5,) — shape (5,) 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
try_parse_grid_coords Ran
ran, honoured the contract we drafted
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("6223f75f7c69faf0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned list, ndim 2, dtype family int; 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 re

_ALNUM_PATTERN = re.compile('^([A-Za-z]+)[_\\-]?(\\d+)$')
_INTERSECTION_PATTERN = re.compile('^intersection_(\\d+)_(\\d+)$')
_NUM_PATTERN = re.compile('^(\\d+)[_\\-](\\d+)$')

def _letter_code_to_int(text):
    """Map A->1, B->2, ..., AA->27 for grid-like IDs such as A0 / B12."""
    return sum((ord(ch.lower()) - 96 for ch in text))

def try_parse_grid_coords(agent_ids):
    """Best-effort grid-coordinate parsing for several common ID formats.

    Supported patterns:
      * intersection_<col>_<row>
      * A0 / B12 / AA3
      * 3_5 / 12-4

    Returns a list of (x, y) tuples, or None if any ID cannot be parsed.
    """
    coords = []
    for aid in agent_ids:
        text = str(aid)
        m = _INTERSECTION_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((int(m.group(1)), int(m.group(2))))
            continue
        m = _ALNUM_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((_letter_code_to_int(m.group(1)), int(m.group(2))))
            continue
        m = _NUM_PATTERN.fullmatch(text)
        if m is not None:
            coords.append((int(m.group(1)), int(m.group(2))))
            continue
        return None
    return coords

ARGS = {
    "agent_ids": [
        "intersection_5_10",
        "A0",
        "B12",
        "AA3",
        "3_5",
        "12-4"
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 2, dtype family int — 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
ReplayBuffer Not yet run
unverified (harvested, no recorded run)
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("cfc56b7bea4330e3")
How it ran

no invocation recorded.

SFAgent Not yet run
unverified (harvested, no recorded run)
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("fe2bdec92d13fe20")
How it ran

no invocation recorded.

SFReplayBuffer Not yet run
unverified (harvested, no recorded run)
RS2002/MA-USFA/tsc/agent.py
code served (permissive licence) · get_code("20761f03847f7456")
How it ran

no invocation recorded.

Also present in other papers' code

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

Many reinforcement learning systems, from fleet management to traffic signal control, must serve an objective that changes dynamically after deployment, and retraining a policy for each new objective is prohibitively expensive. For a single agent, this problem is well understood: successor features with generalized policy improvement, together with their universal extension, recombine a library of learned policies into a policy for any new objective, with a guarantee that the result is never worse than any policy in the library. However, multi-agent transfer has received far less attention, and the common practice of letting each agent recombine its own library independently inherits the recipe but not the guarantee. We prove that this independent composition can produce joint behavior strictly worse than every policy in the library, because recombining teammates changes the environment each agent faces and invalidates the values it relies on, a failure with no singleagent counterpart. We further show that the only unconditionally safe fixed rule is synchronized composition, which moves the whole team to one jointly trained policy but cannot serve objectives that assign different goals to different agents. To attain safety and flexibility at once, we propose multi-agent universal successor feature approximators (MA-USFA), a hierarchical method with two layers: a lower layer of universal successor feature approximators that predicts each agent's successor features while conditioned on its teammates' objectives, and an upper composer that selects, across agents, which library entry each agent should follow and supplies the cross-agent correction a per-agent value cannot represent. Trained once over the distribution of objectives, it is applied at deployment with no per-task adaptation. On a controlled grid world and a real-world city-scale traffic signal control problem, MA-USFA matches or exceeds every fixed composition rule and recovers the performance of policies retrained from scratch. The code of this paper is provided at https://github.com/RS2002/MA-USFA.

For agents

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

get_harvested_code_for_paper("2608.11658")
get_code_for_paper("2608.11658")
have("2608.11658")

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

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

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

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

Connect an agent — have() is free.