A Theoretical Analysis of the Learning Dynamics under Class Imbalance
Emanuele Francazi, Marco Baity-Jesi, Aurelien Lucchi
TL;DR
The paper addresses learning dynamics under class imbalance and shows that gradient-based training can exhibit a minority initial drop (MID) when gradients from the majority class dominate. It introduces Per-Class Normalized Gradient Descent (PCNGD) and Per-Class Normalized SGD (PCNSGD) to equalize per-class gradient signals, deriving convergence guarantees for GD and highlighting the need for additional stabilization (oversampling, rescaling) in SGD due to directional noise. The authors provide theoretical results under smoothness and gradient-dominance conditions, proving that PCNGD can monotonically decrease per-class losses and, in gradient-dominated settings, converge to per-class minima; in SGD, variance and directional noise necessitate PCNSGD+O and PCNSGD+R to achieve robust, balanced learning. Empirical validation across multiple architectures and long-tailed CIFAR-derived datasets demonstrates MID elimination, faster per-class convergence, and improved generalization with PCN variants, while also explaining when oversampling is particularly beneficial. Overall, the work offers a principled framework for addressing class imbalance by combining per-class gradient normalization with conventional data- and loss-level strategies, providing both convergence guarantees and practical guidance for real-world long-tailed problems.
Abstract
Data imbalance is a common problem in machine learning that can have a critical effect on the performance of a model. Various solutions exist but their impact on the convergence of the learning dynamics is not understood. Here, we elucidate the significant negative impact of data imbalance on learning, showing that the learning curves for minority and majority classes follow sub-optimal trajectories when training with a gradient-based optimizer. This slowdown is related to the imbalance ratio and can be traced back to a competition between the optimization of different classes. Our main contribution is the analysis of the convergence of full-batch (GD) and stochastic gradient descent (SGD), and of variants that renormalize the contribution of each per-class gradient. We find that GD is not guaranteed to decrease the loss for each class but that this problem can be addressed by performing a per-class normalization of the gradient. With SGD, class imbalance has an additional effect on the direction of the gradients: the minority class suffers from a higher directional noise, which reduces the effectiveness of the per-class gradient normalization. Our findings not only allow us to understand the potential and limitations of strategies involving the per-class gradients, but also the reason for the effectiveness of previously used solutions for class imbalance such as oversampling.
