Adaptive Class-Balanced Loss
- Adaptive Class-Balanced Loss is a training objective that dynamically adjusts class weights using signals like effective sample counts and validation difficulty.
- It integrates various adaptive mechanisms—frequency-based, difficulty-based, and time-based—to address long-tailed data distributions and enhance minority class performance.
- Its plug-and-play design allows it to replace standard losses in diverse systems, from object detection and segmentation to continual learning and document classification.
Adaptive class-balanced loss denotes a family of re-weighted training objectives for imbalanced learning in which the contribution of each class is not treated as fixed under ordinary empirical frequency, but is adjusted by a class-aware signal such as effective sample count, validation-set difficulty, global foreground/background loss statistics, ordered class-wise error, or task age in continual learning. The common starting point is the class-balanced re-weighting scheme based on the “effective number of samples,” introduced to model diminishing returns from additional examples of head classes, and subsequently instantiated in object detection, document classification, segmentation, tabular boosting, and continual learning (Cui et al., 2019).
1. Conceptual scope
Class-balanced loss emerged as a response to the long-tailed regime in which “a few classes account for most of the data, while most classes are under-represented.” In its canonical form, it modifies a standard classification loss by assigning larger weight to classes with smaller effective support, rather than leaving all examples to contribute equally under plain cross-entropy (Cui et al., 2019).
The adjective adaptive has several meanings in the literature. In some works, adaptation is still dataset-level: class weights are computed from class counts once and then reused throughout training, as in the effective-number loss used in long-tailed image classification and in AraDIC for Arabic document classification (Cui et al., 2019, Daif et al., 2020). In other works, the weights evolve with training: Class-wise Difficulty-Balanced loss recomputes per-class difficulty from validation accuracy after each epoch; CBMT recalibrates foreground/background terms from global mean pseudo-label losses; OWAdapt reorders class-wise errors at each optimization step; AutoBalance updates class weights, logit shifts, and temperatures by bilevel optimization on a validation objective; and the method explicitly named Adaptive Class-Balanced loss in exemplar-free class-incremental learning uses time-based class weighting over tasks (Sinha et al., 2020, Tang et al., 2023, Maldonado et al., 2023, Li et al., 2022, Xu et al., 4 Jun 2026).
This suggests two broad interpretations. One is a narrow interpretation in which “adaptive” means that the weighting function changes during optimization or across tasks. The other is a broader interpretation in which the loss is class-balanced by a signal more informative than raw empirical frequency alone.
2. Mathematical foundation
The baseline object is the ordinary cross-entropy. For a single-label problem with predicted probabilities and one-hot target , the class-balanced cross-entropy replaces the uniform per-example contribution with a class-dependent weight:
The key question is how is defined (Cui et al., 2019).
In the effective-number framework, class with training samples is assigned effective number
and weight
optionally normalized. The parameter controls the smoothness of re-weighting, and the original formulation recommends cross-validating (Cui et al., 2019). The same re-weighting can be attached not only to softmax cross-entropy, but also to sigmoid-style losses and focal loss, producing class-balanced CE, class-balanced sigmoid CE, and class-balanced focal variants (Cui et al., 2019).
AraDIC adopts this form directly for document classification. For an example with logits 0 and class label 1, the loss is
2
with
3
and the paper fixes 4 (Daif et al., 2020). That implementation is explicitly a plain cross-entropy re-weighted by 5 and “does not add an explicit focal-loss 6 component” (Daif et al., 2020).
The effective-number formulation is important because it sits between two extremes. It preserves the simplicity of class-weighted CE, but replaces direct inverse-frequency heuristics with a quantity motivated by overlap and diminishing information gain as more samples from a class are observed (Cui et al., 2019).
3. Principal adaptive mechanisms
A first mechanism is frequency-based adaptation. Here the loss is adapted to the class histogram of the training set through effective-number weights. This is the defining construction in the original class-balanced loss, and it is the form reused in AraDIC and in the “ENet” object-detection experiments on BDD100K (Cui et al., 2019, Daif et al., 2020, Phan et al., 2020).
A second mechanism is difficulty-based adaptation. Class-wise Difficulty-Balanced loss argues that “the number of available training data may not be always a good clue to determine the weighting strategy” because some minority classes can already be sufficiently represented. It therefore defines per-class difficulty at epoch 7 by
8
and sets
9
An optional dynamic focusing exponent is also defined through the current bias
0
with 1 (Sinha et al., 2020). This makes the weight depend on how the model is currently serving each class rather than on counts alone.
A third mechanism is global loss calibration under pseudo-label imbalance. In CBMT for source-free domain adaptive fundus segmentation, the calibrated BCE replaces the background term by a factor 2, where 3 and 4 are global mean losses for pixels whose pseudo-label is foreground or background. The pseudo-label threshold is 5, and an 6 confidence filter keeps only “informative” pixels when collecting statistics (Tang et al., 2023). This is adaptive because the weighting factor is estimated from the evolving target-domain pseudo-label distribution.
A fourth mechanism is time-based class balancing. The exemplar-free continual-learning method explicitly named Adaptive Class-Balanced loss introduces a virtual sample count
7
for class 8 first seen at task 9, and then defines
0
The corresponding weighted cross-entropy is
1
In the reported experiments, 2, 3, 4, and 5 (Xu et al., 4 Jun 2026). The design intention is explicit: older prototype-based classes are strongly up-weighted when they are most under-represented and then gradually annealed.
A fifth mechanism is ordered error aggregation. OWAdapt first computes class-wise cross-entropy errors
6
sorts them into 7, and applies an Ordered Weighted Averaging operator
8
The weight vector is generated from a quantifier 9 by
0
Because the weights are attached to the ranking of class errors rather than to fixed class identities, the worst-served classes at a given step receive the largest coefficients (Maldonado et al., 2023).
A sixth mechanism is bilevel adaptation by validation objectives. AutoBalance introduces a parametric cross-entropy with multiplicative class weights 1, additive logit shifts 2, and per-class temperatures or margins 3:
4
The model parameters are trained on a lower-level training problem, while 5 are updated on a validation objective by approximate implicit differentiation (Li et al., 2022). In this formulation, class balancing is not hand-specified once for all; it is optimized against the desired downstream criterion.
4. Integration into learning systems
One of the practical attractions of class-balanced loss is that many instantiations require only local changes to the criterion, not to the backbone architecture. In the BDD100K object-detection study, Phan and Yamamoto keep feature extraction, localization-regression heads, hard-negative mining, and data augmentation unchanged, and “the only change needed is to replace the standard classification-head loss 6 by one of the above weighted variants” in an SSD-style detector with VGG16 backbone and extra up-sampling layers for small objects (Phan et al., 2020).
AraDIC likewise uses class-balanced loss as a drop-in objective within an end-to-end pipeline. Raw Arabic text is rendered as 7 grayscale character images, passed through a character encoder CNN to obtain 128-dimensional embeddings, and then classified by either a 1D-CNN or a 3-layer BiGRU. The class-balanced softmax cross-entropy is applied at the classifier output, and both encoder and classifier are updated jointly with Adam at learning rate 8 and batch size 9 (Daif et al., 2020).
The GBDT study shows that class-balanced objectives are not restricted to neural networks. For binary tasks, the paper writes the general re-weighted cross-entropy
0
and then derives gradients and Hessians for Weighted Cross-Entropy, Focal Loss, Asymmetric Loss, Asymmetric Cross-Entropy, and Asymmetric Weighted Cross-Entropy so that LightGBM, XGBoost, and SketchBoost can optimize the corresponding second-order Taylor surrogate (Luo et al., 2024). Notably, the same paper states that its use of the word “adaptive” refers to per-dataset hyperparameter tuning with Optuna rather than to a dynamically changing schedule during training (Luo et al., 2024).
The theoretical literature has also shifted from heuristic weighting to surrogate design. “Improved Balanced Classification with Theoretically Grounded Loss Functions” introduces Generalized Logit-Adjusted and Generalized Class-Aware losses for the balanced objective. GLA losses are Bayes-consistent but their 1-consistency bounds scale at least as 2, whereas GCA losses are 3-consistent for any bounded or complete hypothesis set and scale as 4 in the common 5 case (Cortes et al., 30 Dec 2025). This places class-aware weighting and class-aware margin calibration within a common consistency framework.
5. Empirical record across application domains
The empirical evidence is heterogeneous because different papers optimize different metrics, but several regularities recur. In specialized object detection on BDD100K, evaluation is by per-class recall at fixed 6 and 7 rather than by overall mAP. Under that criterion, the effective-number class-balanced loss (“ENet”) improves Bike recall from 8 to 9, Bus from 0 to 1, and Motor from 2 to 3, while Balanced Cross-Entropy with fixed 4 attains the highest average recall at 5 versus 6 for the original CE (Phan et al., 2020).
In Arabic document classification, class-balanced loss produces systematic macro-F1 gains. On the Arabic Wikipedia Title dataset, BiGRU without CB loss reports micro/macro F1 of 7, while BiGRU with CB loss reports 8. On the Arabic Poetry dataset, the corresponding numbers are 9 without CB and 0 with CB (Daif et al., 2020). The pattern in the paper is that class-balanced weighting improves minority-class behavior while maintaining or slightly improving micro-F1.
In long-tailed image and video recognition, difficulty-adaptive weighting also improves balanced behavior. On ImageNet-LT with ResNet-10, Class-wise Difficulty-Balanced CE alone reports Top-1 accuracy of 1, compared with 2 for focal loss and 3 for EQL. On the EGTEA-Gaze+ video verb benchmark, CDB-CE improves test Acc@Top1 from 4 under unweighted CE to 5, and macro-Recall from 6 to 7 (Sinha et al., 2020).
In source-free fundus segmentation, the calibration component itself yields a measurable improvement. On RIM-ONE-r3, the ablation study reports Dice 8 for “+EMA only,” 9 for “+EMA+Calib only,” and 0 for the full CBMT with EMA, augmentation, and calibration; ASSD decreases from 1 to 2 and then to 3 (Tang et al., 2023). The paper further notes that without calibration the predicted cup-pixel ratio collapses toward zero, whereas calibration keeps it near the oracle ratio (Tang et al., 2023).
In exemplar-free continual learning, the time-adaptive ACB schedule improves prototype rehearsal. On TinyImageNet with 4 tasks, baseline rehearsal reports 5 and 6, while “+ACB” gives 7 and 8, and the full CEOS+ACB model gives 9 and 0 (Xu et al., 4 Jun 2026). The same study reports consistent 1 to 2 percentage-point gains from replacing unweighted cross-entropy with 3 across CIFAR-100, TinyImageNet, ImageNet-100, and CUB-200 (Xu et al., 4 Jun 2026).
OWAdapt reports a broader cross-dataset comparison on 13 image-classification datasets and three architectures. Averaged over all datasets and architectures, OWAdapt obtains Accuracy 4, F1 macro 5, minimum class recall 6, and minimum class F1 7, compared with 8, 9, 00, and 01 for standard CE (Maldonado et al., 2023). This is evidence that per-step ranking of class-wise errors can function as an adaptive balancing mechanism even without explicit class-frequency formulas.
6. Limitations, misconceptions, and open directions
A common misconception is that any loss that helps under imbalance is therefore class-balanced in the same sense. The BDD100K study makes a sharper distinction: focal loss “helps background vs. foreground imbalance more than foreground–foreground class imbalance,” because it adapts to easy versus hard predictions but “does not encode long-term class frequencies” (Phan et al., 2020). This is why focal loss can improve overall detection behavior without matching the minority-class gains of explicit class-balancing.
Another misconception is that raw inverse-frequency weighting is always the natural solution. The same object-detection study states that static inverse-frequency weights can be extreme for very rare classes and may cause instability when a batch has zero or few samples of that class (Phan et al., 2020). Difficulty-based and ordered-error methods were motivated in part by this objection: they attempt to weight classes by current training need rather than by count alone (Sinha et al., 2020, Maldonado et al., 2023).
Adaptive class balancing also does not solve all causes of poor minority performance. On BDD100K, the method “does not fix data-annotation issues” such as ambiguous “Car” versus “Truck” boxes or overlapping “Motor”/“Person” annotations, and it leaves other imbalance axes—“object size, lighting domains, occlusion”—unaddressed (Phan et al., 2020). This suggests that class-aware weighting is orthogonal to label cleaning, soft targets, and other distribution-shift remedies.
The word adaptive itself is not uniform across papers. CALF, for example, is conditionally adaptive because it chooses one of seven elemental segmentation losses from dataset skewness and kurtosis, but “once the appropriate elemental loss is selected, it remains fixed for the entire run” (Alam et al., 6 Apr 2025). The GBDT study similarly states that no time-dependent schedule was used; “adaptive” there means tuning the loss hyperparameters per dataset by 5-fold CV and early stopping (Luo et al., 2024). By contrast, CDB, CBMT, OWAdapt, AutoBalance, and the continual-learning ACB all change their effective weighting signal during optimization or across tasks (Sinha et al., 2020, Tang et al., 2023, Maldonado et al., 2023, Li et al., 2022, Xu et al., 4 Jun 2026).
Open directions are already visible in the surveyed literature. Proposed extensions include defining an “effective number” per size-bin or per domain, using multi-stage training with different losses at different phases, smoothing noisy difficulty estimates, extending difficulty-based weighting to multi-label settings, and moving from heuristic class weights to theoretically grounded class-aware surrogate families with stronger consistency guarantees (Phan et al., 2020, Sinha et al., 2020, Cortes et al., 30 Dec 2025). The field therefore spans both pragmatic engineering—often implemented by replacing only the classification term—and a more formal program of balanced-risk surrogate design.