Inferensys

Glossary

Federated Averaging (FedAvg)

Federated Averaging (FedAvg) is the foundational federated optimization algorithm that combines local stochastic gradient descent (SGD) on clients with iterative server-side model averaging to reduce communication rounds.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
FOUNDATIONAL ALGORITHM

What is Federated Averaging (FedAvg)?

The core optimization algorithm that enables decentralized model training by combining local stochastic gradient descent on client devices with iterative server-side model averaging to minimize communication overhead.

Federated Averaging (FedAvg) is a distributed optimization algorithm where a central server initializes a global model, distributes it to a random subset of clients, and each client performs multiple steps of stochastic gradient descent (SGD) on its local private data. The server then constructs a new global model by computing a weighted average of the resulting client model updates, typically weighted by the number of local training samples, thereby reducing the communication rounds required for convergence compared to naive distributed SGD.

The algorithm directly addresses the communication efficiency bottleneck in federated learning by increasing local computation per round. By allowing clients to take multiple gradient steps before synchronizing, FedAvg tolerates the statistical heterogeneity of non-IID data distributions across devices, though this can introduce client drift. The technique remains the foundational baseline for most modern federated systems, including cross-device deployments on smartphones and cross-silo collaborations between institutions.

Algorithmic Foundations

Key Characteristics of FedAvg

The core architectural properties that make Federated Averaging the dominant optimization strategy for decentralized training, balancing communication efficiency with statistical convergence.

01

Local Stochastic Gradient Descent (SGD)

Each client performs multiple steps of stochastic gradient descent on its local data partition before communicating. This contrasts with single-step gradient sharing by:

  • Reducing communication rounds by a factor proportional to local epochs
  • Allowing clients to make meaningful progress on non-IID distributions
  • Trading increased local computation for decreased network bandwidth

The server does not see raw data—only the resulting weight updates after local optimization completes.

02

Iterative Server-Side Averaging

The central server computes a weighted average of client model updates to form the new global model. The aggregation rule is:

w_global = Σ (n_k / n) * w_k

Where n_k is the number of samples on client k and n is the total samples across selected clients. This weighting ensures clients with more data exert proportionally greater influence on the global model, improving statistical efficiency.

03

Communication Round Structure

FedAvg operates in discrete synchronized rounds:

  1. Server broadcasts current global model to selected clients
  2. Clients train locally for E epochs on their private data
  3. Clients upload only model weights (not gradients or data)
  4. Server aggregates and produces the next global model

This structure decouples training from data centralization, making it suitable for bandwidth-constrained and privacy-sensitive deployments.

04

Handling Statistical Heterogeneity

FedAvg is designed to operate under non-IID data distributions where client datasets differ significantly. Key mechanisms include:

  • Weighted averaging that accounts for dataset size disparities
  • Multiple local epochs that allow clients to adapt to local distributions
  • Implicit regularization from averaging diverse client updates

However, extreme non-IID conditions can cause client drift, where local models diverge from the global optimum, slowing convergence. Variants like FedProx address this limitation.

05

Privacy by Architecture

FedAvg provides a baseline privacy guarantee through data locality:

  • Raw training data never leaves the client device
  • Only model weight updates are transmitted to the server
  • Individual updates are ephemeral and aggregated before use

This architectural privacy is often enhanced with secure aggregation (cryptographic masking of individual updates) and differential privacy (noise injection) to protect against gradient leakage attacks that could reconstruct training samples.

06

Client Selection and Scalability

In cross-device deployments with millions of clients, FedAvg uses random subset sampling:

  • Only a fraction of available clients participate in each round
  • Selection can be uniform random or weighted by device capability
  • Stragglers (slow clients) may be dropped to maintain round timing

This sampling introduces stochasticity that can actually improve generalization while keeping communication costs manageable at massive scale.

FEDERATED AVERAGING

Frequently Asked Questions

Clear, technical answers to the most common questions about the foundational Federated Averaging (FedAvg) algorithm, its mechanisms, and its role in privacy-preserving machine learning.

Federated Averaging (FedAvg) is the foundational optimization algorithm for federated learning that combines local stochastic gradient descent (SGD) on distributed clients with iterative server-side model averaging to train a global model without centralizing raw data. The process works in synchronous communication rounds: the server initializes a global model and distributes it to a selected subset of clients. Each client performs multiple epochs of local SGD on its private dataset, producing an updated local model. These local updates are then transmitted back to the server, which computes a weighted average of the received models—typically weighted by the number of local training samples—to produce a new global model. This cycle repeats until convergence. By moving computation to the data rather than data to the computation, FedAvg dramatically reduces communication overhead compared to naive distributed SGD while preserving data locality and privacy.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.