Skip to main content

Lightweight gradient boosting for Apple Silicon with an MPS/Metal backend

Project description

MPSBoost

PyPI Python

MPSBoost is an early-stage gradient boosting project for Apple Silicon. Its current accelerated backend uses custom Metal compute kernels for squared-error gradients and two-stage histogram construction while keeping one deterministic tree-building implementation shared with the CPU oracle.

Development status: 0.2.0 is the first stable 0.x MPS histogram engine release. It supports dense numeric regression with a real MPS training path, split-scan and partition kernels, histogram subtraction, buffer reuse, explicit cache management, and documented performance boundaries.

Installation

python -m pip install mpsboost

Accelerated releases provide prebuilt Apple Silicon wheels; normal users will not need a heavyweight framework, package manager, CMake, or a local Metal shader compiler.

Estimator-style API

import mpsboost as mps

model = mps.MPSBoostRegressor(
    n_estimators=200,
    learning_rate=0.05,
    max_depth=6,
    device="mps",
)

model.fit(X_train, y_train)
prediction = model.predict(X_test)
model.save_model("model.mpsb")

restored = mps.MPSBoostRegressor(device="mps")
restored.load_model("model.mpsb")

Backend diagnostics

The native backend exposes non-sensitive device and cache diagnostics:

import mpsboost as mps

print(mps.__version__)
print(mps.is_available())
print(mps.system_info())
print(mps.cache_info())

cache_info() only reports paths and existence; it does not create directories. create_cache() explicitly creates the L2 cache directories, and clear_cache() safely removes the MPSBoost cache root after rejecting dangerous targets such as the filesystem root, the user home directory, or symlinks. Cache deletion never changes model results.

Project principles

  • Familiar XGBoost/scikit-learn-style Python entry points.
  • device="mps" as the stable user-facing Apple GPU backend name.
  • Custom Metal kernels for tree-specific irregular computation.
  • Prebuilt wheels and no heavyweight Python runtime dependency.
  • Explicit errors instead of silent CPU fallback.
  • End-to-end benchmarks, including preprocessing and synchronization.

Status

The public API currently includes MPSBoostRegressor, cache diagnostics and management helpers, is_available, system_info, and __version__. Training supports dense finite float32/float64-compatible data, squared error, deterministic quantization, depth-limited histogram trees, model save/load, and explicit device="mps" or diagnostic device="cpu" selection.

The checked-in S6 benchmark records both regressions and wins. On the M2 Ultra validation machine, small end-to-end training remains slower on MPS, while the gbdt-large-wide scenario reached a 1.629x median speedup with maximum prediction difference around 5.4e-6 versus the CPU oracle.

Classification, missing values, sparse matrices, categorical features, sampling, early stopping, public GPU prediction, and full third-party API compatibility are not implemented in this milestone. Small datasets are expected to be slower on the GPU because fixed device setup and synchronization costs dominate; the checked-in benchmark report preserves this regression region alongside larger wins.

Release audits

The 0.2.0 release gate includes:

  • CPU, packaging, integration, and real Metal GPU tests on Python 3.10 and 3.13.
  • Wheel content checks excluding specs, tests, caches, and build artifacts.
  • Dynamic-link checks for the native extension.
  • Apache-2.0 project licensing and runtime dependency review.
  • Fresh PyPI installation and real MPS smoke validation.

Independence notice

MPSBoost is an independent open-source project. It is not affiliated with, endorsed by, or sponsored by Apple Inc., the XGBoost project, or the scikit-learn project. Apple, Metal, and Metal Performance Shaders may be trademarks of Apple Inc.

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mpsboost-0.2.0-cp313-cp313-macosx_13_0_arm64.whl (203.8 kB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

mpsboost-0.2.0-cp310-cp310-macosx_13_0_arm64.whl (199.5 kB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

Details for the file mpsboost-0.2.0-cp313-cp313-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for mpsboost-0.2.0-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 37fb79b9d83c57edb3b45785316b56923cd85efbf6ce9d66c94dd469bdd715d1
MD5 7c8c9aa12d9e966b7d84422473a054fe
BLAKE2b-256 7a0634661668fb001774c2101e1e7659369c313fe0f76d8c601da83669c08926

See more details on using hashes here.

File details

Details for the file mpsboost-0.2.0-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for mpsboost-0.2.0-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 f351e419c908f7f68fc1c7b5b9309650ecdc6f976f40679f11055c03c373a428
MD5 5b189d8cb19eb576160a4b94ead3a7d7
BLAKE2b-256 a2f6d8146de2b1b8729d77cace9a07d533c36db84c08c2d3bbf7f978adade942

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page