Improving GBDT performance on imbalanced datasets: An empirical study of class-balanced loss functions

Jiaqi Luo, Yuan Yuan, Shixin Xu

TL;DR

This paper provides the first comprehensive benchmark for adapting class-balanced loss functions—originally designed for deep learning—to Gradient Boosting Decision Trees (GBDTs). By implementing and testing five different loss functions across 40 datasets, the authors demonstrate that these algorithmic tweaks can significantly boost performance on imbalanced tabular data, particularly in complex multi-label scenarios.

What Problem Does This Paper Address?

In the world of tabular data, Gradient Boosting Decision Trees (GBDTs) like XGBoost and LightGBM are the gold standard. However, they often stumble when faced with class imbalance—situations where one category (like "fraudulent transaction") is much rarer than others.

Standard approaches usually involve "data-level" fixes like over-sampling the minority or under-sampling the majority. While common, these methods can introduce redundant data or throw away valuable information. "Algorithm-level" fixes, specifically class-balanced loss functions, have seen massive success in Deep Learning (DL) because of automatic differentiation. However, they haven't been systematically ported to GBDTs, which require manually defined first and second-order derivatives (gradients and Hessians) to function. This paper bridges that gap.

Methods

The authors evaluate three major GBDT frameworks: LightGBM, XGBoost, and SketchBoost. They adapt three well-known loss functions from DL and introduce two new variations:

  1. Weighted Cross-Entropy (WCE): Increases the "importance" of the minority class.
  2. Focal Loss (FL): Down-weights "easy" examples to force the model to focus on hard-to-classify minority samples.
  3. Asymmetric Loss (ASL): A more flexible version of Focal Loss that allows for different treatment of positive and negative samples.
  4. Asymmetric Cross-Entropy (ACE) [New]: Combines the shifted probability idea from ASL with standard cross-entropy.
  5. Asymmetric Weighted Cross-Entropy (AWE) [New]: Combines WCE with the shifted probability margin of ASL.

To make these usable, the authors derived the necessary gradients and Hessians for each. They also released a Python package, gbdtCBL, to allow practitioners to integrate these losses into their existing workflows easily.

Datasets

The study is impressively broad, utilizing 40 different datasets across three categories:

  • 15 Binary Classification datasets (from the imbalanced-learn library).
  • 15 Multi-class datasets (from the KEEL repository).
  • 10 Multi-label datasets (from Scikit-multilearn).

These datasets cover a wide range of Imbalance Ratios (IR), from mild (1.1) to extreme (over 6000 in the mediamill dataset).

Key Insights and Ideas

  • Complexity Breeds Opportunity: The effectiveness of these loss functions actually increases with task complexity. While binary classification saw the highest peak improvements, multi-label classification saw the most consistent gains across the board.
  • No "Silver Bullet" Loss: There isn't one loss function that wins every time. For example, WCE was a powerhouse for binary tasks, while ASL and the newly proposed AWE showed strong results in multi-label settings. This underscores the need for hyperparameter tuning (the authors used Optuna for this).
  • SketchBoost is a Multi-Label Sleeper: While XGBoost and LightGBM are household names, the authors highlight SketchBoost for its native ability to handle multi-output problems, making it particularly effective when paired with these new loss functions for multi-label tasks.

Key Results

The authors compared the "Baseline Maximum Performance" (using standard Cross-Entropy) against the "Class-balanced Maximum Performance." * Binary Classification: 13 out of 15 datasets improved. The most dramatic gain was a 28.91% absolute improvement in F1-score for the arrhythmia dataset. * Multi-class Classification: 14 out of 15 datasets improved, though the gains were more modest (up to 5.45% for the hayes-roth dataset). * Multi-label Classification: All 10 datasets showed improvement. Three datasets saw gains exceeding 10%, with the Corel5k dataset improving by 12.18%.

Limitations and Future Work

The authors note that while these methods are generally beneficial, they are not "universally advantageous." In two specific binary cases, performance slightly dipped, suggesting that class-balance techniques can occasionally lead to overcompensation.

Future directions include: * Exploring the synergy between these loss functions and traditional sampling methods. * Extending the study to other tree-based ensemble methods beyond the big three. * Further refining the "Asymmetric" family of losses for even more granular control over how models handle majority vs. minority errors.

For those interested in implementation, the code is available at: https://github.com/Luojiaqimath/ClassbalancedLoss4GBDT

Summary updated

BibTeX
@article{luo2025improving,
  author = {Jiaqi Luo and Yuan Yuan and Shixin Xu},
  title = {{Improving GBDT performance on imbalanced datasets: An empirical study of class-balanced loss functions}},
  journal = {Neurocomputing},
  year = {2025},
  doi = {10.1016/j.neucom.2025.129896},
}
Figure