Inferensys

Glossary

SCAFFOLD

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is an algorithm that uses control variates to correct for client drift, achieving faster convergence under non-IID data by reducing the variance in client updates.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
FEDERATED AVERAGING ALGORITHM

What is SCAFFOLD?

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is an advanced federated optimization algorithm designed to correct for client drift caused by non-IID data distributions.

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm that uses control variates—client-specific and server-side correction terms—to reduce the variance in local updates. By maintaining these control states, it explicitly corrects for the client drift that occurs when clients train on statistically heterogeneous (non-IID) data, leading to significantly faster and more stable convergence compared to standard Federated Averaging (FedAvg).

The algorithm operates by having each client compute the difference between its local stochastic gradient and a shared global direction, storing this as a local control variate. The server aggregates these corrections to update a global control variate, which is then used to steer subsequent client updates. This mechanism effectively de-biases local training, making SCAFFOLD particularly effective in cross-device settings with high data heterogeneity and partial client participation.

ALGORITHM MECHANISM

Key Features of SCAFFOLD

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm that introduces control variates to correct for client drift, achieving faster and more stable convergence, especially under non-IID data distributions.

01

Control Variates for Client Drift

The core innovation of SCAFFOLD is the use of control variates—client-specific and server-side correction terms. The client control variate c_i estimates the direction of the client's drift from the global objective. During local training, the client's update is corrected by subtracting its own control variate and adding the server's control variate c. This mechanism directly counteracts the variance introduced by non-IID data, steering local updates toward the global optimum.

  • Client Update Correction: local_gradient = gradient - c_i + c
  • Reduces Update Variance: By accounting for persistent client bias, the variance of the aggregated updates is significantly lower than in standard FedAvg.
02

Dual Control Variate Update

SCAFFOLD maintains and updates two sets of control variates in each communication round, creating a feedback loop for bias correction.

  • Server Control Variate (c): Represents the average direction of all client updates. It is updated on the server using the difference between the new global model and the previous one.
  • Client Control Variate (c_i): Captures the individual bias of client i. It is updated locally by the client based on the difference between its local update and the server's direction (c).

This dual update ensures the control variates accurately track both the global progress and each client's unique statistical skew.

03

Convergence Under Non-IID Data

SCAFFOLD provides provably faster convergence than Federated Averaging (FedAvg) in heterogeneous data settings. Its theoretical guarantee shows a convergence rate that is independent of data heterogeneity (the degree of non-IID-ness), unlike FedAvg whose convergence slows significantly as heterogeneity increases.

  • Eliminates Client Drift: The control variate correction prevents clients from over-optimizing toward their local data minima.
  • Linear Speedup: Convergence improves proportionally with the number of clients participating per round, a property often lost in FedAvg under non-IID data.
04

Communication Efficiency

While SCAFFOLD transmits both a model update and a control variate update, it often achieves a net reduction in total communication rounds required to reach a target accuracy. The increased per-round communication cost is offset by drastically faster convergence.

  • Fewer Rounds to Convergence: The variance reduction means each aggregation step is more effective, requiring fewer rounds than FedAvg.
  • Fixed Overhead: The control variate is the same size as the model gradient, doubling the per-client upload size but not scaling with dataset size.
05

Comparison to FedProx

Both SCAFFOLD and FedProx address client drift, but through fundamentally different mechanisms.

  • FedProx: Adds a proximal term to the local loss function, penalizing the local model for straying too far from the global model. This is a constraint-based approach.
  • SCAFFOLD: Uses additive correction via control variates to adjust the update direction itself. This is a bias-correction approach.

Empirically, SCAFFOLD often converges faster and to a better final accuracy on highly heterogeneous data, as it actively corrects the update direction rather than merely restraining it.

06

Practical Implementation Considerations

Deploying SCAFFOLD introduces specific system design choices.

  • Stateful Clients: Clients must persistently store their local control variate c_i across rounds. This requires stable client identities and storage, which may not suit highly transient edge device populations.
  • Server Compute: The server must compute and broadcast the global control variate c, adding a small overhead to the aggregation step.
  • Partial Participation: The algorithm can accommodate partial client participation, but the server control variate update must account for which clients were active. The original analysis provides guidance for this setting.
ALGORITHM COMPARISON

SCAFFOLD vs. FedAvg & FedProx

A technical comparison of three core federated optimization algorithms, highlighting how SCAFFOLD's control variates address the client drift problem inherent in non-IID data settings.

Feature / MechanismFedAvgFedProxSCAFFOLD

Primary Objective

Foundational averaging of client updates

Mitigate client drift via a proximal term

Correct client drift using control variates

Key Innovation

Simple weighted averaging

µ-proximal term in local loss

Client & server control variates (c_i, c)

Handles Non-IID Data

Communication Rounds to Convergence (vs. FedAvg)

Baseline (1.0x)

~0.7-0.9x

~0.3-0.6x

Client-Side Computation Overhead

Low

Medium (proximal term calc.)

Medium (control variate update)

Server-Side Computation Overhead

Low (averaging)

Low (averaging)

Medium (control variate aggregation)

Client Memory Overhead

Model parameters only

Model parameters only

Model params + local control variate (c_i)

Theoretical Convergence Guarantee

Under strong convexity & IID

Under heterogeneity (bounded dissimilarity)

Under heterogeneity (strongly convex & non-convex)

Variance Reduction

None

Implicit via update constraint

Explicit via control variates

Personalization Compatibility

Low (requires fine-tuning)

Medium

High (natural bias-variance decomposition)

SCAFFOLD

Frequently Asked Questions

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational algorithm designed to correct for client drift in federated learning, particularly under non-IID data conditions. These questions address its core mechanisms, advantages, and practical implementation.

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm that uses control variates—server and client correction terms—to reduce the variance in client updates, thereby correcting for client drift caused by data heterogeneity. It works by maintaining two sets of variables: the global model parameters and a global control variate on the server, and local model parameters and a local control variate on each client. During each communication round, clients compute their update as a combination of the gradient and the difference between the local and global control variates. This correction steers local updates toward the global objective, leading to faster and more stable convergence compared to standard Federated Averaging (FedAvg) under non-IID data.

Key Steps in a Round:

  1. Server sends the global model and global control variate to selected clients.
  2. Each client performs local training, computing gradients and updating its local control variate.
  3. The client's update to the server includes the model delta and the change in its local control variate.
  4. Server aggregates model updates and control variate updates to form a new global state.
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.