Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss
Kaidi CaoColin WeiAdrien GaidonNikos AréchigaTengyu Ma
Proposes a theoretically grounded label-distribution-aware margin loss paired with a deferred re-weighting training schedule to substantially improve deep learning generalization on minority classes in heavily imbalanced datasets.
Real-world datasets for machine learning applications often suffer from extreme class imbalance, where a few frequent classes dominate while many critical minority classes contain very few examples. Standard deep neural networks trained on such data tend to perform poorly on rare categories. This poses serious risks in practical deployments, including autonomous systems, medical screening, and visual recognition, where balanced accuracy across all classes or reliable performance on rare cases is required. Existing remedies—such as re-weighting loss values or re-sampling minority examples—frequently cause models to severely overfit rare classes or destabilize optimization during training.
The article sets out to design and evaluate a theoretically grounded training loss and optimization strategy that boosts generalization on minority classes without sacrificing accuracy on frequent classes. Specifically, the authors aimed to demonstrate that enforcing class-dependent margins combined with a deferred re-weighting schedule outperforms existing class-imbalance techniques across standard benchmarks.
The researchers developed two complementary techniques: the Label-Distribution-Aware Margin loss, which mathematically enforces wider classification margins for rarer classes based on generalization error bounds, and a Deferred Re-balancing training schedule, which trains the model with standard empirical risk minimization in early epochs before applying class re-weighting in later epochs with a smaller learning rate. They validated this framework across controlled vision benchmarks, including imbalanced variations of standard image datasets (CIFAR-10, CIFAR-100, and Tiny ImageNet), an imbalanced text sentiment dataset, and the large-scale real-world iNaturalist 2018 dataset containing over 437,000 images across 8,142 categories.
The experimental findings show that the proposed approach substantially improves model accuracy across all test scenarios. On the large-scale iNaturalist benchmark, combining the new loss and deferred schedule achieved a top-1 error rate of 32.00%, outperforming the standard training baseline by 10.86 percentage points and prior state-of-the-art re-weighting methods by 6.88 percentage points. On vision datasets with severe 100-to-1 class imbalances, the framework consistently reduced classification error compared to standard baselines, dropping top-1 error from roughly 29.6% to 23.0% on 10-class image data and from 61.7% to 58.0% on 100-class data. Feature analysis demonstrated that deferring re-weighting allows networks to first build high-quality internal representations before re-balancing class decision boundaries, avoiding the severe under-fitting on frequent classes or overfitting on rare classes that plagues early re-weighting.
These results indicate that organizations deploying machine learning on imbalanced operational data can achieve major performance gains with minimal engineering overhead. Because the proposed loss and scheduling replace the standard loss function and optimization timetable, they do not introduce substantial computational complexity or inference latency. Furthermore, the framework generalizes effectively to domain-adaptation settings where target test class distributions are non-uniform but known.
Engineering and data science teams addressing class imbalance should adopt the label-distribution-aware loss in place of standard cross-entropy objectives and implement deferred re-balancing rather than weighting samples from the initial epoch. Organizations should evaluate this pipeline on internal imbalanced datasets through pilot experiments to calibrate the single margin hyperparameter against standard validation targets.
While empirical results strongly support the framework across multiple vision and language datasets, the theoretical derivation for optimal margin scaling assumes a binary classification boundary and separable data, serving as a heuristic approximation for complex multi-class settings. Additionally, the approach assumes that either the target evaluation distribution is balanced or its label proportions are known in advance, meaning caution is warranted if target domain class distributions are entirely unknown or dynamically shifting.
- Paper: Class-Balanced Loss Based on Effective Number of Samples, Yin Cui et al. (2019). Reading this paper first is essential because it introduces the foundational effective-number-of-samples weighting perspective that directly motivates the margin-based loss framework of the source.
- Paper: Focal Loss for Dense Object Detection, Tsung-Yi Lin et al. (2017). This work establishes the core concept of modulating loss functions to handle extreme class imbalance, providing the necessary precursor rationale for the margin adjustments explored in the source.
- Paper: Supervised Contrastive Learning, Prannay Khosla et al. (2020). This book chapter naturally continues the source's exploration of representation learning and loss engineering by demonstrating how supervised contrastive objectives further improve margin-based classification.
- Paper: Improved Baselines with Momentum Contrastive Learning, Xinlei Chen et al. (2020). This paper builds directly upon the foundational representation and loss techniques discussed in the source, extending them to improved unsupervised contrastive learning baselines.
