CatBoost: unbiased boosting with categorical features

Liudmila Ostroumova Prokhorenkova, Gleb Gusev, Aleksandr Vorobev, Anna Veronika Dorogush, Andrey Gulin

Introduction

Gradient Boosted Decision Trees (GBDT) are the gold standard for tabular data, powering everything from search engines to weather forecasting. However, CatBoost introduces a critical observation: all previous implementations of GBDT suffer from a fundamental statistical flaw known as prediction shift.

In standard GBDT, the same data points are used both to calculate the gradients (which guide the creation of the next tree) and to train the model itself. This creates a subtle form of "target leakage." The model effectively "sees" the target values of the training data in a way it will not during testing. This leads to a distribution shift where the model performs exceptionally well on training data but fails to generalize as effectively to unseen test data. A similar leakage occurs when converting categorical features (like "City" or "User ID") into numerical "target statistics."

CatBoost is a high-performance gradient boosting library designed to tackle this pervasive issue. By introducing ordered boosting and a novel method for handling categorical features, it eliminates inherent target leakage, leading to state-of-the-art results that consistently outperform alternatives like XGBoost and LightGBM.

Methods: The Ordering Principle

The authors propose the Ordering Principle to decouple the data used for model building from the data used for gradient estimation.

1. Ordered Target Statistics (TS)

To turn a categorical feature into a number without leakage, CatBoost uses a random permutation of the dataset. For any given example, its target statistic is calculated using only the examples that appear before it in that specific permutation. This simulates a real-world "online" learning scenario where you only have access to historical data, preventing the model from peeking at future target values.

2. Ordered Boosting

This is the library's namesake and core innovation. Instead of training one model on the whole dataset to calculate residuals, CatBoost conceptually maintains a series of models.

Illustration of the ordered boosting process, where residuals for a data point are calculated using a model trained only on preceding points.

As illustrated above, to calculate the residual (error) for the $i$-th sample, CatBoost uses a model trained only on the first $i-1$ samples. For example, the residual for data point 7 is calculated using a model trained exclusively on points 1 through 6. While training a separate model for every data point is computationally prohibitive, the authors implemented a clever approximation that reduces this complexity to a manageable level.

3. Oblivious Trees

Unlike XGBoost or LightGBM, CatBoost uses "oblivious" decision trees. These are symmetric trees where the exact same splitting criterion is used across an entire level of the tree. This structure acts as a powerful regularizer, making the model less prone to overfitting and significantly faster during inference.

Key Insights

  • The Bias is Real: The paper provides a formal theoretical proof showing that standard GBDT is inherently biased. Even with infinite data, the "greedy" approach to gradient estimation leads to a model that is shifted away from the true optimal function.
  • Permutations are Key: By using multiple random permutations of the data for different steps of the algorithm, CatBoost reduces the variance of its estimates. This makes it particularly robust on smaller datasets.
  • Automatic Feature Combinations: CatBoost automatically creates combinations of categorical features (e.g., combining "User ID" and "Ad Topic"). This captures high-order dependencies that other models might miss unless a human engineer manually engineers them.

Key Results

The authors evaluated CatBoost against XGBoost and LightGBM on nine diverse, well-known public datasets, ranging from categorical-heavy sets (Adult, Amazon, Click) to large-scale numerical sets (Epsilon, Churn).

Performance comparison of CatBoost against LightGBM and XGBoost across various datasets.
  • Superior Accuracy: As shown in the performance tables, CatBoost outperformed both XGBoost and LightGBM on all nine datasets tested. In some cases, like the Amazon dataset, the improvement in logloss was as high as 17-21% compared to the baselines.
  • Ordered vs. Plain: The "Ordered" mode is most beneficial on smaller datasets (under 40k examples) where the prediction shift bias is most damaging. On very large datasets, the "Plain" mode performs similarly to other state-of-the-art tools but still benefits from CatBoost's categorical handling.
  • Training Speed: While the "Ordered" mode is roughly 1.7x slower than LightGBM due to the overhead of maintaining multiple supporting models, the "Plain" mode is highly competitive with the fastest existing implementations.

Limitations and Future Work

  • Computational Overhead: The "Ordered" boosting mode requires more memory and time than traditional boosting. While optimized using a logarithmic number of supporting models, it remains more resource-intensive.
  • Hyperparameter Sensitivity: Although CatBoost is famous for working well with "out-of-the-box" settings, the paper notes that the number of permutations and the choice of target statistics can still impact performance, suggesting room for more automated tuning.
  • Extension to Other Tasks: The theoretical analysis of prediction shift primarily focused on regression with quadratic loss. While the principles apply to other tasks like classification, formal proofs for diverse loss functions remain a direction for future research.

Summary updated

BibTeX
@inproceedings{prokhorenkova2018catboost,
  author = {Liudmila Ostroumova Prokhorenkova and Gleb Gusev and Aleksandr Vorobev and Anna Veronika Dorogush and Andrey Gulin},
  title = {{CatBoost: unbiased boosting with categorical features}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
  url = {https://openreview.net/forum?id=BJEabw-_Wr},
}
Figure