SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm that corrects for client drift—the divergence of local models from the global optimum during heterogeneous local training—by introducing control variates (variance reduction terms) for both the server and each client. Unlike Federated Averaging (FedAvg), which suffers from slow convergence when clinical data distributions are non-IID, SCAFFOLD maintains a persistent estimate of the global update direction to steer local training back toward the true global objective.
Glossary
SCAFFOLD

What is SCAFFOLD?
A federated learning algorithm that uses control variates to correct for client drift, significantly reducing communication rounds.
The algorithm operates by transmitting both model updates and control variate corrections between the server and clients during each communication round. The server maintains a global control variate c, while each client i maintains a local control variate c_i that tracks its individual gradient direction. The local update step is modified to g_i = ∇F_i(w) - c_i + c, effectively canceling the systematic bias introduced by heterogeneous local data. This correction enables SCAFFOLD to achieve faster convergence and tolerate higher data heterogeneity without increasing communication overhead, making it particularly suitable for cross-silo healthcare deployments where patient cohort distributions vary significantly across institutions.
Key Features of SCAFFOLD
SCAFFOLD (Stochastic Controlled Averaging) introduces control variates to correct for client drift, the primary source of convergence instability in heterogeneous federated learning. By tracking local and global update directions, it dramatically reduces communication rounds.
Control Variate Correction
The core innovation of SCAFFOLD is the maintenance of control variates (c_i for each client, c for the server). These variates estimate the update direction of the global model versus the local model. During local training, the gradient is corrected by (c - c_i), effectively pulling the local update back toward the global optimum. This prevents the local model from drifting too far toward its local minimum, which is the fundamental flaw of standard FedAvg on non-IID data.
Client Drift Elimination
Client drift occurs when local models diverge from the global optimum after multiple local SGD steps on heterogeneous data distributions. SCAFFOLD eliminates this drift by incorporating the gradient correction term directly into the local loss function. The result is that even with many local epochs, the local updates remain aligned with the global objective. This is particularly critical in healthcare settings where clinical data distributions vary wildly across institutions due to different patient demographics, equipment, and diagnostic protocols.
Communication Round Reduction
By correcting for drift, SCAFFOLD allows clients to perform many more local steps without diverging. Empirical results show SCAFFOLD can reduce the required communication rounds by 2x to 5x compared to FedAvg on non-IID data partitions. This is achieved without increasing per-round communication cost significantly—the control variate is the same size as the model itself, transmitted once per round alongside the model update. For bandwidth-constrained hospital networks, this efficiency is transformative.
Variance Reduction Mechanism
SCAFFOLD functions as a variance-reduced stochastic gradient method in the federated setting. The control variates serve as a bias correction that reduces the variance of local stochastic gradients. This connects SCAFFOLD theoretically to SVRG and SAGA in classical optimization. The reduced variance means local updates are more consistently pointed toward the true global minimum, enabling the use of higher learning rates and faster convergence without the instability that plagues FedAvg in heterogeneous environments.
Server and Client State Management
SCAFFOLD requires both the server and each client to maintain persistent state across rounds:
- Server state (c): The running average of all client control variates, updated each round as
c ← c + (1/N) * Σ Δc_i - Client state (c_i): A local control variate updated after each round of local training, representing the local gradient direction This dual-state architecture adds a minor storage overhead (one model-sized vector per client) but enables the algorithm's superior convergence properties. The state is not privacy-sensitive as it captures gradient directions, not raw data.
Heterogeneous Data Robustness
SCAFFOLD is explicitly designed for statistically heterogeneous (non-IID) data partitions, which are the norm in healthcare federated learning. Unlike FedAvg, which can diverge or stall when client data distributions differ significantly, SCAFFOLD provably converges at a rate independent of data heterogeneity. This makes it the preferred choice for cross-silo medical applications where each hospital's patient cohort represents a distinct distribution of diseases, demographics, and imaging protocols.
SCAFFOLD vs. FedAvg vs. FedProx
A technical comparison of three core federated aggregation algorithms for handling client drift and heterogeneous data distributions.
| Feature | SCAFFOLD | FedAvg | FedProx |
|---|---|---|---|
Drift Correction Mechanism | Control variates (c, c_i) | None | Proximal term (μ/2)||w - w^t||² |
Convergence Rate on Non-IID Data | Faster (variance-reduced) | Slower (drift degrades convergence) | Moderate (stabilized but not variance-reduced) |
Communication Overhead per Round | 2x model size (control variates transmitted) | 1x model size | 1x model size |
Client-Side Computation Overhead | Higher (maintains local control variate) | Lowest | Low (proximal term evaluation) |
Handles System Heterogeneity | |||
Requires Client Statefulness | |||
Theoretical Guarantee Under Partial Participation | Converges to stationary point | Converges to neighborhood of optimum | Converges to inexact stationary point |
Hyperparameter Sensitivity | Low (learning rate only) | Moderate (local epochs, batch size) | Higher (μ tuning critical) |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, technical answers to the most common questions about the Stochastic Controlled Averaging algorithm and its role in correcting client drift in federated learning.
SCAFFOLD (Stochastic Controlled Averaging) is a federated learning optimization algorithm that corrects for client drift—the divergence of local models from the global optimum caused by heterogeneous data distributions—by introducing control variates (correction terms) into each client's local training objective. Unlike Federated Averaging (FedAvg), which suffers from gradient dissimilarity when local data is non-IID, SCAFFOLD maintains a server control variate c and individual client control variates c_i that estimate the update direction of the global model. During local training, the client's optimizer is steered by the difference c - c_i, effectively aligning local updates with the global gradient direction. This correction dramatically reduces the number of communication rounds required for convergence, often by an order of magnitude compared to FedAvg on heterogeneous clinical datasets.
Related Terms
Explore the mathematical strategies for securely combining local model updates into a global model, including variance reduction and Byzantine fault tolerance.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us