Federated Learning with Imbalanced Data addresses the compounded challenge where individual clients' local datasets have skewed class distributions, a prevalent form of Non-IID data. This local imbalance, combined with variability in imbalance patterns across the client population, severely degrades model performance, causing poor generalization for minority classes and biased global model convergence. It is a critical issue in real-world deployments like healthcare, where disease prevalence varies geographically.
Glossary
Federated Learning with Imbalanced Data

What is Federated Learning with Imbalanced Data?
Federated Learning with Imbalanced Data is a specific sub-challenge within federated learning where the local dataset on each participating client exhibits significant class imbalance, a common and impactful form of statistical heterogeneity.
Solutions involve specialized algorithms that operate at the client, server, or personalization level. Techniques include re-sampling or re-weighting local losses, employing focal loss to focus on hard examples, using clustered federated learning to group similar clients, or applying personalized federated learning methods like Ditto to tailor models per client. Effective handling requires careful federated evaluation to measure per-class performance disparities.
Key Challenges of Imbalanced Data in Federated Learning
Imbalanced data in federated learning creates a compounded Non-IID challenge where class distribution skew exists both within individual client datasets and across the entire federated network, severely impacting model convergence and fairness.
Local Model Bias Amplification
When a client's local dataset has a severe class imbalance (e.g., 95% Class A, 5% Class B), its locally trained model will become extremely biased towards the majority class. This local bias is then transmitted to the server via model updates. During aggregation, if multiple clients share similar imbalance patterns, the global model's bias is systematically reinforced, leading to catastrophic failure on minority classes. This is distinct from simple Non-IID label distribution skew, as the imbalance is internal to each client's data manifold.
Aggregated Global Class Collapse
Even if minority class samples exist somewhere in the federated network, the standard Federated Averaging (FedAvg) algorithm can cause global class collapse. The averaging of biased local gradients can drown out the signal from clients holding minority class examples. The result is a global model that achieves high average accuracy by simply ignoring rare classes, rendering it useless for critical applications like fraud detection or medical diagnosis of rare conditions. This collapse is more severe than in centralized learning due to the decentralized and partitioned nature of the data.
Convergence Instability and Oscillation
Imbalance introduces severe convergence instability. Clients with different majority classes will produce updates that pull the global model in opposing directions. For example, a client with mostly 'cats' and a client with mostly 'dogs' will send conflicting gradients for a shared feature extractor. This leads to:
- High-variance updates causing the global loss to oscillate.
- Slower convergence, requiring significantly more communication rounds.
- Potential convergence to poor, biased saddle points rather than a robust global optimum. This oscillation is a direct symptom of the conflicting objectives created by local imbalances.
Exacerbated Performance Disparity
Imbalance dramatically widens the performance disparity between clients. A client with a balanced local dataset will achieve good performance with the global model, while a client with a highly imbalanced dataset will see very poor performance on its local minority class. This violates fairness principles and makes the system unusable for clients with 'atypical' data distributions. Measuring only global accuracy hides this critical failure mode, necessitating client-specific evaluation metrics to uncover the true extent of the disparity.
Communication Inefficiency for Rare Classes
Learning rare class representations becomes communication-inefficient. The information needed to correctly model a minority class is sparsely distributed across the network. Standard FedAvg requires many rounds for this sparse signal to propagate and stabilize in the global model. This inefficiency defeats a primary goal of federated learning—reducing communication overhead. Techniques like client selection can inadvertently worsen this by frequently selecting clients with common, majority-class data, further starving the global model of minority class information.
Difficulty in Applying Centralized Solutions
Standard centralized solutions for class imbalance are difficult or impossible to apply in the federated setting:
- Resampling (oversampling/undersampling): Requires knowledge of the global class distribution, which is private.
- Cost-sensitive learning: Assigning different misclassification costs per class requires global coordination and consensus on cost values.
- Data augmentation: Generating synthetic minority samples centrally violates data privacy. Federated variants of these techniques (e.g., Federated Augmentation, Federated Re-weighting) must be designed to operate without raw data exchange, adding algorithmic complexity.
How Federated Learning with Imbalanced Data Works
Federated Learning with Imbalanced Data addresses the specific challenge where individual clients' local datasets exhibit significant class imbalance, a prevalent and impactful form of statistical heterogeneity (Non-IID data).
Federated Learning with Imbalanced Data is a decentralized training paradigm where the local datasets on participating edge devices have a skewed distribution of class labels, meaning some categories are severely over- or under-represented compared to others. This creates a compounded challenge: the global model must learn from an aggregate of many different, locally biased data distributions, which can lead to client drift and poor performance on minority classes across the entire system.
To mitigate this, specialized algorithms like Fed-Focal Loss adapt centralized class-balancing techniques for the federated setting, applying re-weighting or logit adjustment during local client training. Other approaches include personalized federated learning, which tailors models to individual client skew, or clustered federated learning, which groups clients with similar imbalance patterns to train more effective subgroup models.
Common Techniques and Algorithms
Federated Learning with Imbalanced Data addresses the compounded challenge of class imbalance within individual clients' local datasets, a specific and common form of Non-IID data skew. The following techniques are designed to mitigate performance degradation and bias in the global model.
Class Re-Weighting at the Client
A local technique where the loss function is modified to assign higher weights to minority class samples during local training on each client. This directly counteracts the local imbalance.
- Mechanism: The loss for each sample is multiplied by a weight inversely proportional to its class frequency on that specific client.
- Impact: Prevents the local model from becoming biased toward the majority class, leading to more balanced gradient updates sent to the server.
- Challenge: Requires clients to compute local class distributions, which may be sensitive information. Global aggregation must account for varying re-weighting schemes across clients.
Federated Focal Loss
An adaptation of the Focal Loss function for the federated setting. It addresses class imbalance by down-weighting the loss for well-classified examples, focusing training on hard, minority-class samples.
- Core Principle: Adds a modulating factor
(1 - p_t)^γto the standard cross-entropy loss, wherep_tis the model's estimated probability for the true class. This reduces the contribution of easy examples. - Federated Application: Clients apply Focal Loss locally. The global model benefits because aggregated updates are less dominated by gradients from trivial majority-class samples.
- Benefit: Particularly effective for clients with extreme local imbalance, as it automatically adjusts focus without needing explicit frequency counts.
Client-Aware Aggregation (e.g., FedAvg with Class-Aware Weights)
Modifies the standard Federated Averaging (FedAvg) aggregation rule to account for the statistical makeup of participating clients, not just their data quantity.
- Standard FedAvg: Aggregates model updates weighted by the number of samples per client (
n_k / N). This can perpetuate global bias if many clients share similar majority classes. - Enhanced Aggregation: The server can weight client updates based on the inverse class frequency they report (e.g., giving more weight to a client with rare samples) or based on the diversity of their local dataset.
- Goal: To ensure the global model is influenced proportionally by all classes, not just by the most common data patterns across the federation.
Clustered Federated Learning for Imbalance
Groups clients into clusters based on the similarity of their label distributions, then trains a separate model per cluster.
- Rationale: Clients with similar imbalance patterns (e.g., all hospitals specializing in a rare disease) are grouped. The cluster model specializes in that specific skewed distribution.
- Process: Uses algorithms to cluster clients based on their model updates or metadata about class frequencies. A dedicated model is aggregated and maintained for each cluster.
- Outcome: Moves beyond a one-size-fits-all global model. Provides personalization at the cluster level, which is more effective than a single model when global imbalance is structural (certain classes only exist on specific clients).
Evaluation: Federated Balanced Accuracy
The standard metric for assessing model performance under imbalanced conditions. It is calculated as the average of per-class recall, ensuring each class contributes equally regardless of its frequency.
- Formula:
Federated Balanced Accuracy = (1/C) * Σ_{c=1}^{C} (TP_c / (TP_c + FN_c)), whereCis the number of classes andTP_c,FN_care true positives and false negatives for classc. - Federated Computation: Can be computed centrally if test data is shared (rare), or via federated evaluation where each client computes its local per-class recall, and the server averages these recalls across all clients.
- Importance: Provides a fairer view of model performance than global accuracy, which can be misleadingly high if the model simply learns to always predict the majority class.
Frequently Asked Questions
This FAQ addresses the specific challenges and solutions for training machine learning models in a federated setting where individual clients' local datasets suffer from class imbalance, a prevalent and impactful form of Non-IID data skew.
Federated Learning with Imbalanced Data is a subfield of decentralized machine learning that specifically addresses the challenge where the local dataset on each participating client device exhibits class imbalance, meaning some classes have significantly more examples than others. This creates a compounded problem: the global model must learn from a federation of clients, each of which has a unique and skewed view of the class distribution, leading to severe performance degradation, especially for minority classes.
Unlike centralized imbalanced learning, solutions here cannot simply re-sample or re-weight a central dataset. Instead, techniques must operate locally on each device and be compatible with the secure aggregation protocol. Common approaches include client-side re-weighting, where local loss functions are adjusted; federated focal loss, which down-weights well-classified examples; and strategies that explicitly share class distribution statistics (in a privacy-preserving manner) to guide global aggregation.
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
Imbalanced data is a specific and prevalent form of Non-IID (Non-Independent and Identically Distributed) data skew. These related concepts define the broader landscape of statistical heterogeneity in federated systems.
Non-IID Data
Non-Independent and Identically Distributed (Non-IID) data is the core statistical challenge in federated learning. It violates the standard machine learning assumption that all training data is drawn from the same underlying distribution. In federated systems, each client's local dataset can differ in:
- Feature distribution (covariate shift): The distribution of input features varies.
- Label distribution (prior probability shift): The frequency of class labels is different.
- Concept drift: The relationship between features and labels changes. This fundamental heterogeneity causes client drift and convergence instability.
Statistical Heterogeneity
Statistical heterogeneity is the umbrella term for the variation in data distributions across participating clients in a federated learning system. It encompasses all forms of Non-IID data, including:
- Label distribution skew: The primary cause of class imbalance, where some clients have few or no samples of certain classes.
- Feature distribution skew: Differences in the input feature space (e.g., different writing styles for the same word).
- Quantity skew: Vast differences in the number of data samples per client. Managing this heterogeneity is the central engineering problem for federated optimization algorithms.
Client Drift
Client drift is the phenomenon where local models, optimized on their unique Non-IID data, diverge from the global objective. This is the direct algorithmic consequence of data imbalance and heterogeneity. Key characteristics:
- Local updates become biased toward the client's local distribution.
- Simple averaging of these biased updates produces a sub-optimal global model.
- The global model's performance on any single client's distribution degrades. Algorithms like FedProx and SCAFFOLD are explicitly designed to correct for client drift by adding regularization or control variates.
Personalized Federated Learning (PFL)
Personalized Federated Learning is a family of techniques that abandon the goal of a single global model, instead producing models tailored to each client's local data distribution. This is a primary solution for severe imbalance. Approaches include:
- Local Fine-Tuning: Clients personalize a received global model with a few local training steps.
- Multi-Task Learning: Framing each client's problem as a related but distinct task.
- Model Interpolation: Learning to combine global and local models (e.g., Ditto).
- Meta-Learning: Training a model that can quickly adapt to new clients (e.g., Per-FedAvg).
Clustered Federated Learning
Clustered Federated Learning handles imbalance and heterogeneity by grouping clients with similar data distributions and training a separate model for each cluster. This creates multiple, more homogeneous model groups. The process involves:
- Similarity Measurement: Using model updates, loss values, or data statistics to infer client similarity.
- Clustering Algorithm: Applying algorithms like K-Means or hierarchical clustering.
- Cluster-Aware Aggregation: Averaging updates only within each cluster. This method is effective when the global data distribution is multi-modal, meaning clients naturally fall into several distinct groups.
Federated Evaluation
Federated Evaluation is the critical process of assessing model performance across all clients' local test sets. Under data imbalance, average global accuracy is a misleading metric. Proper evaluation must report:
- Client-specific accuracy: Performance on each client's held-out data.
- Worst-case performance: The minimum accuracy across all clients, highlighting fairness issues.
- Performance variance: The standard deviation of accuracy across clients.
- Per-class metrics: Precision, recall, and F1-score for minority classes on each client. This reveals the true generalization gaps caused by imbalanced, Non-IID data.

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