SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.03320 · 2023

Learning to Backdoor Federated Learning

arXiv · PDF · Open in the Atlas

Code that ran

8 of 13 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 8 have no contract verdict; 0 failures of our instrument; 5 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2303.03320.json · badge: /api/ran/2303.03320.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
HengerLi/RLBackdoorFL canonical (classifier label)
classifier basis not recorded on the link
8 ran · 5 no recorded run
FunctionStatusWhere it lives
Median Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/Aggr.py
code served (permissive licence) · get_code("348c44000d8135e2")
How it ran

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

import numpy as np
import torch

torch.manual_seed(0)

# Construct old_weight: a list of numpy arrays representing model layers
old_weight = [
    np.array([[1.0, 2.0, 3.0, 4.0],
              [5.0, 6.0, 7.0, 8.0],
              [9.0, 10.0, 11.0, 12.0]]),
    np.array([[0.5, 1.5],
              [2.5, 3.5],
              [4.5, 5.5],
              [6.5, 7.5]])
]

# Construct new_weights: a list of lists of numpy arrays
# Each element represents a client's weight updates
new_weights = [
    [
        np.array([[0.9, 1.9, 2.9, 3.9],
                  [4.9, 5.9, 6.9, 7.9],
                  [8.9, 9.9, 10.9, 11.9]]),
        np.array([[0.4, 1.4],
                  [2.4, 3.4],
                  [4.4, 5.4],
                  [6.4, 7.4]])
    ],
    [
        np.array([[1.1, 2.1, 3.1, 4.1],
                  [5.1, 6.1, 7.1, 8.1],
                  [9.1, 10.1, 11.1, 12.1]]),
        np.array([[0.6, 1.6],
                  [2.6, 3.6],
                  [4.6, 5.6],
                  [6.6, 7.6]])
    ],
    [
        np.array([[0.95, 1.95, 2.95, 3.95],
                  [4.95, 5.95, 6.95, 7.95],
                  [8.95, 9.95, 10.95, 11.95]]),
        np.array([[0.45, 1.45],
                  [2.45, 3.45],
                  [4.45, 5.45],
                  [6.45, 7.45]])
    ]
]

ARGS = {
    "old_weight": old_weight,
    "new_weights": new_weights
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
add_pattern_bd Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/DataProcess.py
code served (permissive licence) · get_code("b71f709c3830bf3f")
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 ndarray, ndim 3, dtype family int, shape (32, 32, 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

# Create a sample image for CIFAR-10 (32x32x3)
cifar10_image = np.random.randint(0, 256, (32, 32, 3), dtype=np.uint8)

# Create a sample image for MNIST (28x28)
mnist_image = np.random.randint(0, 256, (28, 28), dtype=np.uint8)

# Create a sample image for Fashion-MNIST (28x28)
fmnist_image = np.random.randint(0, 256, (28, 28), dtype=np.uint8)

ARGS = {
    'x': cifar10_image,
    'dataset': 'cifar10',
    'pattern_type': 'square',
    'agent_idx': -1
}
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 ndarray, ndim 3, dtype family int, shape (32, 32, 3) — shape (32, 32, 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
average Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/Aggr.py
code served (permissive licence) · get_code("58e57acf73c78a82")
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 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from functools import reduce

# Looking at the function, we need:
# - new_weights: a list of lists where each inner list contains numpy arrays (layers)
# - num_clients: an integer representing number of clients
# - subsample_rate: a float representing the subsample rate

# The function expects new_weights to be iterable of weight lists,
# where each weight list contains layers (numpy arrays that support multiplication)

# Create small numpy arrays to represent neural network layers
layer1 = np.array([1.0, 2.0, 3.0, 4.0])
layer2 = np.array([5.0, 6.0, 7.0, 8.0])

# Create new_weights as a list of weight lists (one per client in the subsample)
# With num_clients=10 and subsample_rate=0.5, we'll have 5 clients
new_weights = [
    [layer1.copy(), layer2.copy()],
    [layer1.copy(), layer2.copy()],
    [layer1.copy(), layer2.copy()],
    [layer1.copy(), layer2.copy()],
    [layer1.copy(), layer2.copy()],
]

num_clients = 10
subsample_rate = 0.5

ARGS = {
    "new_weights": new_weights,
    "num_clients": num_clients,
    "subsample_rate": subsample_rate,
}
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 list, ndim 2, 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
cos_sim Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/Util.py
code served (permissive licence) · get_code("ea6f4a59cd65daf9")
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 float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create two vectors for cosine similarity computation
a = np.array([1.0, 2.0, 3.0, 4.0])
b = np.array([5.0, 6.0, 7.0, 8.0])

ARGS = {
    "a": a,
    "b": b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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_prune_rank Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/Post_defenses.py
code served (permissive licence) · get_code("adcfd6e8d0eef5ef")
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 3, dtype family float, shape (2, 4, 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

torch.manual_seed(0)

# The function expects a tensor with at least 3 dimensions
# It sums over dimensions (1, 2), views as (batch_size, -1)
# So we need shape: (batch_size, dim1, dim2) or higher
# Let's create a 3D tensor: (batch=2, height=4, width=3)
prune_output = torch.randn(2, 4, 3)

ARGS = {
    "prune_output": prune_output
}
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 Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 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
prune_train Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/Post_defenses.py
code served (permissive licence) · get_code("934c67c9bb395a45")
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 1, dtype family float, shape (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

torch.manual_seed(0)

DEVICE = torch.device('cpu')

class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

net_prune = SimpleNet()

class SimpleDataLoader:
    def __init__(self):
        self.data = [
            (torch.randn(2, 4), torch.randint(0, 10, (2,)))
            for _ in range(3)
        ]
        self.index = 0
    
    def __next__(self):
        if self.index >= len(self.data):
            raise StopIteration
        batch = self.data[self.index]
        self.index += 1
        return batch
    
    def seek(self, pos):
        self.index = pos

train_iter = SimpleDataLoader()

ARGS = {
    'net_prune': net_prune,
    'train_iter': train_iter
}
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 Tensor, ndim 1, dtype family float, shape (3,) — shape (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
relu Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/Util.py
code served (permissive licence) · get_code("65bc749ceadcf87d")
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

torch.manual_seed(0)

# The relu function takes a single parameter 'x' and returns max(0.0, x)
# This works with numeric types (int, float)
# We'll test with a float value

ARGS = {
    "x": 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
weights_to_vector Ran
ran on a synthesized input
HengerLi/RLBackdoorFL/Util.py
code served (permissive licence) · get_code("af55adf6fe81c6d9")
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 ndarray, ndim 1, dtype family float, shape (32,) 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

# The function takes 'weights' which should be a list/iterable of NumPy ndarrays
# It flattens each ndarray and concatenates them into a 1-D array

# Create some sample weight arrays with distinct shapes
weight1 = np.random.randn(2, 3)  # 2x3 array
weight2 = np.random.randn(4, 5)  # 4x5 array
weight3 = np.random.randn(6)     # 1-D array with 6 elements

weights = [weight1, weight2, weight3]

ARGS = {
    "weights": weights
}
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 ndarray, ndim 1, dtype family float, shape (32,) — shape (32,) 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
Krum Not yet run
unverified (harvested, no recorded run)
HengerLi/RLBackdoorFL/Aggr.py
code served (permissive licence) · get_code("6821be439ef02b04")
How it ran

no invocation recorded.

Neurocraft Not yet run
unverified (harvested, no recorded run)
HengerLi/RLBackdoorFL/Backdoor_attacks.py
code served (permissive licence) · get_code("846e6bad6445af61")
How it ran

no invocation recorded.

Neurotoxin Not yet run
unverified (harvested, no recorded run)
HengerLi/RLBackdoorFL/Backdoor_attacks.py
code served (permissive licence) · get_code("721fbcc0d1c6224b")
How it ran

no invocation recorded.

get_datasets Not yet run
unverified (harvested, no recorded run)
HengerLi/RLBackdoorFL/DataProcess.py
code served (permissive licence) · get_code("97022c949a88944d")
How it ran

no invocation recorded.

get_prune_mask Not yet run
unverified (harvested, no recorded run)
HengerLi/RLBackdoorFL/Post_defenses.py
code served (permissive licence) · get_code("6fdf455dc1bee0bd")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 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 13 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

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

Abstract

In a federated learning (FL) system, malicious participants can easily embed backdoors into the aggregated model while maintaining the model's performance on the main task. To this end, various defenses, including training stage aggregation-based defenses and post-training mitigation defenses, have been proposed recently. While these defenses obtain reasonable performance against existing backdoor attacks, which are mainly heuristics based, we show that they are insufficient in the face of more advanced attacks. In particular, we propose a general reinforcement learning-based backdoor attack framework where the attacker first trains a (non-myopic) attack policy using a simulator built upon its local data and common knowledge on the FL system, which is then applied during actual FL training. Our attack framework is both adaptive and flexible and achieves strong attack performance and durability even under state-of-the-art defenses.

For agents

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

get_harvested_code_for_paper("2303.03320")
get_code_for_paper("2303.03320")
have("2303.03320")

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

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

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

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

Connect an agent — have() is free.