Inferensys

Glossary

Federated Averaging (FedAvg)

Federated Averaging (FedAvg) is the foundational iterative algorithm for federated learning where a central server coordinates multiple clients to train a shared global model by periodically averaging their locally computed model updates.
ML engineer running AI model benchmarks, performance charts on multiple screens, late night home office setup.
FOUNDATIONAL ALGORITHM

What is Federated Averaging (FedAvg)?

Federated Averaging (FedAvg) is the canonical iterative algorithm for federated learning, enabling collaborative model training across decentralized devices without sharing raw data.

Federated Averaging (FedAvg) is a distributed optimization algorithm where a central server coordinates multiple clients to train a shared global model by periodically averaging their locally computed model deltas. Each selected client downloads the current global model, performs several local epochs of stochastic gradient descent on its private data, and sends only the resulting parameter update back to the server. The server then aggregates these updates, typically via a weighted average proportional to local dataset sizes, to produce a new global model for the next communication round.

The algorithm is designed to handle partial client participation and statistical heterogeneity (non-IID data) across devices, though these introduce challenges like client drift. Its core innovation is reducing communication frequency by performing more computation locally. FedAvg forms the basis for numerous advanced variants, such as FedProx and SCAFFOLD, which address its limitations. The process repeats iteratively in a federated training loop until the model converges, balancing learning efficiency with fundamental data privacy.

ALGORITHMIC MECHANICS

Core Characteristics of FedAvg

Federated Averaging (FedAvg) is defined by its iterative, decentralized coordination loop. These core characteristics distinguish it from centralized training and underpin its privacy, efficiency, and scalability.

01

Decentralized, Iterative Coordination Loop

FedAvg operates via a repeated communication round structure, forming its fundamental training loop:

  1. Server Broadcast: The central server sends the current global model to a selected subset of clients.
  2. Local Training: Each client downloads the model and performs local epochs of Stochastic Gradient Descent (SGD) on its private data, creating a local model.
  3. Update Transmission: Clients compute a model delta (the difference between local and global parameters) and send it to the server.
  4. Secure Aggregation: The server performs update aggregation, typically a weighted average based on client dataset sizes, to produce a new global model. This loop continues until convergence, ensuring raw training data never leaves the client device.
02

Statistical Heterogeneity (Non-IID Data) Handling

A defining challenge FedAvg must address is statistical heterogeneity, where client data is not independent and identically distributed (non-IID). This is the norm in real-world federated settings (e.g., different user typing habits on phones).

  • Client Drift: Local optimization on divergent data causes client models to diverge from the global objective, hindering convergence.
  • FedAvg's Implicit Robustness: By averaging many local updates, FedAvg empirically demonstrates a degree of inherent robustness to heterogeneity.
  • Explicit Mitigations: Advanced variants like FedProx (adds a proximal term to the local loss) and SCAFFOLD (uses control variates) were developed to explicitly correct for client drift, improving upon basic FedAvg under high heterogeneity.
03

Partial & Unreliable Client Participation

FedAvg is designed for a realistic partial client participation scenario, where only a fraction of the total client pool is available each round due to factors like:

  • Connectivity: Devices are intermittently online (mobile phones, IoT sensors).
  • Resource Constraints: Devices may be charging, idle, or have limited compute budget.
  • System Heterogeneity: Devices have varying hardware capabilities (stragglers). The algorithm does not require all clients to participate every round. Server-side weighted averaging naturally accounts for which clients contributed. Straggler mitigation techniques, such as dropping slow clients after a deadline, are often layered on top to maintain system efficiency.
04

Communication Efficiency via Local Computation

FedAvg's primary method for reducing communication costs—the bottleneck in cross-device FL—is to perform substantial local computation (multiple local epochs) between communication rounds.

  • FedAvg vs. FedSGD: Compared to the baseline FedSGD (where clients perform one gradient step per round), FedAvg can converge in far fewer rounds by amortizing the communication cost over more local computation.
  • Trade-off: Excessive local computation (too many epochs) can exacerbate client drift under non-IID data. Tuning the number of local epochs is critical.
  • Complementary Techniques: FedAvg is often combined with update compression methods (quantization, sparsification) to further reduce the size of transmitted model deltas.
05

Server-Side Aggregation as Simple Averaging

The canonical FedAvg algorithm uses a weighted averaging scheme for update aggregation on the server. The new global model parameters (\theta_{t+1}) are computed as: (\theta_{t+1} = \sum_{k \in S_t} \frac{n_k}{n} \theta_{t+1}^k) Where (S_t) is the set of participating clients, (n_k) is the number of samples on client (k), and (n) is the total samples across participating clients. This weighting aligns the global objective with the overall data distribution.

  • Synchronous Aggregation: The standard approach waits for all selected clients in a round.
  • Generalization (FedOpt): The FedOpt framework generalizes this step, allowing the server to apply adaptive optimizers like FedAdam or FedAvgM (with momentum) to the aggregated updates for potentially faster convergence.
06

Privacy as a Property, Not a Guarantee

FedAvg provides a foundational privacy-by-architecture benefit: raw training data remains on-device. However, transmitted model updates can potentially leak information about the underlying data through inference attacks.

  • Privacy Baseline: FedAvg alone does not offer formal privacy guarantees. It reduces the attack surface compared to data centralization.
  • Enhancing Privacy: FedAvg is the essential substrate upon which formal privacy techniques are integrated:
    • Secure Aggregation Protocols: Cryptographically combine updates so the server only sees the aggregate, not individual contributions.
    • Differential Privacy: Adding calibrated noise to client updates before aggregation provides mathematically bounded privacy guarantees. Thus, FedAvg enables privacy-preserving learning but must be combined with additional mechanisms for robust, verifiable privacy.
ALGORITHM COMPARISON

FedAvg vs. FedSGD: Key Algorithmic Differences

A technical comparison of the foundational Federated Stochastic Gradient Descent (FedSGD) algorithm and its more communication-efficient successor, Federated Averaging (FedAvg).

Algorithmic FeatureFederated SGD (FedSGD)Federated Averaging (FedAvg)

Core Local Computation

Single batch gradient computation

Multiple local epochs (E > 1) of SGD

Update Transmitted per Round

Gradient (∇) of the loss

Full model parameters (weights, θ)

Communication Frequency

High (after every local batch)

Low (after E local epochs)

Local Workload per Round

Minimal (one forward/backward pass)

Significant (multiple passes over local data)

Server Aggregation Step

Gradient Averaging: θ_{t+1} = θ_t - η * Σ ∇

Model Averaging: θ_{t+1} = Σ (n_k / n) * θ^k

Convergence Behavior

Analogous to centralized SGD; stable but slow

Can converge in far fewer communication rounds; prone to client drift under non-IID data

Primary Optimization Goal

Theoretical baseline; minimizes communication per gradient

Practical efficiency; minimizes total communication rounds

Typical Use Case

Theoretical analysis, highly sensitive or volatile data

Production systems with constrained bandwidth, stable client data

SYSTEMIC CONSTRAINTS

Key Challenges in FedAvg Deployment

While Federated Averaging provides a foundational privacy-preserving framework, its practical deployment in real-world systems introduces significant engineering and algorithmic hurdles that must be addressed for robust, efficient training.

01

Statistical Heterogeneity (Non-IID Data)

The core assumption of independent and identically distributed (IID) data is routinely violated in federated settings. Each client's local dataset is drawn from a unique distribution (e.g., different user writing styles on phones, regional health data patterns). This statistical heterogeneity causes client drift, where local models diverge from the global objective, severely hindering convergence and final model accuracy. Mitigation strategies include FedProx, SCAFFOLD, and personalized approaches like FedPer.

02

System Heterogeneity & Stragglers

Clients vary drastically in their hardware (CPU, memory), connectivity (bandwidth, latency), and availability (battery, network). This system heterogeneity creates stragglers—slow or intermittently available devices that bottleneck the synchronous Federated Training Loop. Solutions involve:

  • Asynchronous Aggregation protocols.
  • Deadline-based client selection.
  • Partial client participation per round.
  • Update compression to reduce transmission size for bandwidth-constrained devices.
03

Communication Bottlenecks

Transmitting full model updates (millions of parameters) over wireless networks in each communication round is prohibitively expensive and slow. The communication cost often dominates total training time. Key techniques to improve efficiency include:

  • Local Epochs > 1 to compute more locally per transmission.
  • Update Compression via quantization (reducing numerical precision) and sparsification (sending only the largest gradient values).
  • Federated Dropout to train smaller sub-networks.
04

Privacy & Security Threats

Federated learning protects raw data but exposes model updates to inference attacks. Model inversion or membership inference attacks can potentially reconstruct training data characteristics from shared gradients. Defenses require a layered approach:

  • Secure Aggregation Protocols using cryptographic multi-party computation to combine updates without revealing individual contributions.
  • Differential Privacy by adding calibrated noise to client updates before transmission.
  • Gradient Clipping to bound update magnitude, aiding both stability and privacy.
05

Unreliable & Adversarial Participants

The open participation model means some clients may be unreliable (sending corrupted updates due to faulty sensors) or actively Byzantine (sending malicious updates to poison the global model). This requires robust aggregation and validation mechanisms:

  • Robust Aggregation Rules (e.g., median, trimmed mean) instead of simple weighted averaging.
  • Update validation via reputation systems or anomaly detection on received model deltas.
  • Federated learning attack mitigation frameworks to filter outlying updates.
06

Model & Evaluation Complexity

Monitoring convergence and evaluating the final global model is challenging without access to a centralized test set. Performance may vary wildly across clients due to statistical heterogeneity. Engineers must implement:

  • Federated evaluation metrics computed securely across held-out client data.
  • Personalized Federated Learning (e.g., FedRep, FedBN) to tailor models per client when a single global model performs poorly.
  • Careful tracking of loss and accuracy per client cohort to detect fairness issues.
FEDERATED AVERAGING (FEDAVG)

Frequently Asked Questions

Federated Averaging (FedAvg) is the foundational algorithm for decentralized machine learning. These FAQs address its core mechanics, challenges, and practical implementation for engineers and architects.

Federated Averaging (FedAvg) is the canonical iterative algorithm for federated learning where a central server coordinates multiple clients to train a shared global model by periodically averaging their locally computed model updates. It operates in repeated communication rounds: 1) The server selects a subset of clients and sends them the current global model. 2) Each selected client downloads the model and performs local training (e.g., multiple local epochs of SGD) on its private data. 3) Each client sends its updated model delta (the difference between its local and the initial global model) back to the server. 4) The server performs weighted averaging, aggregating these deltas proportionally to each client's dataset size to produce a new global model. This loop continues until convergence.

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.