SCAFFOLD is a federated optimization algorithm that introduces control variates—client-specific and server-side correction terms—to reduce the variance between local client updates. This directly addresses the client drift problem, where models trained on statistically heterogeneous (non-IID) client data diverge from the global objective, impairing convergence and final accuracy. The algorithm modifies the local stochastic gradient descent (SGD) step on each client by incorporating these control variates, which estimate and correct for the update bias introduced by local data distributions.
Glossary
SCAFFOLD

What is SCAFFOLD?
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational optimization algorithm designed to correct for client drift in heterogeneous federated learning environments.
The mechanism involves maintaining two sets of control states: a server control variate representing the global update direction and local control variates tracking each client's update history. During each training round, clients use the difference between these states to adjust their gradients, effectively de-biasing their local optimization. This correction ensures updates are more consistent with the global objective, leading to significantly faster convergence and higher accuracy in cross-silo and cross-device settings compared to standard Federated Averaging (FedAvg). SCAFFOLD is a cornerstone technique within Federated Continual Learning (FCL) systems, enabling stable, collaborative learning across decentralized, evolving data streams.
Key Features of SCAFFOLD
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is an advanced optimization algorithm designed to correct for client drift in heterogeneous federated networks. It introduces control variates—server and client correction terms—to reduce the variance between local updates, leading to faster and more stable convergence compared to standard Federated Averaging (FedAvg).
Control Variates for Variance Reduction
The core innovation of SCAFFOLD is the use of control variates, which are correction terms stored on both the server and each client. These terms estimate the direction of the global objective, allowing clients to adjust their local updates to correct for the bias introduced by their non-IID data.
- Server Control Variate (c): Represents the average gradient direction across all clients.
- Client Control Variate (c_i): Tracks the update direction specific to client i's local data distribution. During local training, a client computes its update relative to the difference between its local control variate and the server's, effectively reducing the variance of the aggregated update.
Mitigating Client Drift
Client drift is the primary problem SCAFFOLD solves. In heterogeneous (non-IID) settings, local client models diverge from the global optimum as they overfit to their unique data. SCAFFOLD's control variates act as a corrective force, pulling local updates back toward the consensus direction.
This mechanism ensures that even with highly skewed local data distributions, the aggregated model update consistently progresses toward minimizing the global loss function, leading to significantly improved convergence rates and final accuracy.
Algorithmic Steps & Update Rule
SCAFFOLD modifies the standard federated learning loop with specific update rules for models and control variates.
Key Steps per Communication Round:
- Server Broadcast: Sends global model
wand server control variatecto a client subset. - Local Training: Client i performs SGD, but the update direction is corrected:
Δw_i ≈ -η (∇L_i(w) - c_i + c). - Local Update: Client updates its model
w_iand its local control variatec_i. - Secure Aggregation: Server receives
Δw_iandΔc_iupdates. - Server Aggregation: Updates global model:
w = w + avg(Δw_i). Updates server control variate:c = c + avg(Δc_i).
Advantages Over FedAvg
SCAFFOLD provides concrete improvements over the foundational Federated Averaging (FedAvg) algorithm, especially under statistical heterogeneity.
- Faster Convergence: Requires significantly fewer communication rounds to reach target accuracy.
- Stability: Less sensitive to hyperparameter choices like client learning rate and local epochs.
- Theoretical Guarantees: Provides convergence guarantees for both convex and non-convex problems under non-IID data, which FedAvg lacks.
- Handles Partial Participation: Robust to scenarios where only a random subset of clients is available each round.
Communication & Computation Overhead
The primary trade-off for SCAFFOLD's performance is a modest increase in communication and client-side computation.
- Communication Cost: Clients must transmit both model updates (
Δw_i) and control variate updates (Δc_i). The control variate is the same size as the model gradient, effectively doubling the per-round communication payload compared to FedAvg. - Client Memory: Each client must persistently store its local control variate
c_i. - Client Compute: The local update calculation is slightly more complex, involving vector additions/subtractions. This overhead is often justified by the drastic reduction in total communication rounds required for convergence.
Use Cases & Practical Considerations
SCAFFOLD is particularly effective in specific federated learning scenarios:
- Highly Heterogeneous Data: Essential for applications like next-word prediction on mobile keyboards, where user data is inherently non-IID.
- Cross-Silo FL: Ideal for collaborations between a few organizations (e.g., hospitals) with large, diverse datasets.
- When FedAvg Plateaus: A direct upgrade when standard FedAvg fails to converge satisfactorily.
Implementation Note: SCAFFOLD is supported in major federated learning frameworks like Flower and TensorFlow Federated (TFF), though it requires more careful state management than FedAvg.
SCAFFOLD vs. FedAvg vs. FedProx: Algorithm Comparison
A technical comparison of core federated optimization algorithms, highlighting their mechanisms for handling statistical heterogeneity (non-IID data) and client drift.
| Feature / Mechanism | SCAFFOLD | FedAvg | FedProx |
|---|---|---|---|
Primary Innovation | Uses control variates (client & server correction terms) to reduce update variance | Simple averaging of client model weights after local SGD steps | Adds a proximal term to local loss to constrain client updates |
Core Objective | Correct for client drift by estimating update bias | Minimize communication rounds via local computation | Improve stability under system & data heterogeneity |
Handles Non-IID Data | |||
Mitigates Client Drift | |||
Communication Cost per Round | 2x model size (weights + control variate) | 1x model size (weights only) | 1x model size (weights only) |
Client-Side Computation | Moderate (maintains local control variate) | Low (standard local SGD) | Moderate (solves proximal-regularized objective) |
Theoretical Convergence Guarantee | Strong convergence under heterogeneity, faster than FedAvg | Convergence requires IID or bounded dissimilarity assumptions | Convergence under system heterogeneity & partial participation |
Typical Use Case | Cross-silo with high statistical heterogeneity | Cross-device with relatively homogeneous data | Cross-device with system heterogeneity (stragglers) |
Practical Use Cases for SCAFFOLD
SCAFFOLD's primary value lies in stabilizing federated training on statistically heterogeneous data. These cards detail its specific applications where reducing client drift is critical.
Healthcare Diagnostics on Decentralized Patient Data
Hospitals and clinics can collaboratively train a diagnostic model (e.g., for medical imaging) without sharing sensitive patient records. SCAFFOLD is essential here because medical data is highly non-IID—patient demographics, disease prevalence, and imaging equipment vary per institution. Its control variates correct for local data bias, ensuring the global model converges to a robust, generalizable diagnostic tool faster than standard Federated Averaging (FedAvg), without any single hospital's data skewing the results.
Next-Word Prediction on Mobile Keyboards
Deploying personalized language models on smartphones without uploading typed text to the cloud. Each user's language patterns (slang, contacts, topics) create a unique local data distribution. SCAFFOLD mitigates client drift caused by this heterogeneity. Its server and client control states act as anchors, guiding local updates toward a consensus global model that improves universally while respecting privacy. This leads to faster convergence and a better base model for all users compared to FedAvg.
Fraud Detection Across Financial Institutions
Banks can build a more powerful fraud detection model by learning from transaction patterns across multiple institutions, while keeping all customer data on-premise. Fraud patterns are inherently non-IID—they differ by region, customer base, and product. SCAFFOLD's variance reduction is critical to prevent any single bank's unique fraud cases from causing the global model to diverge or forget general fraud signatures. This results in a more accurate and globally aware model that benefits all participating entities.
IoT Predictive Maintenance in Manufacturing
Training a model to predict machine failure using sensor data from identical machines across multiple factories. While the machines are the same, their operating conditions, maintenance schedules, and local environments create data heterogeneity. SCAFFOLD ensures the federated model effectively captures the shared physical failure modes without being biased by the local conditions of any one factory. This enables accurate, generalized predictions that improve overall equipment effectiveness across the entire manufacturing network.
Personalized Retail Recommendations
A retail chain training a recommendation model using on-device purchase history and browsing behavior from user apps. User preferences are the definition of non-IID data. SCAFFOLD enables efficient learning of a high-quality global preference model that serves as a strong starting point for on-device personalization. By correcting for the drift caused by individual user tastes, it ensures the global model doesn't collapse to the preferences of the most active user segment, maintaining relevance for the entire customer base.
Frequently Asked Questions
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational algorithm for federated optimization, specifically engineered to combat client drift in heterogeneous data environments. 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—client-specific and server-side correction terms—to reduce the variance in client updates and correct for client drift caused by data heterogeneity (non-IID data).
Its mechanism operates in two key phases:
- Local Client Update: Each client
icomputes its stochastic gradient and adjusts it using its local control variatec_i. This corrected gradient update is then used to compute a new local model. The client also updates its control variate to track the difference between its local update direction and the global direction. - Server Aggregation: The server receives the model deltas (differences) and the updated control variates from participating clients. It aggregates the model updates using Federated Averaging (FedAvg) and updates the global control variate
cas a weighted average of the client control variates.
By maintaining and applying these control variates, SCAFFOLD effectively estimates and subtracts the 'bias' in each client's update, ensuring local training steps are consistently aligned with the global objective, leading to significantly improved convergence stability.
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.
Related Terms
SCAFFOLD is a core algorithm within the broader ecosystem of federated and continual learning. These related concepts define the technical landscape it operates within.
Federated Averaging (FedAvg)
The foundational algorithm for Federated Learning where a central server periodically aggregates model updates (weights or gradients) from participating clients to form a new global model. It is the baseline that SCAFFOLD improves upon by adding control variates to correct for client drift caused by data heterogeneity.
- Core Mechanism: Local training on client devices followed by weighted averaging of updates on a central server.
- Limitation: Assumes homogeneous data distribution; performance degrades under significant non-IID data.
Client Drift
A phenomenon in federated learning where local client models, trained on statistically heterogeneous (non-IID) data, diverge from the global objective. This impairs convergence and final model accuracy. SCAFFOLD's primary innovation is the introduction of control variates (server and client correction terms) to explicitly counteract this drift by reducing the variance between client updates.
- Cause: Data distribution differences across clients lead local SGD steps to point in different directions.
- Impact: Slower convergence, reduced global model accuracy, instability.
Federated Optimization
The suite of algorithms and techniques designed to train models efficiently in the federated setting. It addresses core challenges: communication efficiency, statistical heterogeneity, and system constraints. SCAFFOLD is a premier algorithm in this category. Other key methods include:
- FedProx: Adds a proximal term to the local loss to constrain updates.
- Adaptive Federated Optimization: Applies optimizers like FedAdam or FedYogi at the server.
- Gradient Compression: Uses sparsification/quantization to reduce communication overhead.
Control Variate
A statistical technique used to reduce the variance of an estimator. In SCAFFOLD, control variates are correction terms stored on both the server and each client. The client control variate estimates the drift between its local updates and the global direction. The server control variate represents the average update direction. By applying these corrections, SCAFFOLD achieves significantly lower variance in the aggregated update compared to FedAvg, leading to faster and more stable convergence under heterogeneity.
- Client-side: Corrects local SGD bias.
- Server-side: Tracks the global update trajectory.
Non-IID Data
Non-Independent and Identically Distributed data is the statistical norm, not the exception, in federated learning. It means the data distribution across clients is not uniform. For example, smartphones in different geographic regions or hospitals with different patient demographics will have locally unique data. This heterogeneity is the root cause of client drift and is the primary challenge SCAFFOLD is designed to solve.
- Manifests as: Label distribution skew, feature distribution skew, or quantity skew.
- Consequence: Makes simple averaging (FedAvg) inefficient and unstable.
Federated Continual Learning (FCL)
The intersection of federated learning and continual learning. In FCL, decentralized clients must sequentially learn from new tasks or data streams over time while collaboratively avoiding catastrophic forgetting across the entire federation. SCAFFOLD provides a robust optimization foundation for FCL by ensuring stable global updates despite heterogeneous and evolving local data distributions. This is critical for applications like personalized assistants on edge devices that learn continuously from user interaction.
- Dual Challenge: Manage data heterogeneity across clients and task drift over time for each client.
- SCAFFOLD's Role: Provides a stable, drift-corrected aggregation mechanism for the continual learning process.

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