Inferensys

Glossary

Federated Averaging (FedAvg)

Federated Averaging (FedAvg) is the foundational federated learning algorithm that combines locally trained model weights on a central server by computing a weighted average, enabling collaborative model training without centralizing raw data.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.

What is Federated Averaging (FedAvg)?

Federated Averaging (FedAvg) is the foundational algorithm for federated learning that constructs a global model by computing a weighted average of locally trained model updates from decentralized client devices, without ever centralizing raw data.

Federated Averaging (FedAvg) is a distributed optimization algorithm where a central server initializes a global model and distributes it to a selected subset of clients. Each client trains the model on its local Non-IID data for several epochs, then transmits only the resulting model weight updates—not the training data—back to the server. The server aggregates these updates by computing a weighted average, typically proportional to the size of each client's local dataset, to produce a new global model for the next communication round.

This iterative process minimizes a global loss function while preserving data locality, making it a cornerstone of privacy-preserving machine learning. FedAvg's efficiency relies on reducing communication rounds by performing multiple local SGD steps before aggregation. However, its convergence can be challenged by statistical heterogeneity across clients and is vulnerable to model poisoning attacks, necessitating complementary defenses like secure aggregation or Byzantine Fault Tolerance mechanisms to ensure robustness.

ALGORITHM MECHANICS

Key Characteristics of FedAvg

Federated Averaging (FedAvg) is the foundational algorithm for decentralized training. It combines local stochastic gradient descent (SGD) on distributed clients with a central server that computes a weighted average of the resulting model updates.

01

Decentralized Local Training

Instead of centralizing raw data, FedAvg pushes the computation to the edge. Each client downloads the global model and performs multiple epochs of local training using its private dataset. This local computation is the core privacy-preserving mechanism, as raw data never leaves the device. The number of local epochs is a critical hyperparameter; more local steps reduce communication but can cause client drift in Non-IID Data settings.

02

Weighted Parameter Averaging

The central server aggregates locally trained model weights by computing a weighted average, typically proportional to the size of each client's local dataset. The formula 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 all selected clients. This ensures clients with more data have a proportionally greater influence on the global model.

03

Communication Efficiency

FedAvg reduces communication overhead by allowing clients to perform multiple local SGD steps before sending updates to the server. This contrasts with Federated SGD, which requires communication after every single batch. Key trade-offs:

  • More local epochs = Less communication, higher risk of client drift
  • Fewer local epochs = More communication, better convergence on heterogeneous data
  • Gradient compression techniques like quantization can further reduce bandwidth requirements.
04

Client Selection & Scheduling

In each training round, the server selects a random subset of available clients to participate. This sampling introduces stochasticity that can actually improve generalization. Critical considerations include:

  • Device availability: Mobile devices may only participate when idle, charging, and on Wi-Fi
  • Straggler mitigation: Setting a timeout to drop slow clients prevents bottlenecking the round
  • Bias in selection: Non-uniform sampling can skew the global model toward over-represented data distributions
05

Vulnerability to Gradient Leakage

While FedAvg keeps raw data local, the shared model updates are not inherently private. Gradient Inversion attacks can reconstruct training samples from the gradients of shallow networks. Membership Inference attacks can determine if a specific record was used locally. This necessitates combining FedAvg with privacy-enhancing technologies like Differential Privacy (via DP-SGD) or Secure Aggregation protocols that cryptographically mask individual updates from the server.

06

Handling Statistical Heterogeneity

Real-world federated data is almost always Non-IID—different clients have skewed label distributions or entirely different feature distributions. FedAvg can struggle with this heterogeneity, leading to divergent local models and a degraded global model. Mitigation strategies include:

  • FedProx: Adds a proximal term to local objectives to keep updates close to the global model
  • SCAFFOLD: Uses control variates to correct for client drift
  • Personalized Federated Learning: Maintains local model components alongside the global model
FEDERATED AVERAGING

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the foundational algorithm that powers decentralized machine learning.

Federated Averaging (FedAvg) is the foundational optimization algorithm for federated learning that constructs a global model by computing a weighted average of locally trained model parameters from multiple decentralized clients, without ever centralizing raw data. The process operates in communication rounds: a central server initializes a global model and distributes it to a selected subset of clients. Each client trains the model on its local private dataset for several epochs using stochastic gradient descent (SGD) , producing an updated local model. The client transmits only these model updates—never the underlying data—back to the server. The server then aggregates these updates by computing a weighted mean, where each client's contribution is typically weighted proportionally to the size of its local dataset: w_global = Σ (n_k / n_total) * w_k. This aggregated model becomes the new global model for the next round, and the cycle repeats until convergence. This elegant mechanism allows the model to learn from the entire distributed dataset while respecting data locality and privacy constraints.

AGGREGATION COMPARISON

FedAvg vs. Other Aggregation Methods

Comparison of Federated Averaging against alternative aggregation strategies for distributed learning under non-IID data and adversarial conditions.

FeatureFedAvgSecure AggregationKrum

Primary Mechanism

Weighted average of local model updates

Sum of encrypted updates via secret sharing

Selects single update with minimal Euclidean distance to neighbors

Privacy Guarantee

None (raw gradients visible to server)

Strong (server sees only aggregate)

None (raw gradients visible to server)

Byzantine Fault Tolerance

Non-IID Robustness

Degrades with high heterogeneity

Same as FedAvg (privacy layer only)

Moderate (rejects outliers but may discard useful updates)

Communication Overhead

O(n) per round

O(n^2) with pairwise masking

O(n^2) for distance computation

Computational Cost

Low (simple averaging)

High (cryptographic operations)

Moderate (pairwise distance calculations)

Client Dropout Tolerance

High (waits for fraction of clients)

Low (requires quorum for secret reconstruction)

High (operates on received subset)

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.