SmallGBM
Gradient boosting for small tabular data.
C backend · Outperforms XGBoost · Beats LightGBM · 2–3× faster training
What is SmallGBM?
SmallGBM is a gradient boosting library designed for small datasets (n < 1000). It combines robust leaf weight estimation with stochastic split selection to outperform XGBoost and LightGBM — with lower variance, no hyperparameter tuning, and a native C core.
New in 1.5.0: the decision tree is now implemented in C (histogram-based split search, 256 quantile bins) and called from Python via ctypes. Same algorithm, 2–3× faster training and ~2× faster inference compared to the pure-Python 1.4.x line.
Benchmark
22 datasets (15 synthetic + 7 real-world) · 5-fold cross-validation · mean ROC-AUC · same default hyperparameters for all models
| Model | AUC | Fit (ms) | Predict (ms) |
|---|---|---|---|
| SmallGBM | 0.9101 | 13.4 | 0.29 |
| XGBoost | 0.9036 | 36.5 | 0.46 |
| RandomForest | 0.9007 | 28.8 | 1.57 |
| LightGBM | 0.8958 | 34.3 | 0.57 |
SmallGBM outperforms XGBoost by +0.65%, RandomForest by +0.94%, LightGBM by +1.43% — while training 2.7× faster and predicting 1.6–5× faster.
Why Robust Leaf Weights?
Standard gradient boosting uses the mean of residuals per leaf. On small data, one outlier can destroy the estimate.
SmallGBM uses:
- Median for leaves with n ≤ 30
- Inverse-distance weighted mean for larger leaves
- Signal-adaptive shrinkage toward the parent node
This makes predictions robust to outliers and label noise — the main enemies of small-sample learning.
Why Stochastic Split Selection?
Full enumeration of all possible split thresholds overfits on small data. SmallGBM uses 5 random thresholds per feature (via the histogram) — less overfitting, faster training, and better generalization.
Architecture
smallgbm/ ├── smallgbm.py # boosting logic (classifier + regressor) ├── tree.py # ctypes wrapper around libtree └── _c/ ├── tree.c # histogram-based decision tree in C └── tree.h
The C library is compiled automatically on pip install. On macOS it produces libtree.dylib, on Linux libtree.so, on Windows tree.dll. No manual compilation needed.
Installation
pip install smallgbm
Requires a C compiler (cc, clang, or gcc) available on PATH. On macOS install Xcode Command Line Tools (xcode-select --install).
Quickstart
from smallgbm import SmallGBMClassifier
model = SmallGBMClassifier()
model.fit(X_train, y_train)
proba = model.predict_proba(X_test)
Parameters
| Parameter | Default | Description |
|---|---|---|
n_estimators |
50 | Boosting rounds |
max_depth |
3 | Max tree depth |
min_samples_leaf |
3 | Min samples per leaf |
learning_rate |
0.1 | Shrinkage |
sigma_prior |
0.5 | Regularization strength |
colsample_bytree |
0.5 | Feature fraction per tree |
random_state |
None | Reproducibility |
auto_scale |
False | RobustScaler internally |
Features
- C core — histogram-based tree with 256 quantile bins per feature
- Robust leaf weights — median + adaptive shrinkage
- Stochastic split selection — 5 random thresholds per feature
- Column subsampling — fights overfitting in high-dimensional small data
- Uncertainty estimates —
predict_with_uncertainty() - scikit-learn compatible —
fit,predict,predict_proba - Auto-compiled on install — no separate build step
Reproducing the benchmark
# from the repository root
clang -O3 -march=native -flto -shared -fPIC smallgbm/_c/tree.c \
-o smallgbm/_c/libtree.dylib -lm
python -m Tests.test
Citation
@software{emelyanov2026smallgbm,
author = {Emelyanov, Ilya},
title = {SmallGBM: Gradient Boosting with Robust Leaf Regularization for Small-Sample Tabular Data},
year = {2026},
doi = {10.5281/zenodo.21934674},
url = {https://github.com/nsdmlk/SmallGBM}
}
License
MIT © Emelyanov Ilya, 2026
Metadata
Release files for smallgbm 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smallgbm-1.5.0.tar.gz | 22.4 kB | Without provenance | Details for smallgbm-1.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smallgbm-1.5.0-py3-none-any.whl | Python 3 | none | any | Details for smallgbm-1.5.0-py3-none-any.whl |
Total release size: 40.2 kB
Release files / smallgbm-1.5.0.tar.gz
| Download URL | smallgbm-1.5.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
561fd5bbd4cd8921d8df957bd36badae0594265e289deb9bbeb8c07d1afc7f0b
|
|
BLAKE2b-256 checksum How to use checksums |
b3e9ecbf1d28e8110ac7b25cc76ef55727ec7d464bc066e4744f1a710a1e21a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0a5
|
Release files / smallgbm-1.5.0-py3-none-any.whl
| Download URL | smallgbm-1.5.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
918dccfe6cb5e165ce8085e8407856581d831e525f62bc2acae2882994c229d6
|
|
BLAKE2b-256 checksum How to use checksums |
a7ee6fe7bc0aaca583925e35ea0ac3102b9da1142f17c4b8a98ff38ef4a60e50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0a5
|
Security for smallgbm 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.