Difficulty-aware Balancing Margin Loss for Long-tailed Recognition

Minseok Son, Inyong Koo, Jinyoung Park, Changick Kim

TL;DR

The Difficulty-aware Balancing Margin (DBM) loss tackles long-tailed recognition by moving beyond simple class-level rebalancing. It introduces adaptive margins that account for both class frequency and individual sample difficulty, specifically pushing "hard positive" samples closer to their class centers to improve discriminative power in imbalanced datasets.

What Problem Does This Paper Address?

Deep learning models excel when data is balanced, but real-world datasets often follow a "long-tailed" distribution: a few "head" classes have thousands of samples, while many "tail" classes have only a handful. This leads to a strong bias toward majority classes.

Existing solutions usually focus on class-level adjustments—like giving tail classes more weight or larger margins (e.g., LDAM loss). However, these methods treat every sample within a class as equally difficult. The authors argue this is a mistake. A "hard" sample in a majority class might be more detrimental to the decision boundary than an "easy" sample in a minority class. By ignoring instance-level difficulty, current models fail to learn robust features for the most challenging examples, regardless of which class they belong to.

Methods

The authors propose the DBM loss, which utilizes a cosine classifier (where features are mapped onto a hypersphere) and introduces two distinct margin components:

  1. Class-wise Margin ($m_C$): Similar to previous work, this assigns larger margins to minority classes. This ensures that the "territory" carved out for a tail class is large enough to prevent it from being overwhelmed by head classes.
  2. Instance-wise Margin ($m_I$): This is the core novelty. The model calculates the "difficulty" ($d_I$) of a sample based on its angular distance from its class center. If a sample is far from its center (high $\theta_y$), it is considered difficult.
  3. Hard Positive Strategy: Crucially, the instance-wise margin is only applied to hard positives—samples that the model currently misclassifies during training.

By combining these, the final logit for a positive class becomes $s \cdot \cos(\theta_y + m_C + \mathbb{1}[\text{hard}] \cdot m_I)$. This forces the network to work harder to pull misclassified samples into their correct decision boundaries, leading to a denser and more compact feature distribution.

Datasets

The researchers evaluated DBM across standard long-tailed benchmarks:

  • CIFAR-10-LT & CIFAR-100-LT: Artificially imbalanced versions of the classic datasets with imbalance factors ranging from 10 to 100.
  • ImageNet-LT: A long-tailed version of the massive ImageNet-1K dataset.
  • iNaturalist2018: A large-scale, naturally imbalanced dataset of plant and animal species (8,142 classes).

Key Insights and Ideas

  • Difficulty is not just about class size: The ablation studies show that adding instance-level awareness ($m_I$) provides a consistent boost (approx. +0.7%) over models that only use class-level margins ($m_C$).
  • Focusing on the "Hard" helps the "Easy": By specifically targeting misclassified samples (the Hard Positive strategy), the model avoids over-regularizing samples it already understands well, which leads to better overall generalization.
  • Geometric Compactness: Visualization of the angular distances (Figure 4 in the paper) shows that DBM-BS reduces the mean angular distance by about 10° across all groups. This means the model isn't just getting higher accuracy; it's learning "cleaner" clusters in the feature space.
  • Plug-and-Play Versatility: DBM isn't a standalone architecture; it’s a loss function. The authors successfully integrated it with various state-of-the-art LTR techniques like Balanced Softmax (BS), Contrastive Learning (BCL), and even foundation models like CLIP.

Key Results

DBM consistently outperformed baseline methods across all tested datasets:

  • CIFAR-100-LT (IF 100): DBM-BS achieved 51.30% accuracy, a significant jump over the standard Balanced Softmax (49.35%).
  • Tail Class Performance: On CIFAR-100-LT, the "Few" (tail) class accuracy jumped from 29.27% to 33.23%, proving the method's effectiveness where it's needed most.
  • iNaturalist2018: DBM-GML reached 72.0% overall accuracy, surpassing existing methods like RIDE and BCL.
  • Foundation Models: When applied to a fine-tuned CLIP (ViT-B/16), DBM improved accuracy on the "Few" group of ImageNet-LT from 71.3% to 75.1%.

Limitations and Future Work

  • Cosine Classifier Requirement: The method relies on a cosine classifier architecture. While common in modern LTR and face recognition, it might require architectural changes for researchers using standard linear classifiers.
  • Hyperparameter Sensitivity: The margins depend on two hyperparameters ($K$ and $\tau$). While the authors found $K=0.1$ and $\tau=1.0$ to be generally robust, optimal performance on new datasets might require some tuning.
  • Future Directions: The authors suggest that the definition of "difficulty" could be expanded beyond simple angular distance, perhaps incorporating temporal consistency (how often a sample is misclassified over many epochs).

Summary updated

BibTeX
@inproceedings{son2025difficulty,
  author = {Minseok Son and Inyong Koo and Jinyoung Park and Changick Kim},
  title = {{Difficulty-aware Balancing Margin Loss for Long-tailed Recognition}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i19.34261},
}
Figure