SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.19789 · IJCAI · 2024

Estimating before Debiasing: A Bayesian Approach to Detaching Prior Bias in Federated Semi-Supervised Learning

Hao Su, Jianwei Niu, Xuefeng Liu, Shaojie Tang, Guogang Zhu, Xinghao Wu, Chao Tang

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 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 0 have no contract verdict; 6 failures of our instrument; 3 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/2405.19789.json · badge: /api/ran/2405.19789.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
GuogangZhu/FedDB community
Papers with Code archive
6 ran · 3 no recorded run
FunctionStatusWhere it lives
collate Ran
ran; our contract draft was wrong, not the code
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("8dd93e2f9818fe9e")
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 torch

torch.manual_seed(0)

# The function expects a dict where each value is a list of tensors
# It will stack each list along dimension 0
# Create a dict with a few keys, each mapping to a list of small tensors

input_dict = {
    'tensor_a': [torch.randn(4, 3), torch.randn(4, 3)],
    'tensor_b': [torch.randn(2, 5), torch.randn(2, 5)],
    'tensor_c': [torch.randn(3, 2), torch.randn(3, 2)]
}

ARGS = {
    'input': input_dict
}
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 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
input_collate Ran
ran; our contract draft was wrong, not the code
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("6fd4f7ea4a79121e")
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 torch
import numpy as np
from torch.utils.data.dataloader import default_collate

torch.manual_seed(0)

# Test case 1: batch of dictionaries
batch_dicts = [
    {"input_ids": torch.tensor([1, 2, 3, 4]), "attention_mask": torch.tensor([1, 1, 1, 0])},
    {"input_ids": torch.tensor([5, 6, 7, 8]), "attention_mask": torch.tensor([1, 1, 1, 1])}
]

ARGS = {
    "batch": batch_dicts
}
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 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
make_optimizer Ran
ran; our contract draft was wrong, not the code
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("cc90e13adc203a00")
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 Adam. 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
import torch.optim as optim

torch.manual_seed(0)

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

model = SimpleModel()

# Define the global config dictionary that the function uses
cfg = {
    'optimizer_name': 'Adam',
    'lr': 0.001,
    'betas': (0.9, 0.999),
    'weight_decay': 1e-5,
    'momentum': 0.9,
    'nesterov': True,
    'local': {
        'lr': 0.001,
        'betas': (0.9, 0.999),
        'weight_decay': 1e-5,
        'momentum': 0.9,
        'nesterov': True,
    },
    'custom_tag': {
        'lr': 0.002,
        'betas': (0.95, 0.999),
        'weight_decay': 2e-5,
        'momentum': 0.95,
        'nesterov': False,
    }
}

# Make cfg available globally for the function
import builtins
builtins.cfg = cfg

# Define arguments for the function
ARGS = {
    'parameters': model.parameters(),
    'tag': 'local'
}
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 Adam — a Adam output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Adam 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
recur Ran
ran; our contract draft was wrong, not the code
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("8ed7f80859c43502")
How it ran

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

import torch
import numpy as np

torch.manual_seed(0)

# Define a simple function that processes tensors/arrays
def process_fn(x, multiplier=2):
    if isinstance(x, torch.Tensor):
        return x * multiplier
    elif isinstance(x, np.ndarray):
        return x * multiplier
    else:
        return x

# Test with various nested structures
test_input = {
    "tensor": torch.randn(2, 4),
    "array": np.random.randn(3, 5),
    "list": [torch.randn(2, 3), np.random.randn(2, 2)],
    "tuple": (torch.randn(1, 4), np.random.randn(1, 3)),
    "nested": {
        "inner_tensor": torch.randn(2, 4),
        "inner_list": [np.random.randn(2, 2)]
    },
    "string": "hello",
    "none_value": None
}

ARGS = {
    "fn": process_fn,
    "input": test_input,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
save_model_state_dict Ran
ran; our contract draft was wrong, not the code
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("71cc0dca3666e254")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple model state dict with various tensor types
model_state_dict = {
    'layer1.weight': torch.randn(4, 3),
    'layer1.bias': torch.randn(4),
    'layer2.weight': torch.randn(5, 4),
    'layer2.bias': torch.randn(5),
}

ARGS = {
    'model_state_dict': model_state_dict
}
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 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
save_optimizer_state_dict Ran
ran; our contract draft was wrong, not the code
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("95676e900ec2c9ae")
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 torch
import numpy as np
import copy

torch.manual_seed(0)

# Create a sample optimizer state dict that mimics what PyTorch optimizers produce
optimizer_state_dict = {
    'state': {
        0: {
            'step': torch.tensor(100),
            'exp_avg': torch.randn(4, 3),
            'exp_avg_sq': torch.randn(4, 3),
        },
        1: {
            'step': torch.tensor(50),
            'exp_avg': torch.randn(2, 5),
        }
    },
    'param_groups': [
        {
            'lr': 0.001,
            'betas': (0.9, 0.999),
            'eps': 1e-8,
            'weight_decay': 0.0,
            'params': [0, 1]
        }
    ]
}

ARGS = {
    'optimizer_state_dict': optimizer_state_dict
}
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 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
Client Not yet run
unverified (harvested, no recorded run)
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("acec6f9da990ed9b")
How it ran

no invocation recorded.

make_data_loader Not yet run
unverified (harvested, no recorded run)
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("b9594d9b2fb26b1d")
How it ran

no invocation recorded.

to_device Not yet run
unverified (harvested, no recorded run)
GuogangZhu/FedDB/src/modules/modules.py
code served (permissive licence) · get_code("10e471c80b15d2ed")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 7 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
input_collate
brick of this paper's assembly: helper
3 other papers
3 dated earlier
2010.01264 (2020-10)
HeteroFL: Computation and Communication Efficient Federated Learning for Heterogeneous Clients
2106.01425 (2021-06)
GAL: Gradient Assisted Learning for Decentralized Multi-Organization Collaborations
2212.01548 (2022-12)
FedRolex: Model-Heterogeneous Federated Learning with Rolling Sub-Model Extraction
to_device
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later
2010.01264 (2020-10)
HeteroFL: Computation and Communication Efficient Federated Learning for Heterogeneous Clients
2410.23227 (2024-10)
(FL) 2 : Overcoming Few Labels in Federated Semi-Supervised Learning

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

Federated Semi-Supervised Learning (FSSL) leverages both labeled and unlabeled data on clients to collaboratively train a model. In FSSL, the heterogeneous data can introduce prediction bias into the model, causing the model's prediction to skew towards some certain classes. Existing FSSL methods primarily tackle this issue by enhancing consistency in model parameters or outputs. However, as the models themselves are biased, merely constraining their consistency is not sufficient to alleviate prediction bias. In this paper, we explore this bias from a Bayesian perspective and demonstrate that it principally originates from label prior bias within the training data. Building upon this insight, we propose a debiasing method for FSSL named FedDB. FedDB utilizes the Average Prediction Probability of Unlabeled Data (APP-U) to approximate the biased prior. During local training, FedDB employs APP-U to refine pseudo-labeling through Bayes' theorem, thereby significantly reducing the label prior bias. Concurrently, during the model aggregation, FedDB uses APP-U from participating clients to formulate unbiased aggregate weights, thereby effectively diminishing bias in the global model. Experimental results show that FedDB can surpass existing FSSL methods. The code is available at https://github.com/GuogangZhu/FedDB.

For agents

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

get_harvested_code_for_paper("2405.19789")
get_code_for_paper("2405.19789")
have("2405.19789")

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

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

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

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

Connect an agent — have() is free.