lignum
pip install pylignumlignum's predictions equal LightGBM's on every row; lleaves differs on 55-100% of them. Diabetes 130-US and synthetic-cat have categorical features with hundreds to thousands of values.
| Data set | lignum (compiled) | lleaves | TL2cgen |
|---|---|---|---|
| California housing | 11.1× | 7.5× | 1.8× |
| Covertype | 23.8× | 17.0× | 1.1× |
| Adult | 13.1× | 9.1× | 1.9× |
| Bank marketing | 13.3× | 10.8× | 2.0× |
| Diabetes 130-US | 12.4× | 2.2× | 0.3× |
| synthetic | 8.4× | 6.1× | 1.2× |
| synthetic-cat | 10.4× | 1.3× | 0.3× |
| Data set | lignum (interpreter) | lignum (compiled) | lleaves |
|---|---|---|---|
| California housing | 5.2× | 5.0× | 2.3× |
| Covertype | 3.9× | 2.5× | 1.9× |
| Adult | 4.8× | 5.8× | 3.6× |
| Bank marketing | 4.7× | 5.8× | 3.5× |
| Diabetes 130-US | 4.7× | 6.2× | 1.1× |
| synthetic | 5.4× | 5.1× | 3.3× |
| synthetic-cat | 3.8× | 6.3× | 1.0× |
On an Apple M4 lignum is 2.3-2.7× faster; on single rows from a DataFrame 7-27× (up to 216× with high-cardinality categories).
| Data set | lignum |
|---|---|
| California housing | 1.2× |
| Covertype | 3.0× |
| Adult | 1.8× |
| Bank marketing | 1.7× |
| Diabetes 130-US | 1.8× |
| synthetic | 1.1× |
| synthetic-cat | 1.5× |
Exact
Raw scores and probabilities equal the library’s predict bit for bit: NaN and zero-as-missing, categorical splits, XGBoost’s float32 arithmetic and CatBoost’s CTRs included. What the notebook showed is what production returns.
Fast to predict
A binned interpreter for any batch size, and a compiled mode that turns LightGBM and XGBoost trees into native code in a few seconds for 500 trees. autotune picks the faster one for your data.
CatBoost with categories
Categorical features, one-hot and CTRs with their combinations, straight from strings in pandas, Arrow or plain lists. No preprocessing, no compilation.
Fast to start
model.save(“model.bin”) writes a file that maps into memory in well under a millisecond; compiled trees ship next to it, so production needs no compiler.
Arrow in, no copies
predict reads pyarrow, polars and any Arrow PyCapsule data directly. C and C++ services pass Arrow record batches through the C API.
Small and portable
One C++20 library with no dependencies beyond simdjson and OpenMP. Wheels for Linux, macOS and Windows on x86-64 and ARM.