XGBoost, LightGBM and CatBoost are the three gradient boosting libraries most data scientists reach for when they work with tabular data. They share the same core idea, but they build trees differently, treat categorical features differently, and trade speed for accuracy in different ways. To settle XGBoost vs LightGBM vs CatBoost without marketing claims, we ran all three on the same data, with the same settings, and measured what happened.
This guide gives you our benchmark results, the code to reproduce them, a plain-English explanation of how each library works, and a simple way to decide which one to use.
Quick answer
- Lots of categorical columns (cities, product IDs, customer segments)? Use CatBoost. It was the most accurate model in every one of our categorical runs.
- Mostly numeric data, and you want fast experiments? Use LightGBM. It trained fastest in both of our tests, with accuracy equal to the others on numeric data.
- You need the most mature ecosystem (Spark, Dask, SageMaker, wide tutorial coverage) or very predictable behavior? Use XGBoost. It was never the slowest and never far behind on numeric data.
- Fast predictions in production? CatBoost’s symmetric trees gave the quickest predictions on numeric data in our test.
Our benchmark: how we tested
We wanted a fair, repeatable comparison rather than a single lucky run. The full script is at the end of this article so you can run it on your own machine or swap in your own dataset.
- Data: 200,000 rows for binary classification, generated so it can be reproduced exactly. We split it into 140,000 rows for training, 20,000 for early stopping and 40,000 for testing.
- Scenario 1, categorical-heavy: 20 numeric features plus 4 categorical features with 10, 100, 1,000 and 5,000 categories each. The category frequencies are skewed, like real-world IDs or city names.
- Scenario 2, numeric-only: the same 20 numeric features with no categorical columns.
- Same settings for all three: learning rate 0.05, up to 1,000 trees and early stopping after 50 rounds without improvement. Tree depth was set to 6, or 63 leaves for LightGBM, which grows trees differently.
- Native categorical handling: each library used its own built-in method. We did no manual one-hot or target encoding.
- Three random seeds per scenario. Each seed generates a different dataset, and the tables show the average.
- Environment: 2 CPU cores, Python 3.13, XGBoost 3.4.1, LightGBM 4.7.0 and CatBoost 1.2.10, run in November 2026.
XGBoost vs LightGBM vs CatBoost: benchmark results
Scenario 1: data with categorical features
| Library | Test AUC | Accuracy | Training time | Prediction time (40,000 rows) | Trees used |
|---|---|---|---|---|---|
| CatBoost | 0.900 | 83.3% | 87.1 s | 0.27 s | 901 |
| LightGBM | 0.892 | 82.7% | 7.5 s | 0.55 s | 191 |
| XGBoost | 0.884 | 81.9% | 11.6 s | 0.29 s | 272 |
The ranking was the same in all three runs: CatBoost was most accurate, then LightGBM, then XGBoost. CatBoost beat XGBoost by between 0.008 and 0.025 AUC, and LightGBM beat XGBoost by between 0.005 and 0.012. AUC differs a lot between seeds because each seed creates a different dataset, so the gap within each run is the number that matters.
That accuracy came at a cost. CatBoost took about 11 times longer to train than LightGBM. Part of that is because it kept improving and used around 900 trees before early stopping, compared with about 200 for LightGBM. It also spends time computing its ordered category statistics, which are explained below.
Scenario 2: numeric features only
| Library | Test AUC | Training time | Prediction time (40,000 rows) |
|---|---|---|---|
| CatBoost | 0.873 | 8.3 s | 0.015 s |
| LightGBM | 0.871 | 3.1 s | 0.35 s |
| XGBoost | 0.871 | 3.7 s | 0.08 s |
With numeric data only, the accuracy gap disappears: all three landed within 0.003 AUC of each other in every run. The differences that remain are about speed. LightGBM trained fastest, XGBoost was about 20% slower, and CatBoost was about 2.7 times slower. For predictions the order flips. CatBoost scored 40,000 rows in 15 milliseconds, more than 5 times faster than XGBoost.
Training time, categorical scenario (seconds, lower is better)
What the results mean, and their limits
- Categorical features decide the accuracy contest. When the signal sits in high-cardinality categories, CatBoost’s encoding pays off. When it doesn’t, the three are effectively tied.
- Speed differences are real but modest between LightGBM and XGBoost. We measured 1.2 to 1.6 times, not the “10x” or “20x” figures that are often repeated online. Modern XGBoost uses the same histogram-based approach by default.
- Your data will behave differently. These are synthetic datasets on a 2-core machine. Larger machines, GPUs and real data with noise, missing values or text will change the numbers. Run the script below on a sample of your own data before you commit.
How XGBoost, LightGBM and CatBoost actually differ
All three are implementations of gradient boosting: they add decision trees one at a time, and each new tree corrects the errors of the trees before it. The differences are in how each library grows trees, finds splits and handles categories.
| XGBoost | LightGBM | CatBoost | |
|---|---|---|---|
| Created by | Tianqi Chen, now the DMLC community (first released 2014) | Microsoft (open-sourced 2016) | Yandex (open-sourced 2017) |
| Tree growth | Level-wise (depth-wise) by default | Leaf-wise: splits the leaf with the biggest gain | Symmetric (oblivious) trees: the same split across a whole level |
| Categorical features | Native support with enable_categorical=True (hist method) | Native support via categorical_feature | Native support with ordered target statistics, its main strength |
| Missing values | Handled automatically (learns a default direction) | Handled automatically | Handled automatically |
| Speed tricks | Histogram binning, multithreading | Histogram binning, GOSS sampling, Exclusive Feature Bundling | Symmetric trees make prediction very fast |
| Main overfitting risk | Deep trees with many rounds | Too many leaves on small datasets | Lowest out of the box; ordered boosting reduces target leakage |
| GPU training | Yes | Yes | Yes |
| Text features | No (encode first) | No (encode first) | Yes, built-in text processing |
XGBoost: the reliable standard
XGBoost made gradient boosting fast and popular, largely through Kaggle competitions after its 2014 release. It grows trees level by level, which keeps them balanced and makes its behavior easy to predict. It applies L1 and L2 regularization directly to leaf weights. Since version 2.0 it uses the fast histogram method by default, which is why the speed gap with LightGBM has narrowed. Its biggest advantage today is the ecosystem: it integrates with Spark, Dask, Ray, SageMaker and most MLOps tools, and almost every problem you hit has a documented answer.
LightGBM: built for speed
LightGBM grows trees leaf-wise. Instead of filling a whole level, it always splits the single leaf that reduces the loss most. That usually reaches a given accuracy with fewer trees, which is why it used about 190 trees in our test compared with 270 for XGBoost. Two extra techniques reduce the work further:
- GOSS (Gradient-based One-Side Sampling) keeps the rows with large errors and samples the rest.
- EFB (Exclusive Feature Bundling) merges sparse features that are rarely non-zero at the same time.
The trade-off is that leaf-wise trees can become very deep and overfit small datasets. If you have fewer than about 10,000 rows, limit num_leaves and raise min_child_samples.
CatBoost: best with categories, least tuning
CatBoost converts each category into a number using ordered target statistics: the average target value for that category, calculated only from rows that came earlier in a random ordering. This avoids the target leakage you get with naive target encoding, where a row’s own label leaks into its feature. CatBoost applies the same idea to boosting itself (“ordered boosting”). Its symmetric trees use one split condition per level, so a prediction is a short series of comparisons, which is why prediction was so fast in our test. It also tends to work well with default settings, making it a good choice when you don’t have time to tune.
XGBoost vs LightGBM vs CatBoost: which should you choose?
| Your situation | Best first choice | Why |
|---|---|---|
| Many categorical columns, especially high-cardinality ones | CatBoost | Most accurate in all our categorical runs, with no encoding work |
| Large numeric dataset, many experiments to run | LightGBM | Fastest training with equal accuracy on numeric data |
| Small dataset (under about 10,000 rows) | CatBoost or XGBoost | Less prone to overfitting than leaf-wise LightGBM with default settings |
| Low-latency predictions in production | CatBoost | Symmetric trees gave the fastest predictions |
| Distributed training on Spark or Dask, or strict MLOps tooling | XGBoost | Most mature integrations and documentation |
| Text columns alongside tabular data | CatBoost | Built-in text features |
| Kaggle-style competition | All three | Averaging the predictions of all three models is usually better than any one |
Hyperparameter cheat sheet: the same settings in all three libraries
The libraries use different names for the same ideas, which makes switching between them confusing. This table maps the parameters that matter most, using each library’s scikit-learn-style API, with sensible starting values.
| What it controls | XGBoost | LightGBM | CatBoost | Good starting value |
|---|---|---|---|---|
| Step size | learning_rate | learning_rate | learning_rate | 0.03 to 0.1 |
| Maximum number of trees | n_estimators | n_estimators | iterations | 1,000 to 2,000 with early stopping |
| Tree size | max_depth | num_leaves (and max_depth) | depth | 6 / 31 to 127 leaves / 6 to 8 |
| Minimum data per leaf | min_child_weight | min_child_samples | min_data_in_leaf (only with grow_policy Depthwise or Lossguide) | 1 to 5 / 20+ / leave at default |
| L2 regularization | reg_lambda | reg_lambda | l2_leaf_reg | 1 to 10 / 0 to 5 / 3 |
| Row sampling | subsample | subsample + subsample_freq=1 | subsample | 0.7 to 0.9 |
| Column sampling | colsample_bytree | colsample_bytree | rsm (CPU only) | 0.7 to 0.9 |
| Early stopping | early_stopping_rounds | lgb.early_stopping() callback | early_stopping_rounds | 50 to 100 |
A practical tuning order: fix the learning rate at 0.05, let early stopping choose the number of trees, then tune tree size, then sampling, then regularization. Lower the learning rate only at the end, for the final model.
Common mistakes when comparing boosting libraries
- Using a fixed number of trees. Without early stopping, you compare under-trained and over-trained models. Always pass a validation set.
- One-hot encoding before CatBoost. This throws away CatBoost’s main advantage. Pass the raw category columns through
cat_features. - Manual target encoding on the full training set. Each row’s own label leaks into its feature, so validation scores look better than real-world results. Use out-of-fold encoding, or let CatBoost do it.
- Comparing at different learning rates. A model with a learning rate of 0.3 will train faster and score worse than one with 0.05. Keep the learning rate the same across libraries.
- Trusting a single run. Small AUC differences can come from the random split. Use several seeds or cross-validation, as we did here.
Clean data matters more than which library you pick. If your dataset still has duplicates, inconsistent categories or unhandled outliers, start with our guide on how to clean and preprocess data using Python.
Reproduce the benchmark
Install the libraries with pip install xgboost lightgbm catboost scikit-learn pandas. This is the core of the test, showing how each library is trained with its native categorical handling:
import xgboost as xgb, lightgbm as lgb, catboost as cb
# X_train / X_val: pandas DataFrames; categorical columns use dtype "category"
cat_cols = ["cat_10", "cat_100", "cat_1000", "cat_5000"]
xgb_model = xgb.XGBClassifier(
n_estimators=1000, learning_rate=0.05, max_depth=6,
tree_method="hist", enable_categorical=True,
early_stopping_rounds=50, eval_metric="logloss")
xgb_model.fit(X_train, y_train, eval_set=[(X_val, y_val)], verbose=False)
lgb_model = lgb.LGBMClassifier(
n_estimators=1000, learning_rate=0.05, num_leaves=63, verbose=-1)
lgb_model.fit(X_train, y_train, eval_set=[(X_val, y_val)],
categorical_feature=cat_cols,
callbacks=[lgb.early_stopping(50, verbose=False)])
cb_model = cb.CatBoostClassifier(
iterations=1000, learning_rate=0.05, depth=6,
cat_features=cat_cols, early_stopping_rounds=50, verbose=False)
cb_model.fit(X_train_str, y_train, eval_set=(X_val_str, y_val)) # categories as stringsShow the full benchmark script
Save this as benchmark.py and run python benchmark.py 1 2 3. For the numeric-only scenario, set CARDS = [] and remove the categorical_feature and cat_features arguments.
"""
XGBoost vs LightGBM vs CatBoost benchmark (Pulse Data Hub).
Reproducible synthetic binary-classification dataset:
- 200,000 rows
- 20 numeric features (sklearn make_classification, 10 informative)
- 4 categorical features with cardinality 10, 100, 1,000 and 5,000,
each carrying its own target signal (category-level effects)
Every library uses its NATIVE categorical handling, the same number of
trees (1,000), learning rate (0.05) and early stopping on a validation set.
Run 3 seeds; report mean +/- std.
"""
import time, json, sys, platform
import numpy as np, pandas as pd
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score, accuracy_score, log_loss
import xgboost as xgb, lightgbm as lgb, catboost as cb
N_ROWS = 200_000
CARDS = [10, 100, 1_000, 5_000]
def make_data(seed):
rng = np.random.default_rng(seed)
X, _ = make_classification(n_samples=N_ROWS, n_features=20, n_informative=10,
n_redundant=4, random_state=seed)
df = pd.DataFrame(X, columns=[f"num_{i}" for i in range(20)])
# numeric part of the logit
w = rng.normal(0, 1, 20) * (np.arange(20) < 10)
logit = X @ w * 0.35
for j, card in enumerate(CARDS):
# skewed category frequencies (Zipf-like), like real IDs/cities/products
p = 1.0 / np.arange(1, card + 1) ** 0.8
p /= p.sum()
codes = rng.choice(card, size=N_ROWS, p=p)
effect = rng.normal(0, 0.8, card)
logit += effect[codes]
df[f"cat_{card}"] = pd.Categorical(codes.astype(str))
y = (rng.random(N_ROWS) < 1 / (1 + np.exp(-logit))).astype(int)
return df, y
def run(seed):
df, y = make_data(seed)
Xtr, Xte, ytr, yte = train_test_split(df, y, test_size=0.2, random_state=seed, stratify=y)
Xtr, Xva, ytr, yva = train_test_split(Xtr, ytr, test_size=0.125, random_state=seed, stratify=ytr)
cat_cols = [c for c in df.columns if c.startswith("cat_")]
res = {}
# XGBoost (hist + native categorical)
m = xgb.XGBClassifier(n_estimators=1000, learning_rate=0.05, max_depth=6,
tree_method="hist", enable_categorical=True, max_cat_to_onehot=1,
early_stopping_rounds=50, eval_metric="logloss",
n_jobs=-1, random_state=seed)
t = time.perf_counter(); m.fit(Xtr, ytr, eval_set=[(Xva, yva)], verbose=False); tt = time.perf_counter() - t
t = time.perf_counter(); pr = m.predict_proba(Xte)[:, 1]; pt = time.perf_counter() - t
res["XGBoost"] = dict(train_s=tt, predict_s=pt, trees=m.best_iteration + 1, pred=pr)
# LightGBM (native categorical)
m = lgb.LGBMClassifier(n_estimators=1000, learning_rate=0.05, num_leaves=63,
n_jobs=-1, random_state=seed, verbose=-1)
t = time.perf_counter()
m.fit(Xtr, ytr, eval_set=[(Xva, yva)], categorical_feature=cat_cols,
callbacks=[lgb.early_stopping(50, verbose=False)])
tt = time.perf_counter() - t
t = time.perf_counter(); pr = m.predict_proba(Xte)[:, 1]; pt = time.perf_counter() - t
res["LightGBM"] = dict(train_s=tt, predict_s=pt, trees=m.best_iteration_, pred=pr)
# CatBoost (ordered target statistics for categoricals)
to_str = lambda d: d.assign(**{c: d[c].astype(str) for c in cat_cols})
m = cb.CatBoostClassifier(iterations=1000, learning_rate=0.05, depth=6,
cat_features=cat_cols, early_stopping_rounds=50,
thread_count=-1, random_seed=seed, verbose=False)
t = time.perf_counter(); m.fit(to_str(Xtr), ytr, eval_set=(to_str(Xva), yva)); tt = time.perf_counter() - t
Xte_s = to_str(Xte)
t = time.perf_counter(); pr = m.predict_proba(Xte_s)[:, 1]; pt = time.perf_counter() - t
res["CatBoost"] = dict(train_s=tt, predict_s=pt, trees=m.get_best_iteration() + 1, pred=pr)
out = {}
for k, v in res.items():
p = v.pop("pred")
out[k] = dict(v, auc=roc_auc_score(yte, p), acc=accuracy_score(yte, p > 0.5),
logloss=log_loss(yte, p))
return out
if __name__ == "__main__":
seeds = [int(s) for s in sys.argv[1:]] or [1, 2, 3]
allr = {s: run(s) for s in seeds}
rows = []
for s, r in allr.items():
for lib, m in r.items():
rows.append(dict(seed=s, library=lib, **m))
df = pd.DataFrame(rows)
df.to_csv("results_raw.csv", index=False)
summ = df.groupby("library").agg(["mean", "std"]).drop(columns="seed")
print(summ.round(4).to_string())
env = dict(python=platform.python_version(), xgboost=xgb.__version__,
lightgbm=lgb.__version__, catboost=cb.__version__, cpus=__import__("os").cpu_count())
json.dump(env, open("env.json", "w"))
print(env)
Keep learning
- Gradient Boosting Machines (GBM) explained: the theory behind all three libraries
- AdaBoost (Adaptive Boosting): the algorithm that started boosting
- How to build a machine learning model: the full workflow from data to deployment
- Naive Bayes: a fast baseline worth comparing against
Each library’s official documentation lists every parameter mentioned in this guide: XGBoost, LightGBM and CatBoost.
FAQ
Is CatBoost better than XGBoost?
On data with many categorical features, often yes. In our benchmark it beat XGBoost by 0.008 to 0.025 AUC in every run. On purely numeric data the two were effectively tied, and XGBoost trained more than twice as fast.
Is LightGBM faster than XGBoost?
Yes, but by less than many articles claim. We measured 1.2 to 1.6 times faster training. Modern XGBoost uses the same histogram approach by default, which closed most of the gap.
Do XGBoost and LightGBM support categorical features?
Yes. XGBoost supports them with enable_categorical=True and pandas category columns, and LightGBM through the categorical_feature parameter. CatBoost’s method is different and usually stronger for high-cardinality categories.
Which is best for beginners?
CatBoost needs the least tuning and no categorical encoding, so it gives good results quickly. XGBoost has the most tutorials and answered questions, which makes it easier to learn from.
Can I use all three together?
Yes. Averaging the predicted probabilities of all three models, or stacking them, often scores higher than any single model, because each makes slightly different errors.
