hessboost 0.1.1
hessboost is a pure-Rust reimplementation of XGBoost gradient boosting: no C/C++ dependency and no FFI. Objective, metric, and parameter names mirror XGBoost, so configurations carry over directly.
This is the first supported release; 0.1.0 is yanked.
[dependencies]
hessboost = "0.1.1"use hessboost::prelude::*;
let dtrain = DMatrix::from_dense(&x, n_rows, n_cols)?.with_labels(&y)?;
let params = TrainingParams::builder()
.objective("binary:logistic")
.max_depth(6)
.eta(0.1)
.build()?;
let model = train(¶ms, &dtrain, 100)?;
let probabilities = model.predict(&dtrain)?;Features
- Boosters:
gbtree,dart, andgblinear. - Tree construction:
exact,hist, andapproxtree methods;depthwiseandlossguidegrowth; sparsity-aware missing values; row and column subsampling (bytree,bylevel,bynode). - Objectives:
reg:squarederror(aliasreg:linear),reg:logistic,reg:pseudohubererror,reg:gamma,reg:tweedie,count:poisson,binary:logistic,multi:softmax,multi:softprob,rank:pairwise,rank:ndcg,rank:map, plus custom objectives (train_with_objective). Intercepts are estimated per output the same way XGBoost 3.4.1 does. - Metrics:
rmse,mae,logloss,error,auc,aucpr,mlogloss,merror,ndcg,map(with@k),poisson-nloglik,gamma-nloglik,tweedie-nloglik, plus custom metrics (train_with_custom_metric). - Modeling: monotone and interaction constraints (in both
histandexact), native categorical splits, per-rowbase_margin, early stopping, k-foldcv, feature importance (weight, gain, cover, and totals), and leaf-index prediction. - Explainability: TreeSHAP contributions (
predict_contribs) and interaction values (predict_interactions). - I/O: libsvm and CSV loaders; native binary and JSON models; XGBoost JSON model import and export for numeric
gbtreeensembles.
Performance
Runtime-detected SIMD kernels (NEON on AArch64; AVX2/FMA and SSE2 on x86-64) handle gradients, prediction transforms, metrics, and quantile binning. Histogram training runs in parallel with rayon. Other CPUs, and inputs outside the vector paths, use scalar code.
Against XGBoost 3.4.1 on an Apple M3 Max (CPU hist, 100 rounds, depth 6, 256 bins), hessboost had a lower median fit time in all 12 measured configurations:
| Threads | Speedup |
|---|---|
| 1 | 2.28–2.77× |
| 4 | 1.82–2.20× |
| 16 | 1.37–1.63× |
Held-out quality matches XGBoost closely. See docs/performance.md for the workloads, method, and kernel benchmarks.
XGBoost parity
CI checks every commit against real XGBoost 3.4.1 using 37 fixture cases that cover each objective, the tree methods, missing values, constraints, weights, ranking groups, categorical splits, DART, and gblinear. Each case is checked three ways:
- Train: same data and parameters, comparing predictions.
- Import: load the XGBoost model and compare predictions, margins, and SHAP contributions.
- Export: XGBoost reloads the model hessboost wrote.
Deterministic cases must agree pointwise (1e-4 to 1e-5). Subsampling and DART cases use an accuracy band, because the two libraries' random number generators differ. Histogram and approximate quantile cuts match XGBoost bit for bit.
API notes
use hessboost::prelude::*brings in the full training and prediction API. The crate root exports only modules; everything else is reached through its module (for example,hessboost::tree::RegTreeandhessboost::data::load_csv).train_with_objectivetakes&dyn Objective.- Every fallible call returns
hessboost::prelude::Result(HessboostError). - Identical parameters, data, and seed give identical predictions.
Requirements
- Rust 1.93 or newer (edition 2024).
- CI tests on x86_64 Linux, aarch64 Linux, and aarch64 macOS.
Not implemented
UBJSON (binary) XGBoost models, XGBoost JSON for gblinear models, GPU training, distributed or external-memory training, and Python/CLI/C-ABI bindings.
Caveats
The code was generated with Claude (Anthropic) under human direction and review. It has unit, property, and doc tests, and CI checks parity with XGBoost, but it may still contain bugs or numerical edge cases. Validate it for your use case.
hessboost is a fork of sequoia-boost (Copyright 2026 Patrick Garrett, Apache-2.0). It is an independent reimplementation of XGBoost (Copyright the XGBoost Contributors, Apache-2.0) and is not affiliated with or endorsed by the XGBoost project. Licensed under Apache-2.0.