SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.05891 · ICML · 2023

Anchor Sampling for Federated Learning with Partial Client Participation

Jing Gao, Ziming Liu, Feijie Wu, Song Guo, Zhihao Qu, Shiqi He, Minibatch Sgd, Wang Srebro, M Kϵ

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2206.05891.json · badge: /api/ran/2206.05891.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
harliwu/fedamd canonical (classifier label)
classifier basis: classifier_2025
6 ran · 0 no recorded run
FunctionStatusWhere it lives
comp_avg_grad Ran
ran; our contract draft was wrong, not the code
harliwu/fedamd/algo/fedamd.py
code served (permissive licence) · get_code("508772378bbb3f7b")
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 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 torch
import torch.nn as nn
from torch.optim import SGD

torch.manual_seed(0)

# Build a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create model instance
w_model = SimpleModel()

# Create criterion
criterion = nn.CrossEntropyLoss()

# Create tiny data batches: list of (data, target) tuples
# data shape: (batch_size=2, features=4)
# target shape: (batch_size=2,) with class indices
data_batch_1 = (torch.randn(2, 4), torch.randint(0, 3, (2,)))
data_batch_2 = (torch.randn(2, 4), torch.randint(0, 3, (2,)))
data_loader = [data_batch_1, data_batch_2]

# data_ratio_pairs structure: dict with rank as key, containing tuple with data loader
# The function accesses data_ratio_pairs[rank][0] which should be the data loader
data_ratio_pairs = {
    0: (data_loader,)
}

ARGS = {
    "rank": 0,
    "criterion": criterion,
    "w_model": w_model,
    "lr": 0.01,
    "data_ratio_pairs": data_ratio_pairs,
    "device": torch.device("cpu")
}
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 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
compute_grad Ran
ran; our contract draft was wrong, not the code
harliwu/fedamd/algo/fedamd.py
code served (permissive licence) · get_code("a01b445c0f9920ba")
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 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 torch
import torch.nn as nn
from torch.optim import SGD

torch.manual_seed(0)

# Build a minimal model that supports .train(), .modules(), .zero_grad(), forward pass, and .parameters()
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
        self.bn = nn.BatchNorm2d(3)
    
    def forward(self, x):
        # Reshape for BatchNorm2d: (batch, channels, height, width)
        batch_size = x.shape[0]
        x = self.linear(x)  # (batch, 3)
        x = x.unsqueeze(-1).unsqueeze(-1)  # (batch, 3, 1, 1)
        x = self.bn(x)
        x = x.squeeze(-1).squeeze(-1)  # (batch, 3)
        return x

w_model = MinimalModel()

# Build criterion
criterion = nn.CrossEntropyLoss()

# Build device
device = torch.device('cpu')

# Build data_ratio_pairs_full_batch
# Structure: data_ratio_pairs_full_batch[rank][0] is an iterable of (data, target) tuples
data_batch = torch.randn(2, 4)  # batch_size=2, features=4
target_batch = torch.randint(0, 3, (2,))  # batch_size=2, num_classes=3

# Create a simple iterator wrapper
class SimpleDataLoader:
    def __init__(self, data, target):
        self.data = data
        self.target = target
    
    def __iter__(self):
        yield (self.data, self.target)

data_loader = SimpleDataLoader(data_batch, target_batch)

# data_ratio_pairs_full_batch[rank][0] should be iterable
data_ratio_pairs_full_batch = {
    0: (data_loader, None)  # rank 0, data_loader at index 0
}

rank = 0

ARGS = {
    'rank': rank,
    'criterion': criterion,
    'w_model': w_model,
    'data_ratio_pairs_full_batch': data_ratio_pairs_full_batch,
    'device': device
}
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 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
fedamd_train_iter Ran
ran; our contract draft was wrong, not the code
harliwu/fedamd/algo/fedamd.py
code served (permissive licence) · get_code("6e1e49fa92622ede")
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 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 torch
import torch.nn as nn
from torch.optim import SGD
from copy import deepcopy

torch.manual_seed(0)

# Build a minimal model
class TinyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(4, 8)
        self.bn = nn.BatchNorm2d(8)
        self.fc2 = nn.Linear(8, 3)
    
    def forward(self, x):
        # Reshape for BatchNorm2d: (batch, channels, height, width)
        if x.dim() == 2:
            x = x.unsqueeze(-1).unsqueeze(-1)  # (batch, 4) -> (batch, 4, 1, 1)
        x = self.fc1(x.squeeze(-1).squeeze(-1)) if x.dim() > 2 else self.fc1(x)
        x = x.unsqueeze(-1).unsqueeze(-1)  # (batch, 8) -> (batch, 8, 1, 1)
        x = self.bn(x)
        x = x.squeeze(-1).squeeze(-1)  # (batch, 8, 1, 1) -> (batch, 8)
        x = self.fc2(x)
        return x

# Create model instances
w_model = TinyModel()
w_model_backup = deepcopy(w_model)

# Create optimizer
w_optimizer = SGD(w_model.parameters(), lr=0.01)

# Create criterion
criterion = nn.CrossEntropyLoss()

# Create tiny data loader for rank 0
# Each batch is (data, target) where data is (batch_size, 4) and target is (batch_size,)
data_loader = [
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
]

# data_ratio_pairs is indexed by rank, contains (data_loader, ratio)
data_ratio_pairs = {
    0: (data_loader, 1.0)
}

# Create global_direction (list of zero tensors matching model parameters)
global_direction = [torch.zeros_like(p) for p in w_model.parameters()]

# Create args object
class Args:
    def __init__(self):
        self.lr = 0.01
        self.K = 2
        self.epoch = True
        self.lr_global_divided = False

args = Args()

# Device
device = torch.device('cpu')

# Rank
rank = 0

ARGS = {
    'rank': rank,
    'criterion': criterion,
    'w_optimizer': w_optimizer,
    'w_model': w_model,
    'w_model_backup': w_model_backup,
    'data_ratio_pairs': data_ratio_pairs,
    'global_direction': global_direction,
    'args': args,
    'device': device,
}
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 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
opta Ran
ran, honoured the contract we drafted
harliwu/fedamd/main_emnist.py
code served (permissive licence) · get_code("df94272ae0b83207")
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 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 math

def opta(x, m, a):
    if x <= 0 or x >= 1:
        return 10000000
    ans = 1 / (1 - x ** a) + 2 * m / (a * x * math.sqrt(1 - x ** a))
    return ans

# Construct valid arguments for opta
# x: must be in range (0, 1)
# m: a numeric value (appears to be a scaling factor)
# a: a numeric value (appears to be an exponent/shape parameter)

ARGS = {
    "x": 0.5,      # Valid value in (0, 1)
    "m": 2.0,      # Positive numeric value
    "a": 1.5       # Positive numeric value for exponent
}
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 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
optb Ran
ran, honoured the contract we drafted
harliwu/fedamd/main_emnist.py
code served (permissive licence) · get_code("e628885b2dad5a97")
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 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 math

def optb(m, a):
    return math.sqrt(4 * (m / a) * (m / a) + 2 * (m / a)) - 2 * (m / a)

# Construct valid arguments for optb
# The function takes two numeric parameters m and a
# It performs arithmetic operations: division, multiplication, addition, subtraction, sqrt
# Both m and a should be numeric values (int or float)

m = 5.0
a = 2.0

ARGS = {
    "m": m,
    "a": a
}
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 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
optc Ran
ran, violated the contract we drafted
harliwu/fedamd/main_emnist.py
code served (permissive licence) · get_code("011cdfb706e724f6")
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 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)

# Analyzing the function:
# def optc(m, a):
#     return (2 / (a + 2)) ** (1 / a)
#
# The function takes two parameters:
# - m: appears to be unused in the function body
# - a: used in arithmetic operations (a + 2) and (1 / a)
#
# Both parameters should be numeric values that support arithmetic operations.

m = 5
a = 3

ARGS = {
    "m": m,
    "a": a,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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

Also present in other papers' code

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

Compared with full client participation, partial client participation is a more practical scenario in federated learning, but it may amplify some challenges in federated learning, such as data heterogeneity. The lack of inactive client's updates in partial client participation makes it more likely for the model aggregation to deviate from the aggregation based on full client participation. Training with large batches on individual clients is proposed to address data heterogeneity in general, but their effectiveness under partial client participation is not clear. Motivated by these challenges, we propose to develop a novel federated learning framework, referred to as FedAMD, for partial client participation. The core idea is anchor sampling, which separates partial participants into anchor and miner groups. Each client in the anchor group aims at the local bullseye with the gradient computation using a large batch. Guided by the bullseyes, clients in the miner group steer multiple near-optimal local updates using small batches and update the global model. By integrating the results of the two groups, FedAMD is able to accelerate the training process and improve the model performance. Measured by ϵapproximation and compared to the state-of-theart methods, FedAMD achieves the convergence by up to O(1/ϵ) fewer communication rounds under non-convex objectives. Empirical studies on real-world datasets validate the effectiveness of FedAMD and demonstrate the superiority of the proposed algorithm: Not only does it considerably save computation and communication costs, but also the test accuracy significantly improves.

For agents

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

get_harvested_code_for_paper("2206.05891")
get_code_for_paper("2206.05891")
have("2206.05891")

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

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

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

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

Connect an agent — have() is free.