SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2009.01974 · ICLR · 2021

FedBE: Making Bayesian Model Ensemble Applicable to Federated Learning

Wei-Lun Chao, Hong-You Chen

arXiv · PDF · Open in the Atlas

Code that ran

4 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 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/2009.01974.json · badge: /api/ran/2009.01974.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
hongyouc/FedBE canonical (classifier label)
classifier basis: classifier_2025
4 ran · 1 no recorded run
hongyouc/fedbe community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
FedAvg Ran
ran; our contract draft was wrong, not the code
hongyouc/FedBE/models/Fed.py
code served (permissive licence) · get_code("276295afe2705ae2")
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

torch.manual_seed(0)

# Create sample weight dictionaries for multiple clients
# Each client has a model with two parameter tensors
w = [
    {
        'layer1': torch.randn(4, 3),
        'layer2': torch.randn(5, 2)
    },
    {
        'layer1': torch.randn(4, 3),
        'layer2': torch.randn(5, 2)
    },
    {
        'layer1': torch.randn(4, 3),
        'layer2': torch.randn(5, 2)
    }
]

# Global weights for gradient normalization
global_w = {
    'layer1': torch.randn(4, 3),
    'layer2': torch.randn(5, 2)
}

# Sample sizes for each client (e.g., number of data points)
size_arr = np.array([100, 150, 200])

# GPU flag
gpu = False

ARGS = {
    'w': w,
    'gpu': gpu,
    'global_w': global_w,
    'size_arr': size_arr
}
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
create_local_init Ran
ran; our contract draft was wrong, not the code
hongyouc/FedBE/models/Fed.py
code served (permissive licence) · get_code("a672de245adafb60")
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 copy

torch.manual_seed(0)

# Create two dictionaries with tensor values
# These represent global and local model parameters
glob = {
    'weight1': torch.randn(4, 3),
    'weight2': torch.randn(2, 5),
    'bias1': torch.randn(3),
}

local = {
    'weight1': torch.randn(4, 3),
    'weight2': torch.randn(2, 5),
    'bias1': torch.randn(3),
}

bias_ratio = 0.3

ARGS = {
    'glob': glob,
    'local': local,
    'bias_ratio': bias_ratio,
}
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
mnist_iid Ran
ran; our contract draft was wrong, not the code
hongyouc/FedBE/utils/sampling.py
code served (permissive licence) · get_code("d9107114749c3e49")
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 minimal dataset stand-in
class MinimalDataset:
    def __init__(self, size):
        self.size = size
    
    def __len__(self):
        return self.size

# Set random seed for reproducibility
np.random.seed(0)

# Create arguments
dataset = MinimalDataset(size=100)
num_users = 5

ARGS = {
    "dataset": dataset,
    "num_users": num_users
}
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
mnist_noniid Ran
ran; our contract draft was wrong, not the code
hongyouc/FedBE/utils/sampling.py
code served (permissive licence) · get_code("d9d721ef1e522392")
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 numpy as np
import torch
from torch.utils.data import Dataset

torch.manual_seed(0)
np.random.seed(0)

class MockMNISTDataset:
    def __init__(self):
        # Create mock MNIST data with 60000 samples
        # train_labels needs to be a tensor with .numpy() method
        self.train_labels = torch.randint(0, 10, (60000,))

# Create dataset
dataset = MockMNISTDataset()

# Define arguments
ARGS = {
    'dataset': dataset,
    'num_users': 10,
    'num_data': 60000
}
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 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
SWAG_server Not yet run
unverified (harvested, no recorded run)
hongyouc/fedbe/swag.py
code served (permissive licence) · get_code("3ed041e66ac061a8")
How it ran

no invocation recorded.

cifar_iid Not yet run
unverified (harvested, no recorded run)
hongyouc/FedBE/utils/sampling.py
code served (permissive licence) · get_code("8aeca3fd6a73c15f")
How it ran

no invocation recorded.

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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 5 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
mnist_iid 5 other papers
3 dated earlier, 2 later
1812.07108 (2018-12)
Learning Private Neural Language Modeling with Attentive Aggregation
1907.01132 (2019-07)
Astraea: Self-balancing Federated Learning for Improving Classification Accuracy of Mobile Deep Learning Applications
1908.07873 (2019-08)
Federated Learning: Challenges, Methods, and Future Directions
and 2 more not named here

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

Federated learning aims to collaboratively train a strong global model by accessing users' locally trained models but not their own data. A crucial step is therefore to aggregate local models into a global model, which has been shown challenging when users have non-i.i.d. data. In this paper, we propose a novel aggregation algorithm named FEDBE, which takes a Bayesian inference perspective by sampling higher-quality global models and combining them via Bayesian model Ensemble, leading to much robust aggregation. We show that an effective model distribution can be constructed by simply fitting a Gaussian or Dirichlet distribution to the local models. Our empirical studies validate FEDBE's superior performance, especially when users' data are not i.i.d. and when the neural networks go deeper. Moreover, FEDBE is compatible with recent efforts in regularizing users' model training, making it an easily applicable module: you only need to replace the aggregation method but leave other parts of your federated learning algorithm intact. Our code is publicly available at https://github.com/hongyouc/FedBE.

For agents

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

get_harvested_code_for_paper("2009.01974")
get_code_for_paper("2009.01974")
have("2009.01974")

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

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

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

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

Connect an agent — have() is free.