Inferensys

Glossary

Federated Averaging (FedAvg)

Federated Averaging (FedAvg) is the foundational federated learning algorithm that aggregates locally computed model updates from multiple clients by averaging their weights to produce a single, improved global model without centralizing raw data.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
DEFINITION

What is Federated Averaging (FedAvg)?

The foundational federated learning algorithm that aggregates locally computed model updates from multiple clients by averaging their weights to produce a single, improved global model.

Federated Averaging (FedAvg) is the seminal aggregation algorithm for federated learning where a central server constructs a new global model by computing a weighted average of the model parameters received from a selected cohort of clients. Each client trains locally on its private dataset for multiple epochs before transmitting only the resulting weight updates, never the raw data, to the server.

The algorithm addresses statistical heterogeneity by balancing local computation against communication efficiency. By allowing clients to perform multiple local SGD steps per round, FedAvg reduces the rounds required for convergence compared to Federated SGD, making it practical for cross-device settings with limited bandwidth and high latency.

ALGORITHM PRIMER

Key Characteristics of FedAvg

Federated Averaging (FedAvg) is the canonical algorithm for decentralized training. It balances communication efficiency with model convergence by combining local stochastic gradient descent (SGD) on edge devices with periodic server-side averaging.

01

The Local Training Loop

In each communication round, the server selects a subset of clients. Each client downloads the current global model weights and performs multiple steps of stochastic gradient descent (SGD) on its local, private dataset. This local computation reduces the frequency of communication compared to naive distributed SGD.

  • Epochs: A hyperparameter E defines how many full passes a client makes over its local data.
  • Batch Size: A hyperparameter B defines the mini-batch size used for local updates.
  • Trade-off: More local computation (higher E) reduces communication rounds but increases the risk of client drift due to statistical heterogeneity.
02

The Weighted Aggregation Step

The server collects the model updates from participating clients and computes a new global model by taking a weighted average of the received parameters. The weight for each client is typically proportional to the size of its local dataset (n_k).

  • Formula: The global weight w_{t+1} is calculated as the sum of (n_k / n) * w^k_{t+1} for all participating clients k.
  • Rationale: This ensures that clients with more data have a proportionally greater influence on the global model.
  • Equivalence: In the case of a convex loss function and a single local epoch, FedAvg is mathematically equivalent to centralized mini-batch SGD.
03

Communication Efficiency

FedAvg's primary innovation is reducing the communication-to-computation ratio. By performing multiple local updates before synchronizing, it minimizes the number of data transfers over bandwidth-constrained wireless links.

  • Fraction of Clients (C): Only a random fraction of clients participate in each round, further reducing uplink congestion.
  • Gradient Compression: FedAvg is often combined with sparsification or quantization to compress the model updates before transmission.
  • Impact: This makes federated learning feasible for cross-device settings with millions of intermittently connected edge devices.
04

Handling Non-IID Data

A fundamental challenge for FedAvg is statistical heterogeneity, where local data distributions across clients are non-identically distributed (non-IID). This causes local optima to drift away from the global optimum.

  • Weight Divergence: With highly skewed non-IID data, the simple averaging of weights can lead to a global model that performs poorly on any individual client's distribution.
  • Mitigations: Variants like FedProx add a proximal term to the local objective to constrain local updates, while SCAFFOLD uses control variates to correct for client drift.
  • Empirical Finding: Despite its simplicity, FedAvg demonstrates surprising empirical robustness to moderate levels of non-IID data.
05

Security and Privacy Properties

By design, FedAvg keeps raw training data on the client device, providing a baseline level of data minimization. However, the model updates themselves can leak sensitive information.

  • Model Inversion: An honest-but-curious server can potentially reconstruct training samples from the gradients shared by a client.
  • Defense Integration: FedAvg is typically deployed with Secure Aggregation to prevent the server from inspecting individual updates, and Differential Privacy to add calibrated noise to the updates.
  • Poisoning Vulnerability: The server-side averaging is vulnerable to model poisoning attacks, where a single malicious client can corrupt the global model by uploading a scaled, adversarial update.
06

Synchronous Round Structure

FedAvg operates in a synchronous lock-step manner. The server waits for all selected clients to complete their local computation and report back before proceeding to the next round.

  • Straggler Problem: The entire round is delayed by the slowest participating device, a critical issue in heterogeneous edge networks.
  • Timeout Mechanism: In practice, a server-imposed deadline is used; clients that do not respond in time are simply dropped from that round.
  • Asynchronous Variants: To mitigate stragglers, Asynchronous Federated Learning protocols update the global model immediately upon receiving any client's update, trading off some mathematical consistency for reduced wall-clock time.
FEDERATED AVERAGING (FEDAVG) EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the foundational algorithm that powers privacy-preserving, decentralized model training across wireless edge devices.

Federated Averaging (FedAvg) is the foundational aggregation algorithm for federated learning that constructs a global model by computing a weighted average of locally trained model updates from multiple distributed clients. The process operates in communication rounds: a central server initializes a global model and distributes it to a selected cohort of clients. Each client performs several iterations of stochastic gradient descent (SGD) on its local, private dataset, producing an updated model. The server then collects these local model updates and computes the new global model as a weighted sum, where each client's contribution is typically weighted by the size of its local dataset. This iterative process repeats until convergence, enabling collaborative learning without any raw data ever leaving the edge devices.

AGGREGATION COMPARISON

FedAvg vs. Other Aggregation Strategies

A comparison of Federated Averaging against alternative aggregation strategies for distributed model training in non-IID wireless environments.

FeatureFedAvgFedProxSCAFFOLD

Aggregation Mechanism

Weighted average of local model weights

Weighted average with proximal term

Weighted average of update directions corrected for client drift

Handles Statistical Heterogeneity

Handles Systems Heterogeneity

Convergence on Non-IID Data

Slower, may diverge

Stable, guaranteed convergence

Faster, robust convergence

Communication Overhead

Low (model weights only)

Low (model weights only)

Medium (weights + control variates)

Client Computation Overhead

Low (standard SGD)

Low (modified local loss)

Higher (maintains control variate state)

Proximal Term Required

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.