
Interactive paperOct 2026arXiv preprint
FedReason: Large Language Models as Weight-Space Meta-Aggregators for Heterogeneous Federated Learning
A large language model reads the client models in a restricted server-side sandbox and writes the aggregation program itself, six times in a 60-round run, with no training on the server and no weight tensor ever leaving it. It beat FedAvg in 10 of 12 paired label-skew runs, was the most accurate server-side rule on CIFAR-100, and excluded every sign-flipping client from the first round.
Interactive simulation
The server writes its own aggregation program
Pick one of the paper’s five settings. At rounds 1, 11, 21, 31, 41 and 51 the LLM reads printed sandbox output, spends up to six proxy evaluations, and submits aggregate(ctx), which must pass a dry run before it aggregates a single round.
- Round
- 01/ 60
- Active program
- FedAvgdefault
- Clients excluded
- 0/ 10
- Simulated gap vs FedAvg
- +0.00pts
An illustrative, real-time model of the method. The figures reported below come from the paper's experiments.
01
Results
Reading the client models beat FedAvg in 10 of 12 paired label-skew runs and an equal-budget selector of standard rules in 9, made FedReason the most accurate server-side rule on CIFAR-100, and shut sign-flipping clients out from the first round.
+1.26pp
Mean gain over FedAvg across 12 paired label-skew runs (95% CI 0.38 to 2.14), with 10 wins.
+1.08pp
Over ProxySel, which spends the same three proxy evaluations per round choosing among standard rules (9 wins, 1 tie).
1.00F1
Sign-flipping clients excluded from round 1 in both seeds with no honest client excluded; they received 0.43% of the aggregate, against 29.11% under FedAvg.
0.79USD
Average API cost of a 60-round run with six invocations (0.56 to 1.26 USD); one invocation cost 0.13 USD.
Reported results
Transcribed from Tables 2 to 5
Final test accuracy (%) after 60 rounds, mean of three seeds (Table 2). Each panel has its own zoomed axis. Hollow marks (†) change the clients; every other rule changes only the server.
- FedReason66.53
- FedAvg
- FedProx†
- FedAvgM
- FedAdam
- FedNova
- SCAFFOLD†
- FedAdp
- ProxySel
- FedReason87.77
- FedAvg
- FedProx†
- FedAvgM
- FedAdam
- FedNova
- SCAFFOLD†
- FedAdp
- ProxySel
- FedReason62.26
- FedAvg
- FedProx†
- FedAvgM
- FedAdam
- FedNova
- SCAFFOLD†
- FedAdp
- ProxySel
- FedReason67.72
- FedAvg
- FedProx†
- FedAvgM
- FedAdam
- FedNova
- SCAFFOLD†
- FedAdp
- ProxySel
| Method | CIFAR-10, α = 0.1 | CIFAR-10, α = 0.5 | CIFAR-100, α = 0.1 | CIFAR-100, α = 0.5 | Mean |
|---|---|---|---|---|---|
| FedReason | 66.53 ± 6.34 | 87.77 ± 0.95 | 62.26 ± 1.35 | 67.72 ± 0.88 | 71.07 |
| FedAvg | 65.72 ± 4.80 | 87.34 ± 0.34 | 59.95 ± 1.07 | 66.24 ± 0.17 | 69.81 |
| FedProx† | 67.65 ± 4.18 | 87.14 ± 0.57 | 59.03 ± 0.91 | 65.90 ± 0.75 | 69.93 |
| FedAvgM | 67.18 ± 2.43 | 87.87 ± 0.69 | 59.68 ± 1.33 | 65.00 ± 0.14 | 69.93 |
| FedAdam | 66.59 ± 3.49 | 87.13 ± 0.43 | 59.23 ± 0.76 | 65.41 ± 0.17 | 69.59 |
| FedNova | 46.59 ± 15.51 | 87.23 ± 1.46 | 59.88 ± 1.15 | 66.16 ± 0.75 | 64.97 |
| SCAFFOLD† | 70.52 ± 2.72 | 88.22 ± 0.37 | 62.39 ± 0.88 | 68.09 ± 0.52 | 72.31 |
| FedAdp | 58.61 ± 7.07 | 85.38 ± 1.86 | 59.64 ± 1.37 | 66.20 ± 0.23 | 67.46 |
| ProxySel | 65.69 ± 5.60 | 87.31 ± 0.01 | 60.26 ± 0.88 | 66.70 ± 0.08 | 69.99 |
Paired over 12 setting and seed pairs, FedReason beat FedAvg by 1.26 pp (95% CI 0.38 to 2.14, 10 wins), ProxySel by 1.08 pp (9 wins, 1 tie) and FedAdp in all 12 pairs (+3.61 pp). On CIFAR-100 it was the most accurate rule that changes only the server.
Test accuracy (%) with 3 of 10 clients malicious from the first round, CIFAR-10, α = 0.5, mean of two seeds (Table 4). FLTrust trains a root model on the server; FedReason only runs forward evaluations.
- FedReason85.24
- FLTrust85.95
- Median57.17
- Trimmed mean51.44
- Krum51.82
- ProxySel10.00
- FedAvg10.00
- FedReason84.94
- FLTrust86.20
- Median71.19
- Trimmed mean71.94
- Krum52.70
- ProxySel80.47
- FedAvg78.93
| Method | Sign flip acc. | Sign flip ω̄ (%) | Sign flip F1 | Label flip acc. | Label flip ω̄ (%) | Label flip F1 | Detection round |
|---|---|---|---|---|---|---|---|
| FedReason | 85.24 ± 0.97 | 0.43 | 1.00 | 84.94 ± 0.14 | 4.31 | 0.85 | 16 |
| FLTrust | 85.95 ± 0.89 | 0.00 | 1.00 | 86.20 ± 0.71 | 2.44 | 0.89 | 32.5 |
| Median | 57.17 ± 2.11 | 9.65 | 0.00 | 71.19 ± 0.49 | 26.68 | 0.00 | never |
| Trimmed mean | 51.44 ± 5.88 | 10.49 | 0.00 | 71.94 ± 0.08 | 26.98 | 0.00 | never |
| Krum | 51.82 ± 10.30 | 0.00 | 0.50 | 52.70 ± 11.55 | 0.83 | 0.50 | 1.5 |
| ProxySel | 10.00 ± 0.00 | 29.11 | 0.00 | 80.47 ± 4.89 | 29.11 | 0.00 | never |
| FedAvg | 10.00 ± 0.00 | 29.11 | 0.00 | 78.93 ± 5.47 | 29.11 | 0.00 | never |
Under sign flipping FedReason gave the attackers 0.43% of the aggregate on average (FedAvg 29.11%) and excluded all three from round 1 in both seeds without excluding an honest client (F1 1.00). Without attack it matched FLTrust (87.77% against 87.81%).
Final test accuracy (%) of each served sub-model, CIFAR-100, α = 0.5, with three clients at ×1, three at ×½ and four at ×¼, mean of two seeds (Table 3). FedReason uses the same static extraction as HeteroFL, so the comparison isolates aggregation.
- FedReason47.73
- HeteroFL46.33
- FedAvg46.07
- ProxySel44.03
- FedRolex47.17
- FedReason48.63
- HeteroFL47.82
- FedAvg47.34
- ProxySel46.23
- FedRolex29.18
- FedReason46.14
- HeteroFL44.49
- FedAvg43.82
- ProxySel44.06
- FedRolex6.24
| Method | ×1 | ×½ | ×¼ | Mean |
|---|---|---|---|---|
| FedReason | 47.73 ± 0.59 | 48.63 ± 0.45 | 46.14 ± 0.62 | 47.50 |
| HeteroFL | 46.33 ± 0.95 | 47.82 ± 0.48 | 44.49 ± 1.35 | 46.21 |
| FedAvg | 46.07 ± 0.62 | 47.34 ± 0.19 | 43.82 ± 0.55 | 45.74 |
| ProxySel | 44.03 ± 0.21 | 46.23 ± 0.04 | 44.06 ± 1.19 | 44.77 |
| FedRolex | 47.17 ± 0.54 | 29.18 ± 0.83 | 6.24 ± 1.68 | 27.53 |
FedReason was the most accurate method at every width on CIFAR-100 (mean 47.50% against 46.21% for HeteroFL). Pooled over both datasets its global model was 1.22 pp more accurate than HeteroFL’s and won all four pairs.
Final test accuracy (%) of FedReason variants, CIFAR-10, α = 0.1, seed 0 (Table 5). Hover a bar for the proxy evaluations, requests and API cost of each run.
- FedReason, full73.84
- High reasoning effort73.87
- Every 5 rounds70.16
- Metrics only67.86
- No proxy feedback38.84
- ProxySel71.38
- FedAvg71.11
| Variant | Accuracy (%) | Δ (pp) | Proxy evaluations | Requests per invocation | Cost per run (USD) |
|---|---|---|---|---|---|
| FedReason, full | 73.84 | ref. | 169 | 6.3 | 1.22 |
| High reasoning effort | 73.87 | +0.03 | 114 | 7.3 | 1.80 |
| Every 5 rounds | 70.16 | -3.68 | 138 | 4.3 | 1.78 |
| Metrics only | 67.86 | -5.98 | 163 | 2.5 | 0.48 |
| No proxy feedback | 38.84 | -35.00 | 0 | 2.3 | 0.55 |
| ProxySel | 71.38 | -2.46 | 180 | ||
| FedAvg | 71.11 | -2.73 | 0 |
The full method cost 1.22 USD in this run. Withholding the weights cost about six points and removing proxy feedback 35, each in one seed: the LLM needs both the weights and a few forward evaluations.
Evaluated with Claude Opus 5.5 on CIFAR-10 and CIFAR-100 with ResNet-18, K = 10 clients, 60 rounds and full participation, in 168 runs against 14 baselines: FedAvg, FedProx, FedAvgM, FedAdam, FedNova, SCAFFOLD, FedAdp and ProxySel under label skew; HeteroFL and FedRolex for mixed widths; the coordinate-wise median, the trimmed mean, Krum and FLTrust under attack. Every one of the 150 invocations in the 24 FedReason runs ended with a program that passed its dry run at the first submission, and no round fell back to FedAvg. FedReason did not beat SCAFFOLD, which changes the clients and could be combined with it.
01
Invoke every ten rounds
At rounds 1, 11, 21, 31, 41 and 51 the server opens a new tool-use conversation of at most ten model requests. Its brief carries the setting, client metadata, the proxy history, the previous program with its rationale, and the LLM’s own notes.
02
Read the weights in a sandbox
The python tool runs code on read-only copies of G, W, U and the metadata and returns only printed output, cut to 6,000 characters. summary() reports norms with robust z-scores, leave-one-out cosines and the classes each classifier moved most. Label histograms, attacker identities and the test set are never exposed.
03
Score a few candidates
proxy_eval scores candidate models on 500 class-balanced proxy images, at most six times per invocation, and a program may use three evaluations per round. Nothing is fitted by gradient descent on the server.
04
Dry-run, then check every round
submit_policy sends aggregate(ctx) with a rationale and notes; it must pass a dry run on the current round, with up to three submissions. Every round its output is checked for keys and shapes, finite values, non-negative running variances and an update norm of at most ten times the largest client update; a failing round uses FedAvg and rolls back ctx.memory.
03
Inside the programs
Across the 120 programs accepted in the 20 main runs, the LLM settled on a consistent toolkit, and every decision is stored as code with its rationale.
98%
clipped update norms.
91%
down-weighted clients whose update direction disagreed with the others.
100%
kept per-client suspicion counters in ctx.memory and returned FedAvg from an exception handler.
92%
of the programs in the width-heterogeneous settings used width-aware weighting.
45%
selected among candidates on the proxy set.
38%
aggregated the classifier rows class by class.
35%
used server momentum, never in the Byzantine runs.
0.95of 3
per-round proxy evaluations used on average: 74 per run including analysis, against 180 for ProxySel.
def aggregate(ctx):
torch, np = ctx.torch, ctx.np
K = ctx.num_clients
n = np.array([m['num_samples'] for m in ctx.meta], dtype=float)
cids = [m['cid'] for m in ctx.meta]
w0 = n / n.sum()
try:
M = ctx.update_matrix()
Gm = M @ M.T
nr = Gm.diag().clamp_min(1e-12).sqrt()
C = (Gm / (nr[:, None] * nr[None, :])).numpy().astype(float)
np.fill_diagonal(C, np.nan)
medcos = np.nanmedian(C, axis=1)
norms = nr.numpy().astype(float)
mednorm = float(np.median(norms))
gmed = float(np.median(medcos))
flag = (norms > 3.0 * mednorm) | ((medcos < 0.0) & (medcos < gmed - 0.05))
mem = ctx.memory.setdefault('susp', {})
for i, c in enumerate(cids):
h = mem.setdefault(str(c), [0, 0])
h[0] += int(flag[i]); h[1] += 1
excl = flag.copy()
for i, c in enumerate(cids):
h = mem[str(c)]
if h[0] >= 3 and h[0] >= 0.5 * h[1]:
excl[i] = True
if (~excl).sum() < 3:
excl = norms > 3.0 * mednorm
if (~excl).sum() < 3:
excl = np.zeros(K, dtype=bool)
w = w0.copy(); w[excl] = 0.0
w = w / w.sum()
# clip accepted updates to the median norm of accepted clients
accn = norms[~excl]
cap = float(np.median(accn))
scale = np.minimum(1.0, cap / np.maximum(norms, 1e-12))
coef = torch.as_tensor(w * scale, dtype=torch.float32)
upd = (coef[:, None] * M).sum(0)
d = ctx.unflatten(upd)
bn_keys = [k for k, _, kind, _ in ctx.layers if kind == 'bn_stat']
new = ctx.weighted_average(w, keys=bn_keys)
new = dict(new)
for k, v in d.items():
new[k] = ctx.G[k] + v
print(f'excl={[cids[i] for i in range(K) if excl[i]]} medcos={np.round(medcos,2).tolist()}')
return new, {'weights': w.tolist()}
except Exception as exc:
print(f'fallback FedAvg: {exc}')
return ctx.fedavg(), {'weights': w0.tolist()}
The program flags a client whose update norm exceeds three times the median norm, or whose median cosine with the other clients is negative and at least 0.05 below the median over all clients; it counts flags in ctx.memory, clips accepted updates to their median norm and returns FedAvg if anything raises an exception. Its successors kept the exclusion rule and added class-evidence weighting of the classifier rows (round 11), a proxy-checked choice between server steps of 1.0 and 1.3 (round 31) and a proxy-checked moving average of global models for the last rounds (round 51).
04
Why it matters
Each aggregation rule in common use encodes one assumption about what goes wrong: label skew, sub-models of different widths, or malicious clients. A deployment rarely knows in advance which assumption holds. FedReason lets the server read the client models it actually received and write the rule the evidence supports, as a program it can replace every ten rounds, without fitting a single parameter on the server. The rows of a classifier reveal which classes a client has seen, and the size and direction of an update reveal whether it agrees with the others; a weighted average throws that information away.
The design is practical by construction. The clients run ordinary local training and nothing changes on their side. Full weight tensors never leave the server, every program is dry-run before it aggregates a round and checked in every round with a FedAvg fallback, and each decision is stored as code together with its rationale so it can be audited after training. A 60-round run needs six invocations at 0.13 USD and about 41 seconds each, a cost fixed in advance that grows with neither the model size nor the number of rounds between invocations.
05
Cite this work
@misc{mohammadiruzbahani2026fedreason,
title = {{FedReason}: Large Language Models as Weight-Space Meta-Aggregators for Heterogeneous Federated Learning},
author = {Mohammadi Ruzbahani, Ali and Yazdinejad, Abbas and Karimipour, Hadis},
year = {2026},
eprint = {2611.08383},
archivePrefix = {arXiv},
doi = {10.48550/arXiv.2611.08383},
url = {https://arxiv.org/abs/2611.08383}
}
Mohammadi Ruzbahani, A., Yazdinejad, A., & Karimipour, H. (2026). FedReason: Large language models as weight-space meta-aggregators for heterogeneous federated learning. arXiv:2611.08383. https://doi.org/10.48550/arXiv.2611.08383
A. Mohammadi Ruzbahani, A. Yazdinejad, and H. Karimipour, "FedReason: Large language models as weight-space meta-aggregators for heterogeneous federated learning," arXiv:2611.08383, 2026, doi: 10.48550/arXiv.2611.08383.

