Inferensys

Glossary

SCAFFOLD

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is an algorithm that uses control variates to reduce variance in client updates caused by data heterogeneity, enabling faster convergence with fewer communication rounds.
Developer working on RAG retrieval system, document chunks visible on screen, technical workspace with code editor.
COMMUNICATION-EFFICIENT FEDERATED LEARNING

What is SCAFFOLD?

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational algorithm designed to correct for client drift, a major convergence challenge caused by data heterogeneity across devices.

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm that uses control variates—correction terms stored on both the server and each client—to reduce the variance in client updates. This correction directly counteracts client drift, the phenomenon where local models diverge due to training on statistically heterogeneous (non-IID) data. By stabilizing the update direction, SCAFFOLD achieves faster convergence, requiring significantly fewer communication rounds to reach a target accuracy compared to standard methods like Federated Averaging (FedAvg).

The algorithm maintains two key states: a global control variate on the server and a local control variate on each client. These variates estimate the difference between the client's local gradient and the true global gradient. During aggregation, the server uses these terms to correct the averaged update, ensuring it points toward the global objective. This makes SCAFFOLD particularly effective in cross-device settings with high data skew, and it forms the theoretical basis for many subsequent variance-reduction techniques in federated learning.

COMMUNICATION-EFFICIENT FEDERATED LEARNING

Key Features of SCAFFOLD

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational algorithm designed to correct for client drift caused by data heterogeneity. It achieves faster convergence with fewer communication rounds by maintaining and exchanging control variates.

01

Control Variates for Variance Reduction

SCAFFOLD's core innovation is the use of control variates—correction terms stored on both the server and each client. These terms estimate the discrepancy between the local client's stochastic gradient and the true global gradient direction.

  • Server Control Variate (c): Represents the average gradient direction across all clients.
  • Client Control Variate (c_i): Captures the bias of client i's local data distribution. During local training, the client's gradient is adjusted using these variates, reducing the variance in updates sent to the server and directly combating client drift.
02

Mitigation of Data Heterogeneity (Non-IID)

SCAFFOLD is explicitly designed for the Non-IID data setting, where data distributions vary significantly across clients. This heterogeneity causes local models to diverge, or drift, from the global objective.

The algorithm's control variates act as anchors:

  • They correct local updates toward the global consensus.
  • This allows clients to take more local Stochastic Gradient Descent (SGD) steps per communication round without diverging.
  • The result is stable convergence on highly heterogeneous data where standard Federated Averaging (FedAvg) fails or becomes inefficient.
03

Reduced Communication Rounds

By effectively correcting for local bias, SCAFFOLD enables clients to perform more productive local computation between synchronizations. This directly translates to communication efficiency.

  • Fewer aggregation rounds are required to reach a target model accuracy.
  • Each communicated update is of higher quality and better aligned with the global objective.
  • This reduces total uplink communication volume and training latency, a critical metric for communication complexity.
04

Server and Client State Mechanism

SCAFFOLD introduces persistent state on both sides of the federation, which is updated each round.

Server State:

  • Maintains the global model parameters w.
  • Maintains the global control variate c, updated as a running average of client corrections.

Client State (for participant i):

  • Maintains a local model copy w_i.
  • Maintains a personal control variate c_i, which tracks its local data bias.
  • This stateful design is more complex than FedAvg but is essential for its convergence guarantees under heterogeneity.
05

Theoretical Convergence Guarantees

SCAFFOLD provides strong theoretical convergence guarantees for both convex and non-convex problems in the heterogeneous data setting.

  • It converges at a rate of O(1/T) for strongly convex functions and O(1/√T) for non-convex functions, where T is the number of communication rounds.
  • Critically, its convergence rate is independent of data heterogeneity, unlike FedAvg whose performance degrades with higher client drift.
  • These guarantees make it a principled choice for system architects requiring predictable performance.
06

Relation to Other Optimization Methods

SCAFFOLD can be understood in the context of broader optimization techniques.

  • It is analogous to using variance reduction methods like SVRG (Stochastic Variance Reduced Gradient) in the federated setting.
  • The control variate mechanism is similar in spirit to the proximal term in FedProx, but SCAFFOLD uses an additive correction rather than a multiplicative penalty.
  • It is a foundational algorithm upon which later communication-efficient techniques (like compression with error feedback) can be integrated, provided the control variates are also compressed and synchronized.
ALGORITHM COMPARISON

SCAFFOLD vs. FedAvg and FedProx

A technical comparison of core federated learning algorithms, highlighting how SCAFFOLD's control variate mechanism addresses the client drift inherent in FedAvg and the partial stabilization offered by FedProx.

Core Mechanism / MetricFedAvgFedProxSCAFFOLD

Primary Objective

Basic parameter averaging

Stabilize heterogeneous training

Correct for client drift via variance reduction

Key Innovation

Iterative local SGD + averaging

Proximal term in local loss

Server & client control variates (c_i, c)

Handles Data Heterogeneity (Non-IID)

Partially (via regularization)

Theoretical Convergence Rate (Strongly Convex)

O(1 / T)

O(1 / T)

O(exp(-T))

Communication Rounds to Target Accuracy

High

Moderate reduction

Substantial reduction (2-5x vs. FedAvg)

Per-Round Client Compute

E epochs of local SGD

E epochs of proximal SGD

E epochs of variance-reduced SGD

Client Memory Overhead

Model parameters only

Model parameters only

Model params + control variate c_i

Server Memory Overhead

Global model only

Global model only

Global model + control variates {c_i}

Mitigates Client Drift

Yes, via constraint

Yes, via explicit correction

SCAFFOLD

Frequently Asked Questions

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational algorithm designed to combat the performance degradation caused by data heterogeneity across clients. These questions address its core mechanics, advantages, and practical implementation.

SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm that uses control variates—correction terms stored on both the server and each client—to reduce the variance in client updates caused by data heterogeneity. It works by having each client compute the difference between its local gradient and a global gradient estimate, then uses this difference to correct its update direction, effectively steering local training towards the global objective and enabling faster convergence with fewer communication rounds.

Mechanism:

  1. The server maintains a global control variate c.
  2. Each client i maintains a local control variate c_i.
  3. During local training, the client computes gradients and corrects them using the difference (c - c_i).
  4. The client sends both its model update and an update for its local control variate back to the server.
  5. The server aggregates the model updates and the control variate updates to produce a new global model and global control variate.
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.