Understanding CNN fragility when learning with imbalanced data

Damien Dablain, Kristen N. Jacobson, Colin Bellinger, Mark Roberts, Nitesh V. Chawla · DOI

Abstract

Convolutional Neural Networks (CNNs) often exhibit significant performance degradation when trained on imbalanced datasets. This study investigates the internal "black box" representations of CNNs to understand this fragility. By decomposing the network into feature extraction and classification components, the authors identify that CNNs rely on a sparse subset of "top-K" features. For minority classes, these features lack diversity and exhibit disproportionately high magnitudes. This "loudness" compensation creates a rigid representation that fails to generalize when test-set feature intensities deviate from training conditions. Our findings suggest that the fundamental issues of class imbalance are rooted in the early stages of feature learning, limiting the effectiveness of simple classification-layer adjustments.

Introduction

While CNNs are powerful, they are notoriously "fragile" when trained on imbalanced datasets—where majority classes have many examples and minority classes have very few. Standard models often achieve high overall accuracy by ignoring minority classes or overfitting to them. This paper addresses the gap in interpretability by moving beyond individual image explanations to examine global class properties. It asks: What is the fundamental difference in how a CNN represents a majority class versus a minority class in its internal latent space? Understanding this helps explain why common fixes, like re-weighting the loss function, often hit a performance ceiling.

Methodology

The authors propose a framework to analyze the internal representations of a trained CNN by bifurcating the network into two distinct functional parts:

  1. Embedding Layers: These extract Feature Embeddings (FE)—the raw, low-dimensional signals the network detects.
  2. Classification Layer: This applies weights to the FE to produce Classification Embeddings (CE), which are then summed to create the final "logits" (scores) used for prediction.
Figure 1: Overview of the CNN architecture bifurcation into Feature Extraction and Classification components.

The core of the analysis revolves around Top-K features. The researchers identify the minimum number of latent features ($K$) required for the network to correctly distinguish a class from its closest competitor. By comparing the identity, frequency, and magnitude of these features across majority and minority classes, they reveal the mechanics of "CNN fragility."

Experimental Setup

The study utilizes three popular image benchmarks, modified to introduce different types of class imbalance:

  • CIFAR-10: Subjected to both exponential imbalance (a smooth drop-off in examples per class) and step imbalance (a sharp divide between many and few).
  • SVHN (Street View House Numbers): Used to test the findings on digit recognition.
  • CelebA: Specifically looking at facial attributes to ensure the model isn't just picking up on simple features like hair color.
Table 1: Training class frequencies for CIFAR-10 and SVHN showing the degree of imbalance.

Key Insights: The Mechanics of Fragility

The "Loudness" Compensation

Because minority classes have fewer examples, the CNN compensates by "turning up the volume" on the few features it does find. Minority class features often have mean magnitudes 2x to 4x higher than those of majority classes. In CIFAR-10, the single largest classification embedding (CE) for extreme minority classes averaged a magnitude of 8.3, compared to just 2.6 for majority classes.

Diversity vs. Sparsity

Majority classes are represented by a wide, diverse "manifold" of features. Minority classes, however, rely on a "handful" of high-intensity features. This makes the decision boundary for minority classes much narrower and more rigid. In all cases, the number of features ($K$) needed to make a prediction is much smaller than the total hidden dimension (e.g., using only 7-11 features out of 64).

The Generalization Gap

A CNN generalizes well only when the magnitude of features in the test set matches the training set. For minority classes, if a test image has the right "identity" of features but they aren't "loud" enough, the model fails. False positives occur when there is a significant mismatch in feature magnitude, even if the feature "identity" is 70% the same as what was learned during training.

Conclusion

The study demonstrates that retraining the final classification layer on balanced data cannot recover performance lost if the initial feature extractor was trained on imbalanced data. The "damage" to how the network perceives features happens early on. Future work should investigate whether data augmentation techniques like SMOTE can diversify latent features rather than just increasing raw data volume, and extend this analysis to non-visual architectures like Transformers.

Summary updated

BibTeX
@article{dablain2024understanding,
  author = {Damien Dablain and Kristen N. Jacobson and Colin Bellinger and Mark Roberts and Nitesh V. Chawla},
  title = {{Understanding CNN fragility when learning with imbalanced data}},
  journal = {Machine Learning},
  year = {2024},
  doi = {10.1007/s10994-023-06326-9},
}
Figure