Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN036 · Training method

Federated averaging

Combines local client updates into a shared model without centrally collecting each client’s raw training examples.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Combines local client updates into a shared model without centrally collecting each client’s raw training examples.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

A server distributes weights, selected clients perform local optimization, and model updates are aggregated.

Assumptions

Client data may be heterogeneous; participation and weighting define the target population. Communication failure, client drift, and privacy/security require separate treatment.

Formula / computational definition

θt+1=∑k∈Stnk∑j∈Stnjθt+1(k).\theta_{t+1}=\sum_{k\in S_t}\frac{n_k}{\sum_{j\in S_t}n_j}\theta_{t+1}^{(k)}.

Parameters and notation

Learned: global/local weights. Hyperparameters: client fraction, local epochs, local/server learning rates, batch size, weighting, communication rounds, personalization policy.

Fitting, fine-tuning, and adaptation

Initialize a common checkpoint, evaluate both global and per-client performance, and consider whether local adapters or a shared model fit the goal. Save client-sampling and aggregation metadata.

How to use and calibrate

Measure utility by client distribution, communication volume, and convergence. Example: learn a shared speech model across sites with different recording conditions.

Example application

learn a shared speech model across sites with different recording conditions.

Interpretation / pitfalls

Watch out

Keeping raw data local does not itself provide differential privacy or secure aggregation. Weight averaging assumes compatible parameter coordinates and can fail after divergent local training.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — numerical mechanism demonstration. · needs numpy

import numpy as np
local=np.array([[1.,2.],[1.4,1.8]]); counts=np.array([30.,70.])
print((local*counts[:,None]).sum(0)/counts.sum())
R

Component demo, not a trained model — numerical mechanism demonstration.

local <- rbind(c(1,2),c(1.4,1.8)); counts <- c(30,70)
print(colSums(local*counts)/sum(counts))

Sources

From the CodeSplash reference, entry TRN036.