← back to the showcase

TAKT showcase: LightGBM 4.7.0, drop-in with bit-identical output, model analyses up to 18× faster

The numbers below are measured. The free package is on PyPI (pip install lightgbm-takt); the full version is a commercial licence (see "Availability"). This directory holds the measurement scripts and every reading.

Not affiliated with LightGBM. TAKT is not affiliated with or endorsed by the LightGBM project or Microsoft. The name LightGBM is used only to identify the software we measured and build on.

LightGBM (MIT) is one of the most widely used gradient-boosting libraries; its Python package (lightgbm) wraps the C library lib_lightgbm.so.

TAKT builds LightGBM 4.7.0 so that analyses that call predict many times — permutation importance, partial dependence and ICE curves, MDA feature importance across cross-validation folds, what-if scenario sweeps — and batch prediction run several times faster, with every prediction identical to the official build, bit for bit, on the same machine. The Python package and the public API are unchanged (import lightgbm); only the library is replaced. No code changes: sklearn.inspection.permutation_importance, partial_dependence, PartialDependenceDisplay and shap.PermutationExplainer get the speed-up as they are.

Headline

Factors over the official LightGBM 4.7.0 wheel, by user-mode cycles:u with 95% bootstrap CIs, whole process (interpreter start, imports, data loading, the analysis), one core unless noted. The output was identical in every single run. "Free" is the free package lightgbm-takt 4.7.0.post1; its readings with LightGBM on several threads are in "Several LightGBM threads" below.

Workload Free, Zen 3 Free, Zen 4 Full, Zen 3 Full, Zen 4
Permutation importance, quant features (Alpha158), classifier 3.67× (3.60–3.75) 3.40× (3.36–3.48) 16.75× (16.14–16.96) 18.35× (17.34–18.71)
Partial dependence + ICE, the same model, 20 features 4.23× (4.20–4.36) 3.84× (3.79–3.90) 16.77× (16.57–16.93) 18.31× (18.06–18.71)
Permutation importance, OpenML kick (categorical, missing values) 3.71× (3.65–3.74) 3.81× (3.70–3.93) 12.97× (12.85–13.08) 14.64× (14.09–15.23)
Permutation importance, synthetic data (50 features, numpy) 5.04× (5.01–5.09) 4.93× (4.84–5.01) — —
What-if scenarios, kick model, 30 scenarios 2.88× (2.85–2.89) 3.08× (3.02–3.15) — —
MDA importance across 5 cross-validation folds (fitting included) 2.96× (2.95–2.98) 2.98× (2.95–3.02) 6.10× (6.05–6.14) 5.92× (5.79–6.01)
Partial dependence + ICE, California housing regressor 1.71× (1.69–1.77) 1.53× (1.45–1.62) 5.43× (5.37–5.48) 4.77× (4.70–4.87)
shap.PermutationExplainer, California housing 1.00× (0.99–1.02) 1.02× (1.00–1.04) 3.23× (3.16–3.27) 3.23× (3.18–3.29)
shap.PermutationExplainer, quant features — — 3.35× (3.29–3.39) 4.00× (3.94–4.09)
One batch predict_proba, quant features, whole process 1.00× (0.99–1.01) 1.01× (0.98–1.03) 2.12× (2.09–2.14) 2.45× (2.40–2.49)
One batch predict_proba, kick, whole process 0.99× (0.98–1.00) 1.00× (0.98–1.01) 1.59× (1.58–1.59) 1.73× (1.72–1.81)
C API batch prediction, one thread 1.01× (1.00–1.04) 1.01× (0.98–1.04) 4.12× (4.10–4.22) 5.38× (5.25–5.48)
C API batch prediction, all pinned cores 1.01× (0.98–1.02) 1.01× (1.00–1.05) 4.03× (3.99–4.06) 5.32× (5.13–5.42)

"Free" is measured on models of up to 300 trees (the free package's limit), "full" on the larger models of the same kind (500 and 1,000 trees; the MDA workload fits 300-tree models in both). In the free columns, the rows not in bold are outside the free package's scope and run LightGBM's own code, at the official speed within a few percent; the free package's "all pinned cores" row is LightGBM's default thread count (7 CPUs on Zen 3, 4 cores on Zen 4). For the multi-threaded C API row, the full version's wall-time factors are lower than the cycle factors (2.29× on Zen 3 with 4 threads, 3.48× on Zen 4 with 2 threads): the threads' total CPU time falls more than the elapsed time. Every wall-time factor is in the tables below.

Free package vs full version

Free (pip install lightgbm-takt) Full version (commercial licence)
Repeated-call analyses (permutation importance, PDP/ICE, MDA, what-if) accelerated, models up to 300 trees; the accelerated part runs on one thread and, with several LightGBM threads, only where that is faster than LightGBM's own threads accelerated, any model size, several threads
Batch prediction (predict, predict_proba, leaf indices) LightGBM's own code, normal speed accelerated: through the C API 4.0–5.4× in CPU time (2.3–4.4× elapsed), leaf indices 2.8–4.1× (1.5–2.4×); a whole Python process 1.6–2.5×
shap.PermutationExplainer LightGBM's own code, normal speed accelerated (3.2–4.0×)
Models with more than 300 trees LightGBM's own code, normal speed accelerated
Everything else in LightGBM (training, SHAP values, every parameter) LightGBM's own code, full functionality LightGBM's own code, full functionality
Output identical to the official wheel yes, everywhere yes, everywhere
Python wheel (Linux x86-64, glibc 2.27+) yes yes
C/C++ library (lib_lightgbm.so, same exports) — yes
Other platforms / LightGBM versions — on request
Support, source escrow — yes

Several LightGBM threads (free package)

LightGBM predicts on several threads when asked to, and its scikit-learn API does so by default. The free package's accelerated part runs on one thread; with several LightGBM threads it is used only where it is faster than LightGBM's own multi-threaded code, and LightGBM's code runs everywhere else. Elapsed-time factors of the free package over the official wheel (95% CI), whole process; "LightGBM default" is 7 threads on Zen 3 (the process may use 7 CPUs) and 4 on Zen 4 (4 cores), and 8 threads oversubscribe both. The output was identical in every run.

AMD Zen 3

Workload 4 threads 8 threads LightGBM default
Permutation importance, synthetic data, numpy (note_numpy) 1.39× (1.37–1.40) 1.23× (1.23–1.25) 1.09× (1.07–1.11)
The same, pandas DataFrame (note_pandas) 1.38× (1.37–1.40) 1.29× (1.27–1.32) 1.11× (1.04–1.15)
Permutation importance, quant features (pi_alpha300) 1.04× (1.02–1.07) 1.01× (0.98–1.02) 1.00× (0.97–1.04)
Partial dependence + ICE, quant features (pdp_alpha300) 1.04× (1.01–1.05) 0.99× (0.96–1.06) 1.00× (0.99–1.02)
Permutation importance, kick (pi_kick300) 1.66× (1.65–1.67) 1.48× (1.44–1.50) 1.28× (1.27–1.29)
What-if scenarios, kick (whatif_kick300) 1.08× (1.07–1.09) 1.00× (0.98–1.01) 1.03× (1.02–1.03)
MDA across 5 folds (mda_kick) 1.35× (1.33–1.39) 1.22× (1.20–1.23) 1.10× (1.09–1.11)
Partial dependence + ICE, California housing (pdp_cal300) 1.02× (1.01–1.04) 1.01× (0.97–1.02) 1.01× (0.98–1.03)
One batch predict_proba, quant features (predict_alpha300) 1.00× (1.00–1.04) 1.00× (0.97–1.02) 1.00× (1.00–1.03)
One batch predict_proba, kick (predict_kick300) 1.00× (0.99–1.01) 1.00× (0.99–1.01) 1.00× (0.99–1.01)
shap.PermutationExplainer, California housing (shap_cal300) 1.01× (1.00–1.02) 0.99× (0.98–1.00) 1.01× (0.99–1.02)
Cycle of 6 same-shape matrices (worst_cycle6_300) 1.00× (0.99–1.02) 0.99× (0.98–1.02) 1.00× (0.99–1.01)
2,000-feature model with a sweep (worst_wide2000) 1.01× (0.98–1.02) 0.99× (0.98–1.02) 0.99× (0.99–1.00)
10-tree model on 400,000 rows (worst_tiny10) 1.00× (0.99–1.01) 1.01× (0.98–1.04) 1.00× (0.99–1.02)
Permutation importance, 500-tree model (pi_kick) 1.00× (0.99–1.01) 1.02× (0.99–1.03) 1.00× (0.97–1.02)
Permutation importance, 1,000-tree model (pi_alpha) 1.00× (0.99–1.02) 1.00× (0.98–1.00) 1.01× (0.97–1.04)
C API batch prediction (cblock_alpha300) 1.02× (0.99–1.06) 0.98× (0.97–1.01) 1.01× (0.98–1.03)

AMD Zen 4

Workload 4 threads 8 threads LightGBM default
Permutation importance, synthetic data, numpy (note_numpy) 1.35× (1.33–1.37) 1.33× (1.31–1.36) 1.40× (1.37–1.42)
The same, pandas DataFrame (note_pandas) 1.43× (1.39–1.73) 1.36× (1.34–1.38) 1.42× (1.36–1.44)
Permutation importance, quant features (pi_alpha300) 0.99× (0.95–1.11) 1.02× (0.93–1.06) 1.03× (0.94–1.11)
Partial dependence + ICE, quant features (pdp_alpha300) 1.00× (0.95–1.05) 1.12× (1.06–1.16) 1.03× (0.95–1.06)
Permutation importance, kick (pi_kick300) 1.71× (1.68–1.76) 1.58× (1.53–1.61) 1.69× (1.66–1.71)
What-if scenarios, kick (whatif_kick300) 1.10× (1.06–1.12) 1.01× (0.99–1.02) 1.09× (1.06–1.10)
MDA across 5 folds (mda_kick) 1.39× (1.37–1.40) 1.30× (1.30–1.31) 1.36× (1.35–1.39)
Partial dependence + ICE, California housing (pdp_cal300) 1.05× (0.94–1.11) 1.03× (1.00–1.04) 1.03× (0.99–1.05)
One batch predict_proba, quant features (predict_alpha300) 0.99× (0.97–1.01) 1.04× (0.97–1.07) 1.00× (0.97–1.06)
One batch predict_proba, kick (predict_kick300) 1.00× (0.98–1.02) 0.99× (0.97–1.01) 1.00× (0.98–1.02)
shap.PermutationExplainer, California housing (shap_cal300) 1.00× (0.97–1.04) 1.01× (1.01–1.04) 1.00× (0.94–1.03)
Cycle of 6 same-shape matrices (worst_cycle6_300) 1.03× (0.96–1.07) 1.00× (0.99–1.02) 0.98× (0.95–1.02)
2,000-feature model with a sweep (worst_wide2000) 1.00× (0.91–1.14) 1.00× (0.98–1.02) 1.00× (0.97–1.02)
10-tree model on 400,000 rows (worst_tiny10) 1.00× (0.95–1.03) 0.98× (0.91–1.13) 0.98× (0.92–1.00)
Permutation importance, 500-tree model (pi_kick) 0.98× (0.95–1.02) 1.01× (1.00–1.03) 1.02× (0.98–1.03)
Permutation importance, 1,000-tree model (pi_alpha) 1.00× (0.98–1.05) 1.02× (1.01–1.03) 1.01× (0.99–1.08)
C API batch prediction (cblock_alpha300) 1.03× (0.90–1.12) 1.01× (0.94–1.09) 1.03× (1.01–1.11)

With worker processes instead of LightGBM's threads (permutation_importance(n_jobs=<all CPUs>), LightGBM on one thread per worker, note_workers), the free package's factor is 1.29× (1.21–1.31) on Zen 3 and 1.28× (1.21–1.43) on Zen 4. The readings (results/free/zen3/t4, t8, tdefault, and the same for zen4) also hold the previous release, 4.7.0, for comparison.

What changed in 4.7.0.post1

What was measured

Python workloads (tools/wl.py, tools/worst.py) run with the official wheel and with the TAKT wheel; a C driver (tools/lgbm_block.c) calls LGBM_BoosterPredictForMat with the library swapped through LD_LIBRARY_PATH. Every workload prints every result with 17 significant digits (or the SHA-256 of the raw doubles for large arrays), so a byte compare of the output is a bit compare.

Workload What runs
pi_alpha, pi_alpha300 permutation_importance (neg_log_loss, 3 repeats) on 5,000 rows: a classifier with 1,000 / 300 trees of 63 leaves on 158 Alpha158-style features (qlib formulas) of Binance 5-minute klines (5 pairs), float32 (tools/features_alpha158.py)
pdp_alpha, pdp_alpha300 partial_dependence(kind="both", grid_resolution=50) for 20 features of the same models
pi_kick, pi_kick300 permutation_importance (roc_auc, 5 repeats) on 8,000 rows of OpenML "kick" (32 features, 18 categorical, 6% missing), pandas input, LGBMClassifier 500 / 300 trees
whatif_kick300 30 what-if scenarios on the kick model (two numeric columns changed in each), predict_proba on 8,000 rows each
mda_kick MDA per cross-validation fold: KFold(5) on 40,000 kick rows, each fold fits LGBMClassifier(300 trees) and runs permutation_importance on its test fold (the fitting is LightGBM's own code in both)
pdp_cal, pdp_cal300 partial_dependence(kind="both", grid_resolution=50), California housing LGBMRegressor 500 / 300 trees, all 8 features
shap_alpha, shap_cal, shap_cal300 shap.PermutationExplainer with an independent masker (100 / 200 background rows)
note_numpy, note_pandas, note_workers permutation_importance (roc_auc, 5 repeats) on 10,000 rows × 50 features of synthetic data (make_classification), LGBMClassifier 300 trees of 63 leaves, numpy or pandas input (tools/pinote.py; the workload of the note Why LightGBM permutation importance is slow); note_workers: permutation_importance(n_jobs=<all CPUs>) with LightGBM on one thread per worker
predict_* one predict_proba on 50,000 (quant) / 18,246 (kick) rows, whole Python process
cblock_* C driver: load the model, one LGBM_BoosterPredictForMat (normal or leaf indices); _t1 one thread, _t4 / _t2 all pinned cores (4 on Zen 3, 2 on Zen 4)
worst_* patterns that could cost: 1,500 single-row calls, 300 calls of 16 rows, 40 batches of new shapes, a cycle of 6 different same-shape matrices (1,000 and 300 trees), a 10-tree model on 400,000 rows, a 2,000-feature model with a sweep

All Python workloads run single-threaded (n_jobs=1), as in these functions' defaults, unless noted. The thread readings set LightGBM's thread count with LGB_NJOBS=<n> or LGB_NJOBS=default (the estimator's n_jobs, or num_threads for worst_*; the C driver takes it as an argument).

Stands. AMD Threadripper PRO 5975WX (Zen 3), Ubuntu 24.04, glibc 2.39; AMD Ryzen 9 7950X3D (Zen 4), Debian 13, glibc 2.41. Python 3.12, numpy 2.5.4, scipy 1.18.1, scikit-learn 1.9.1, pandas 3.0.6, shap 0.53.0 on both. Each run pinned to one core (the harness too), or, with several LightGBM threads, to 7 CPUs on 7 different cores (Zen 3) and 4 cores (Zen 4); takt-harness 0.2.1, interleaved rounds (5 for the long workloads, 9 after a warm-up for the short ones), 95% bootstrap CIs. The harness compared stdout across the builds in every run. Raw readings: results/free/zen3 and results/free/zen4 (subdirectories t1, t4, t8, tdefault by LightGBM thread count; the free package 4.7.0.post1 as takt-free, the previous release 4.7.0 as takt-free-4.7.0), results/full/zen3, results/full/zen4 (.json bundles and .log summaries; paths in them are relative to the measurement directory).

Free package — AMD Zen 3

LightGBM on one thread, one core. The thread readings are in "Several LightGBM threads" above.

Workload official wall TAKT wall cycles:u factor (95% CI) wall factor (95% CI) Output identical
pi_alpha300 24.14 s 6.718 s 3.67× (3.60–3.75) 3.59× (3.51–3.67) yes
pdp_alpha300 42.97 s 10.39 s 4.23× (4.20–4.36) 4.14× (4.08–4.32) yes
pi_kick300 38.67 s 10.61 s 3.71× (3.65–3.74) 3.65× (3.61–3.68) yes
note_numpy 60.23 s 12.08 s 5.04× (5.01–5.09) 4.99× (4.91–5.03) yes
note_pandas 60.55 s 12.18 s 5.02× (4.99–5.06) 4.97× (4.94–5.01) yes
whatif_kick300 8.369 s 3.037 s 2.88× (2.85–2.89) 2.75× (2.73–2.76) yes
mda_kick 111.9 s 38.07 s 2.96× (2.95–2.98) 2.94× (2.91–2.96) yes
pdp_cal300 25.61 s 15.02 s 1.71× (1.69–1.77) 1.71× (1.68–1.76) yes
predict_alpha300 1.517 s 1.507 s 1.00× (0.99–1.01) 1.01× (0.94–1.02) yes
predict_kick300 1.794 s 1.826 s 0.99× (0.98–1.00) 0.98× (0.95–1.01) yes
shap_cal300 5.429 s 5.442 s 1.00× (0.99–1.02) 1.00× (0.96–1.02) yes
pi_kick 64.33 s 63.27 s 1.02× (1.00–1.03) 1.02× (0.99–1.03) yes
pi_alpha 82.37 s 80.89 s 1.01× (1.00–1.03) 1.02× (0.98–1.04) yes
worst_cycle6_300 1.856 s 1.858 s 1.00× (0.99–1.01) 1.00× (0.99–1.01) yes
worst_wide2000 2.173 s 1.617 s 1.49× (1.47–1.49) 1.34× (1.33–1.36) yes
worst_tiny10 1.143 s 1.126 s 1.01× (0.99–1.07) 1.01× (0.98–1.08) yes
cblock_alpha300 501.0 ms 498.8 ms 1.01× (1.00–1.04) 1.00× (0.99–1.04) yes

Free package — AMD Zen 4

LightGBM on one thread, one core. The thread readings are in "Several LightGBM threads" above.

Workload official wall TAKT wall cycles:u factor (95% CI) wall factor (95% CI) Output identical
pi_alpha300 18.37 s 5.783 s 3.40× (3.36–3.48) 3.18× (3.12–3.22) yes
pdp_alpha300 31.74 s 8.752 s 3.84× (3.79–3.90) 3.63× (3.59–3.69) yes
pi_kick300 32.03 s 8.868 s 3.81× (3.70–3.93) 3.61× (3.52–3.71) yes
note_numpy 46.80 s 10.00 s 4.93× (4.84–5.01) 4.68× (4.60–4.74) yes
note_pandas 46.87 s 9.984 s 4.90× (4.81–4.98) 4.69× (4.61–4.76) yes
whatif_kick300 7.209 s 2.765 s 3.08× (3.02–3.15) 2.61× (2.57–2.69) yes
mda_kick 91.62 s 31.30 s 2.98× (2.95–3.02) 2.93× (2.90–2.96) yes
pdp_cal300 16.92 s 11.33 s 1.53× (1.45–1.62) 1.49× (1.39–1.59) yes
predict_alpha300 1.530 s 1.521 s 1.01× (0.98–1.03) 1.01× (0.97–1.04) yes
predict_kick300 1.797 s 1.815 s 1.00× (0.98–1.01) 0.99× (0.98–1.02) yes
shap_cal300 3.750 s 3.682 s 1.02× (1.00–1.04) 1.02× (1.00–1.03) yes
pi_kick 58.11 s 57.94 s 1.00× (1.00–1.02) 1.00× (1.00–1.02) yes
pi_alpha 70.01 s 68.55 s 1.02× (1.01–1.03) 1.02× (1.01–1.03) yes
worst_cycle6_300 1.774 s 1.749 s 1.02× (1.01–1.04) 1.01× (0.99–1.05) yes
worst_wide2000 2.123 s 1.664 s 1.52× (1.51–1.54) 1.28× (1.26–1.35) yes
worst_tiny10 1.193 s 1.208 s 1.00× (0.92–1.01) 0.99× (0.94–1.03) yes
cblock_alpha300 384.1 ms 371.5 ms 1.01× (0.98–1.04) 1.03× (0.96–1.13) yes

Full version — AMD Zen 3

Workload official wall TAKT wall cycles:u factor (95% CI) wall factor (95% CI) Output identical
pi_alpha 82.44 s 5.274 s 16.75× (16.14–16.96) 15.63× (15.02–16.22) yes
pdp_alpha 146.9 s 8.972 s 16.77× (16.57–16.93) 16.38× (16.14–16.55) yes
pi_kick 63.41 s 5.098 s 12.97× (12.85–13.08) 12.44× (12.35–12.54) yes
mda_kick 113.1 s 18.75 s 6.10× (6.05–6.14) 6.03× (5.86–6.08) yes
pdp_cal 45.75 s 8.592 s 5.43× (5.37–5.48) 5.33× (5.26–5.38) yes
shap_alpha 8.800 s 2.919 s 3.35× (3.29–3.39) 3.02× (2.98–3.06) yes
shap_cal 8.375 s 2.755 s 3.23× (3.16–3.27) 3.04× (2.99–3.09) yes
predict_alpha 2.679 s 1.405 s 2.12× (2.09–2.14) 1.91× (1.88–1.93) yes
predict_kick 2.116 s 1.417 s 1.59× (1.58–1.59) 1.49× (1.48–1.50) yes
cblock_alpha_normal_t1 1.694 s 472.1 ms 4.12× (4.10–4.22) 3.59× (3.52–3.63) yes
cblock_alpha_leaf_t1 1.696 s 759.0 ms 3.02× (2.97–3.04) 2.23× (2.20–2.26) yes
cblock_kick_normal_t1 857.7 ms 216.4 ms 4.36× (4.26–4.37) 3.96× (3.88–4.03) yes
cblock_alpha_normal_t4 477.3 ms 208.6 ms 4.03× (3.99–4.06) 2.29× (2.23–2.33) yes
cblock_alpha_leaf_t4 549.2 ms 367.2 ms 2.76× (2.75–2.80) 1.50× (1.49–1.53) yes
cblock_kick_normal_t4 244.9 ms 98.05 ms 4.05× (4.03–4.08) 2.50× (2.38–2.52) yes
worst_rows1 1.034 s 1.041 s 1.00× (0.99–1.01) 0.99× (0.99–1.01) yes
worst_rows16 1.101 s 1.042 s 1.07× (1.07–1.08) 1.06× (1.04–1.06) yes
worst_newshapes 4.217 s 1.394 s 3.40× (3.31–3.42) 3.03× (2.98–3.07) yes
worst_cycle6 4.214 s 1.419 s 3.32× (3.30–3.35) 2.97× (2.94–3.00) yes
worst_tiny10 1.121 s 1.096 s 1.05× (1.05–1.07) 1.02× (1.01–1.03) yes
worst_wide2000 2.153 s 1.471 s 1.61× (1.60–1.62) 1.46× (1.45–1.48) yes

Full version — AMD Zen 4

Workload official wall TAKT wall cycles:u factor (95% CI) wall factor (95% CI) Output identical
pi_alpha 71.21 s 4.521 s 18.35× (17.34–18.71) 15.75× (15.21–16.19) yes
pdp_alpha 127.5 s 7.625 s 18.31× (18.06–18.71) 16.73× (16.54–17.09) yes
pi_kick 58.31 s 4.596 s 14.64× (14.09–15.23) 12.69× (12.27–13.11) yes
mda_kick 92.06 s 16.28 s 5.92× (5.79–6.01) 5.66× (5.53–5.73) yes
pdp_cal 32.67 s 7.412 s 4.77× (4.70–4.87) 4.41× (4.34–4.52) yes
shap_alpha 7.297 s 2.415 s 4.00× (3.94–4.09) 3.02× (3.00–3.10) yes
shap_cal 6.235 s 2.345 s 3.23× (3.18–3.29) 2.66× (2.57–2.71) yes
predict_alpha 2.638 s 1.460 s 2.45× (2.40–2.49) 1.81× (1.77–1.84) yes
predict_kick 2.181 s 1.500 s 1.73× (1.72–1.81) 1.45× (1.42–1.48) yes
cblock_alpha_normal_t1 1.488 s 342.4 ms 5.38× (5.25–5.48) 4.35× (4.17–4.41) yes
cblock_alpha_leaf_t1 1.589 s 652.1 ms 4.09× (4.02–4.22) 2.44× (2.40–2.48) yes
cblock_kick_normal_t1 801.6 ms 181.5 ms 4.87× (4.67–4.90) 4.42× (4.27–4.47) yes
cblock_alpha_normal_t2 787.4 ms 226.0 ms 5.32× (5.13–5.42) 3.48× (3.31–3.60) yes
cblock_alpha_leaf_t2 920.3 ms 477.5 ms 3.92× (3.75–4.03) 1.93× (1.85–2.00) yes
cblock_kick_normal_t2 424.5 ms 113.4 ms 4.75× (4.67–4.80) 3.74× (3.62–3.81) yes
worst_rows1 1.153 s 1.153 s 1.00× (0.98–1.03) 1.00× (0.97–1.03) yes
worst_rows16 1.207 s 1.158 s 1.07× (1.05–1.09) 1.04× (1.00–1.09) yes
worst_newshapes 4.048 s 1.469 s 3.66× (3.64–3.71) 2.75× (2.69–2.78) yes
worst_cycle6 4.031 s 1.429 s 3.98× (3.92–4.03) 2.82× (2.71–2.87) yes
worst_tiny10 1.230 s 1.179 s 1.06× (1.05–1.09) 1.04× (1.00–1.09) yes
worst_wide2000 2.159 s 1.516 s 1.75× (1.72–1.79) 1.42× (1.39–1.49) yes

Equivalence

"Same" means byte-identical output, every number at 17 significant digits.

Bit-identity is per system. The TAKT build reproduces the official build's output on the same system, bit for bit. Results that pass through the system maths library (for example probabilities) depend on it, so compare on the same machine.

Where the speed-up applies, and where it does not

LightGBM's own concurrency limits. In LightGBM 4.7.0, with the official library: concurrent predictions on one booster with different start_iteration/num_iteration (LightGBM issue #6142), concurrent calls with different num_threads, and changing a booster (training, set_leaf_output, refit) while another thread predicts with it can crash or return wrong values. Code that avoids these patterns runs the same with TAKT. The parts of TAKT that run LightGBM's own code keep this behaviour; the full version's accelerated calls take the iteration range from each call (a 16-thread test of the first pattern that crashes the official library gave 0 differences with them).

Availability

Reproducing the baseline

# The verify script: a 300-tree model on synthetic data, permutation importance and a PDP, compared bytewise.
python -m venv a && a/bin/pip install -q lightgbm==4.7.0 scikit-learn && a/bin/python tools/verify.py > a.txt
python -m venv c && c/bin/pip install -q lightgbm-takt scikit-learn  && c/bin/python tools/verify.py > c.txt
diff a.txt c.txt && echo identical

# The workloads: prepare the models once (official wheel), then run any workload with each wheel.
python tools/wl.py prep .        # the kick and California models (500 trees)
python tools/wl.py prep_free .   # the 300-tree models (the quant model needs the quant data, see below)
python tools/wl.py pi_kick300 . > out.txt
LGB_NJOBS=default python tools/wl.py pi_kick300 . > out.txt   # the same with LightGBM's default threads
python pi_cost.py prep note && python tools/pinote.py . numpy default > out.txt   # the note's workload (pi_cost.py: the note's script)

The kick and California housing workloads download their data themselves (OpenML, scikit-learn). The quant-feature workloads (*_alpha*) read features computed with tools/features_alpha158.py from Binance 5-minute klines of five pairs, and the trained model files; these data files are not in this directory (on request). tools/table.py and tools/pubtable.py print the one-thread tables above from the readings in results/, and tools/thr_table.py the thread tables.

Contents

Source text: README-post1.md

Telegram