Paper commentary
CatBoost: unbiased boosting with categorical features
CatBoost avoids target leakage by ordering training examples for boosting
- Problem Gradient boosting and target statistics reuse training targets, so predictions on training data differ from predictions on test data. This prediction shift is a kind of target leakage present in existing implementations.
- Method CatBoost uses ordered boosting and an ordered target encoding for categorical features. Each example is encoded only from the examples that come before it in a random permutation, so its own target never leaks into its feature.
- Results On Adult, CatBoost in Ordered mode scored 0.270 logloss, while LightGBM scored 2.4% higher. The gap was wider on Amazon, where both baselines were 17% higher.
Where target leakage shifts predictions
Gradient boosting builds an ensemble by fitting each new base predictor to the negative gradient of the loss at the current model. That gradient is estimated on the same training examples the current model was built from, so it carries information from each example's own target. The authors call the resulting mismatch between training-time and test-time predictions prediction shift, and classify it as a special kind of target leakage.
Categorical features face the same problem, because a common fix is to replace each category by its target statistic. A greedy target statistic averages the targets of every training example in a category, so an example's own label becomes part of its own feature. That makes the distribution of the encoded feature given the target differ between training and test data, which is a conditional shift.
In the authors' extreme case, every category is unique and the label is a coin flip, so one threshold separates the training set perfectly while test accuracy stays at 0.5.
Encoding each example from its predecessors
The key idea is to give the training data an artificial time order: shuffle the examples once and encode each one using only the examples that come before it. Under this rule a training example's feature never depends on its own target, while a test example can use all of the training data. The ordering is inspired by online learning, where each example is seen only after its history.
Holdout statistics avoid the leak too, but they compute the encoding on one half of the data and train on the other, which wastes examples. Leave-one-out looks like a natural fix, yet with a constant categorical feature it still lets one threshold separate the training labels. The authors therefore required an encoding that avoids the shift and still uses all training examples.
A single permutation gives early examples statistics built from very few predecessors, so their variance is much higher than for later examples. CatBoost therefore draws different permutations for different steps of boosting, rather than reusing one order.
How large the bias gets in a toy case
To make the bias concrete, the authors analyze a regression with quadratic loss, two independent binary features and a linear target. They fit two decision stumps with step size 1, one on each feature, with the first stump on the feature that has the larger coefficient. If each step uses an independent sample, the expected model equals the true function up to a small error term, so no bias remains.
If both steps reuse one dataset, the expected prediction becomes \(f^*(x)-\frac{1}{n-1}c_2(x_2-\frac{1}{2})\), up to an exponentially small term.
The bias shrinks as the data size n grows, and it scales with the coefficient c2. The mechanism is that the first stump's expected value on a training example differs from its value on a test example, which is the prediction shift again. This is the argument for ordering the residuals inside the boosting loop, which the next section describes.
How ordered boosting runs in CatBoost
Ordered boosting gives each example a residual from a model that never saw its target, by keeping a supporting model for each prefix of a permutation. Training one model per example would multiply complexity and memory by n, so it's infeasible in most practical tasks. CatBoost applies a modified version of this idea to decision trees, in the mode it calls Ordered.
At the start, CatBoost draws s + 1 random permutations: the first s choose tree structures, and one more sets the leaf values. Each new tree is built from one permutation chosen at random, and that permutation also fixes the target statistics for the tree. Split candidates are scored by the cosine similarity between a gradient estimate built from earlier examples and the full gradient vector.
Each example's leaf value averages the gradients of earlier examples that fall in the same leaf.
After the tree structure is chosen, it is added to every supporting model, with leaf values that differ from model to model. To save memory, the implementation keeps predictions only at powers-of-two prefixes, which brings storage down to order \(sn\). Feature combinations are built greedily from features already used in the current tree and converted to target statistics on the fly.
Subsampling uses Bayesian bootstrap weights on the gradients, and the authors say subsampling alone can't remove the shift.
Results against LightGBM and XGBoost
The authors compare CatBoost in Ordered mode with LightGBM and XGBoost on nine datasets, tuning on 4/5 of the data and testing on the remaining 1/5. Epsilon is the exception, because its runs used default parameters and only the number of trees was tuned. On Adult, CatBoost scored 0.270 logloss and 0.127 zero-one loss, and LightGBM was 2.4% higher in logloss.
On Amazon the gap is wider: CatBoost reached 0.139 logloss, and both baselines were 17% higher.
The gaps are small on Appetency, Churn and Upselling, where the baselines stay within 0.5% in logloss. The authors report that the improvements are statistically significant under a paired one-tailed t-test with p-values well below 0.01, except on Appetency, Churn and Upselling. So the wins are clearest where the gaps are large, and on the three small-gap datasets the evidence for a difference is weaker.
Plain versus Ordered mode
Plain mode follows the standard GBDT loop with ordered target statistics, so comparing the two modes isolates the boosting scheme. Plain mode's logloss is 1.1% higher than Ordered mode on Adult and 3.9% higher on Internet. On Amazon it is 0.6% lower, so Plain mode isn't uniformly worse. The largest benefit appears on Adult and Internet, both of which have fewer than 40K training examples.
The authors link this to bias, expecting it to grow on smaller datasets, and they present that link as their hypothesis. To test it, they trained both modes on randomly filtered datasets, and Plain mode fell further behind as the data shrank. The cost is time: on Epsilon, Ordered mode ran about 1.7 times slower than Plain mode.
Which target statistic works best inside Ordered mode
The authors keep Ordered mode fixed and swap only the target statistic. Greedy TS raises logloss by 40% on Amazon and by 33% on Internet, relative to Ordered TS. Leave-one-out is usually better than greedy, but it reaches +5.5% on Adult. The authors explain the Adult result by noting that all Adult features have high frequency, and leave-one-out suffers on high-frequency categories.
Holdout TS is the best of the baseline statistics on most datasets, because it avoids the conditional shift. It still trails Ordered TS, for example by 2.1% on Adult in logloss, because it uses less of the data. The authors report a similar pattern when the same statistics are combined with Plain mode.
Feature combinations and permutation count
Allowing combinations of up to two categorical features improves logloss by 1.86% on average, and the best dataset reaches 11.3%. Raising the limit to three gives 2.04% on average, and larger limits don't change the result much.
Increasing the number of permutations s helps only slightly, with logloss 0.19% lower at s = 3 and 0.38% lower at s = 9, both relative to s = 1. The authors present these numbers as averages across datasets.
Limitations
Exact ordered boosting needs n separate models, which is why CatBoost uses the cheaper Ordered mode. Subsampling alone, as in Friedman's approach, cannot fully avoid prediction shift, according to the authors. The Ordered advantage is tied to dataset size in their tests, and they describe the bias explanation as a hypothesis.
The comparison uses nine datasets and only LightGBM and XGBoost as baselines. Epsilon used default parameters rather than tuning, and the Table 2 CatBoost numbers may differ slightly from the public repository. Ordered mode didn't reach statistical significance on Appetency, Churn and Upselling. It also remains about 1.7 times slower than Plain mode on Epsilon.
Paper info
- Authors
- Liudmila Prokhorenkova, Gleb Gusev, Aleksandr Vorobev, Anna Veronika Dorogush, Andrey Gulin
- Venue
- arXiv · Preprint
- First published
- 2017-6-28
- Added
- 2026-11-12
- Updated
- 2019-1-20
- Version
- v5
- arXiv
- 1706.09516
- Category
- cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Liudmila Prokhorenkova, Gleb Gusev, Aleksandr Vorobev, Anna Veronika Dorogush, Andrey Gulin (2017). CatBoost: unbiased boosting with categorical features. arXiv:1706.09516v5. https://arxiv.org/abs/1706.09516v5
BibTeX
@misc{prokhorenkova2017catboost,
title = {{CatBoost: unbiased boosting with categorical features}},
author = {Liudmila Prokhorenkova and Gleb Gusev and Aleksandr Vorobev and Anna Veronika Dorogush and Andrey Gulin},
year = {2017},
eprint = {1706.09516},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1706.09516v5}
}