SCAFFOLD is a federated optimization algorithm that introduces control variates—client-specific and server-side correction terms—to reduce the variance between local stochastic gradients and the true global gradient. By maintaining these stateful variables, it directly counteracts client drift, the divergence of local models caused by statistical heterogeneity, leading to more stable and significantly faster convergence than standard Federated Averaging (FedAvg).
Glossary
SCAFFOLD

What is SCAFFOLD?
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational algorithm designed to correct client drift and accelerate convergence in federated learning, particularly under Non-IID data conditions.
The algorithm operates by having each client compute the difference between its local update and a global reference direction, storing this as a local control variate. The server aggregates these differences to update a global control variate, which is then used to correct the next round of client updates. This variance reduction mechanism makes SCAFFOLD robust to high levels of data heterogeneity, as quantified by bounded gradient dissimilarity, and is a key reference in the field of federated optimization techniques.
Core Algorithmic Mechanisms
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is an algorithm that uses control variates to correct for client drift, enabling faster and more stable convergence under Non-IID data conditions.
Core Definition & Purpose
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm designed to correct for client drift—the divergence of local client models from the global objective due to Non-IID data. It introduces control variates (corrective terms) on both the server and clients to reduce the variance between local updates, leading to faster and more stable convergence compared to standard Federated Averaging (FedAvg).
The Control Variate Mechanism
The algorithm's key innovation is the use of two control variates:
- Client control variate (c_i): Tracks the drift of client
i's local updates from the server's direction. - Server control variate (c): Represents the global update direction.
During local training, clients adjust their gradient steps using the difference between their control variate and the server's. This correction reduces the bias introduced by local data skew. After aggregation, both control variates are updated to reflect the new global state, creating a feedback loop that continuously corrects for drift.
Algorithm Steps
A single round of SCAFFOLD involves:
- Server Broadcast: The server sends the global model
xand global control variatecto a subset of clients. - Local Correction & Training: Each client
icomputes local updates using a corrected stochastic gradient:gradient - c_i + c. This aligns the local step with the global direction. - Update Transmission: Clients send back their model update
delta_iand their updated local control variatec_i_new. - Server Aggregation: The server averages the model updates to form a new global model
x. It also updates the global control variatecby averaging the changes in client control variates.
Advantages Over FedAvg
SCAFFOLD provides significant improvements in heterogeneous settings:
- Faster Convergence: Achieves the same accuracy as FedAvg in fewer communication rounds, often by a factor of 3-10x under high heterogeneity.
- Stability: The control variates smooth the optimization path, reducing oscillation and improving final test accuracy.
- Theoretical Guarantees: Provides convergence guarantees under standard assumptions (bounded gradient dissimilarity) without requiring data to be IID.
- Robustness: Less sensitive to hyperparameter choices like client learning rate and number of local epochs compared to FedAvg.
Limitations & Practical Considerations
While powerful, SCAFFOLD introduces trade-offs:
- Communication Overhead: Clients must transmit both model updates and control variates, doubling the per-client communication cost compared to FedAvg (though still fewer rounds are needed).
- Client State: Requires clients to maintain persistent local control variates
c_iacross rounds, adding memory overhead and complexity for dropping/rejoining clients. - Computation: The local correction step adds minimal but non-zero computational overhead.
- Initialization Sensitivity: Performance can depend on the initial values of the control variates, though they are typically initialized to zero.
Related & Contrasting Algorithms
SCAFFOLD exists within a spectrum of algorithms tackling Non-IID data:
- FedAvg: The baseline; suffers from client drift without correction mechanisms.
- FedProx: Adds a proximal term to the local loss to penalize deviation from the global model; simpler but less adaptive than SCAFFOLD's control variates.
- FedOpt: Applies adaptive server optimizers (e.g., Adam) to aggregated updates; can be combined with SCAFFOLD's client-side correction.
- Personalized FL (e.g., Ditto): Aims for distinct local models, whereas SCAFFOLD seeks a single, improved global model. SCAFFOLD is particularly effective when the primary goal is a high-performance global model in a statistically heterogeneous environment.
How SCAFFOLD Works: Step-by-Step
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is an advanced federated optimization algorithm that uses control variates to correct for client drift, enabling faster and more stable convergence on Non-IID data.
The algorithm introduces two key control variates: a server control variate c and local client variates c_i. At each round, selected clients receive the global model and c. They perform local Stochastic Gradient Descent (SGD), but their update is corrected by the difference between their local variate c_i and the global c. This correction directly counteracts the bias introduced by local data heterogeneity, reducing the variance between client updates.
After local training, clients send their model delta and an updated local control variate to the server. The server aggregates the model updates via federated averaging and similarly updates the global control variate c by averaging the client variate changes. This iterative refinement of control variates progressively aligns client optimization directions, mitigating client drift and accelerating convergence to a superior global optimum under statistical heterogeneity.
SCAFFOLD vs. FedAvg: Key Differences
This table contrasts the core mechanisms, convergence properties, and practical implications of the SCAFFOLD and FedAvg algorithms for federated learning under Non-IID data conditions.
| Feature / Metric | SCAFFOLD (Stochastic Controlled Averaging) | FedAvg (Federated Averaging) |
|---|---|---|
Core Mechanism | Uses control variates (c_i, c) to correct for client drift | Averages local model parameters (weights) directly |
Primary Objective | Reduce variance between local and global update directions | Minimize aggregate loss via simple parameter averaging |
Convergence Speed (Non-IID) | Faster, more stable; provably linear convergence | Slower, unstable; can diverge or oscillate |
Communication Rounds to Target Accuracy | 30-50% fewer rounds | Baseline (100%) |
Local Computation per Client | Slightly higher (maintains & updates control variate) | Standard (local SGD steps only) |
Client Memory Overhead | Higher (stores local control variate c_i) | Lower (stores only model parameters) |
Robustness to High Data Heterogeneity | High (explicitly corrects for drift) | Low (suffers from client drift) |
Theoretical Guarantee for Non-IID Data | Yes (under bounded dissimilarity) | No (requires IID or very low heterogeneity) |
Server-Side Computation | Higher (maintains & broadcasts global control variate c) | Lower (simple weighted average) |
Typical Use Case | Mission-critical applications with severe statistical heterogeneity | Homogeneous data or applications tolerant of slower convergence |
Implementation and Practical Considerations
SCAFFOLD's practical implementation involves managing additional state variables, tuning hyperparameters, and ensuring compatibility with system heterogeneity. These cards detail the key engineering decisions required to deploy it effectively.
Control Variate Mechanics
The core of SCAFFOLD is the maintenance of two sets of control variates: client-specific (c_i) and server (c). These are stateful variables updated each round.
- Client Update:
c_i = c_i - c + (x - y_i) / (η_l K), wherexis the global model,y_iis the local model after training,η_lis the client learning rate, andKis the number of local steps. - Server Update:
c = c + (1/N) * Σ (c_i^{new} - c_i^{old}). These variates correct the local update direction, reducing the variance introduced by Non-IID data.
Hyperparameter Sensitivity
SCAFFOLD introduces critical hyperparameters beyond the standard learning rate.
- Client Learning Rate (
η_l): Controls the aggressiveness of local updates. Must be balanced to allow correction by the control variate. - Server Learning Rate (
η_g): Applied to the aggregated model update. Often set to 1.0 for FedAvg-style aggregation. - Local Epochs/Steps (
K): A higherKincreases client drift; SCAFFOLD's correction is most beneficial here. Tuning is essential for stability.
Communication Overhead
SCAFFOLD doubles the per-client communication cost compared to Federated Averaging (FedAvg).
- What's Transmitted: Each client sends both its updated model parameters and its updated client control variate
c_ito the server. - Bandwidth Impact: For a model with
Mparameters, communication per client is2Mfloats per round. This is a key trade-off for improved convergence under heterogeneity. - Mitigation: Can be combined with compression techniques (e.g., sparse updates, quantization) applied separately to the model and control variate tensors.
Partial Client Participation
SCAFFOLD remains effective when only a subset of clients participates each round, a practical necessity.
- Server Control Variate (
c): Acts as a stable, global anchor. Participating clients usecto correct their updates. - Non-Participating Clients: Their client control variates
c_iremain unchanged until their next participation. The algorithm does not require synchronous updates from all clients. - Bias Correction: The server update for
cuses only the changes from participating clients, but this is unbiased in expectation, preserving convergence guarantees.
Integration with Secure Aggregation
SCAFFOLD is compatible with cryptographic Secure Aggregation (SecAgg) protocols to protect individual client updates.
- Challenge: SecAgg typically sums model updates. SCAFFOLD requires the server to also compute the sum of changes to
c_i. - Solution: Both the model delta
(y_i - x)and the control variate delta(c_i^{new} - c_i^{old})can be masked and aggregated securely within the same protocol. The server learns only the aggregated sums, not individual values. - Privacy: This maintains client privacy while enabling the variance reduction benefits of SCAFFOLD.
Comparison to FedProx
FedProx and SCAFFOLD are both solutions for Non-IID data, but with different mechanisms.
- FedProx: Adds a proximal term (
μ/2 * ||w - w^t||^2) to the local loss, penalizing deviation from the global modelw^t. It's a regularization-based approach. - SCAFFOLD: Uses control variates to correct the update direction itself. It's a variance reduction technique.
- Practical Choice: FedProx is simpler to implement (one extra hyperparameter
μ). SCAFFOLD often achieves faster convergence but with higher communication and memory (state) costs. The choice depends on system constraints.
Frequently Asked Questions
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a foundational algorithm for tackling Non-IID data in decentralized training. These questions address its core mechanics, advantages, and practical implementation.
SCAFFOLD (Stochastic Controlled Averaging for Federated Learning) is a federated optimization algorithm that introduces control variates—client-specific and server-side correction terms—to explicitly counteract client drift caused by statistical heterogeneity (Non-IID data). It modifies the local stochastic gradient descent (SGD) update on each client to reduce the variance between local updates and the global objective, enabling faster and more stable convergence than standard Federated Averaging (FedAvg). The algorithm's core innovation is maintaining two states: the global model parameters and a set of control variables that track and correct for the bias in client updates.
Key Components:
- Client Control Variate (c_i): A vector stored locally by each client
ithat estimates the bias between its local updates and the global direction. - Server Control Variate (c): A global average of the client control variates, representing the aggregate correction.
- Corrected Local Update: Clients compute gradients and adjust them using the difference between their local
c_iand the globalc, effectively 'de-biasing' their step.
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 operates within a complex ecosystem of algorithms and concepts designed to address the core challenge of statistical heterogeneity in federated learning. These related terms define the landscape of Non-IID data solutions.
Client Drift
Client drift is the phenomenon where local models, trained on their unique Non-IID data, diverge from the global objective. This divergence is the primary problem SCAFFOLD aims to correct.
- Mechanism: Each client's gradient update points in a direction optimal for its local data distribution, not the global distribution.
- Consequence: Aggregating these drifted updates leads to unstable, oscillating convergence and a degraded final global model.
- SCAFFOLD's Role: It introduces control variates (corrective terms) to estimate and subtract this client-specific drift from each update before aggregation.
FedProx
FedProx is a federated optimization algorithm that mitigates client drift by adding a proximal term to the local objective function.
- Core Idea: Clients solve a modified optimization problem that penalizes updates that stray too far from the current global model.
- Mathematical Form: Local loss + (μ/2) * ||local_params - global_params||².
- Comparison to SCAFFOLD: While FedProx constrains the parameter space, SCAFFOLD corrects the update direction in gradient space. FedProx is a form of implicit control, while SCAFFOLD uses explicit control variates.
FedOpt
FedOpt (Adaptive Federated Optimization) is a framework that applies adaptive server-side optimizers (e.g., Adam, Yogi) to aggregated client updates.
- Mechanism: Instead of simple averaging (FedAvg), the server treats the average client update as a pseudo-gradient and applies an adaptive optimizer to update the global model.
- Addressing Heterogeneity: Adaptive methods can help compensate for the varying scale and direction of client updates caused by Non-IID data.
- Synergy with SCAFFOLD: SCAFFOLD and FedOpt are orthogonal; SCAFFOLD can be combined with a FedOpt-style server optimizer (e.g., SCAFFOLD with Server Adam) for further convergence improvements.
Control Variates
Control variates are a statistical technique for variance reduction, which SCAFFOLD adapts for federated learning.
- General Principle: A control variate is a known, correlated random variable whose expected value is known. Subtracting it from an estimator reduces variance.
- In SCAFFOLD: Each client maintains a control variate (
c_i) that estimates the bias in its local gradient due to data skew. The server maintains a global control variate (c). The update rule becomes:update = local_gradient - c_i + c. - Effect: This corrects the local update direction, aligning it closer to the true global gradient, thereby reducing variance and accelerating convergence.
Personalized Federated Learning (PFL)
Personalized Federated Learning is an alternative paradigm to global model training, where the goal is to learn a distinct model for each client.
- Philosophical Difference: PFL accepts that a single global model may be suboptimal for all clients under severe heterogeneity. SCAFFOLD aims to find a better single global model.
- Methods: Include fine-tuning the global model locally (Personalized FedAvg), learning client-specific parameters (Ditto), or meta-learning approaches.
- Relationship: SCAFFOLD's reduction of client drift can also serve as a stronger foundation for subsequent personalization steps, as the global model is a better starting point.
Bounded Gradient Dissimilarity
Bounded Gradient Dissimilarity is a key theoretical assumption used to prove convergence guarantees for federated learning algorithms under Non-IID data.
- Definition: It assumes the variance between local client gradients and the global gradient is bounded by a constant (G or σ). Formally, 𝔼||∇F_i(w) - ∇F(w)||² ≤ G².
- Significance: This quantifies the level of data heterogeneity. A larger G indicates more severe Non-IID conditions.
- SCAFFOLD's Impact: SCAFFOLD's convergence analysis shows it can achieve better rates (e.g., linear speedup with number of clients) under such assumptions compared to FedAvg, because its control variates effectively reduce the effective gradient dissimilarity.

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