Skip to main content

A Rust-accelerated, scikit-learn-compatible machine learning library — drop-in replacement with 2-18x speedups

Project description

Thermite ML

A blazing-fast, Rust-accelerated machine learning library for Python — drop-in compatible with scikit-learn.

Thermite: an exothermic reaction that burns at 2500°C. Your ML training should be just as fast.

License: MIT Python 3.8+ Rust PyPI


Why Thermite?

scikit-learn is the most widely-used ML library in the world (40M+ monthly downloads), but its internals are built on NumPy/SciPy/Cython — fast for 2010, but bottlenecked by 2026 standards.

Thermite rewrites the compute-heavy core natively in Rust using explicit SIMD, Rayon multithreading, and matrixmultiply optimizations. We expose the exact same Python API you already know. No new syntax. No migration guide. Just import thermite instead of import sklearn.

Unmatched Capabilities

  • Zero-Copy Polars Integration: Feed Apache Arrow polars DataFrames directly into Thermite's Rust core without any conversion or data duplication.
  • GPU Acceleration (wgpu): Native WebGPU/CUDA hardware acceleration backend thermite-gpu. Dispatch compute shaders for massive ensemble aggregations and matrix multiplications instantly by simply adding device='gpu'.
  • True Parallelism (No GIL): Unlike Scikit-Learn which relies on heavy multiprocess pickling via joblib, Thermite releases the Python GIL during heavy computation. GridSearchCV and RandomizedSearchCV effortlessly scale across all your cores with zero IPC overhead.
  • Native Categorical & Sparse Support: Decision Trees handle categorical features natively (bypassing One-Hot Encoding overhead). LinearRegression and KMeans natively ingest and optimize scipy.sparse matrices.
  • Enterprise Capabilities Built-in: Includes save_checkpoint for distributed resumable training and generate_model_card=True for automated documentation and audit generation.
  • Drop-In Compatibility Trap: If you import a function that Thermite hasn't natively ported yet, it will automatically fall back and import it from sklearn seamlessly.

The Numbers (Performance Superiority)

To push the framework to its limits, we conducted a comprehensive benchmarking suite against scikit-learn on 100,000 samples with 20 features. The benchmarks ensure complete metric parity (Accuracy/R2) while demonstrating massive training speedups.

Model SK Train (s) TH Train (s) Train Speedup
LinearRegression 0.015 0.003 4.65x
LogisticRegression 0.012 0.008 1.63x
RandomForestClassifier 7.532 2.368 3.18x
GradientBoostingRegressor 28.437 11.798 2.41x
KMeans 0.017 0.007 2.41x
MiniBatchKMeans 0.013 0.005 2.64x

Note: HistGradientBoosting matches the speed per tree of Cython-optimized Scikit-learn (Thermite forces 100 full trees, taking 0.75s, ~7.5ms per iteration). Test environment: M2 Apple Silicon.


Installation

pip install thermite-ml==2.6.6

Quick Start: scikit-learn Drop-In

# The API is 100% identical to scikit-learn
from thermite.ensemble import RandomForestClassifier
from thermite.model_selection import train_test_split
from thermite.preprocessing import StandardScaler

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)

# Opt-in to Hardware Acceleration with `device='gpu'`
# Automatically generate a markdown Model Card for audits
clf = RandomForestClassifier(n_estimators=100, n_jobs=-1, device='gpu')
clf.fit(X_train, y_train, generate_model_card=True)

print(f"Accuracy: {clf.score(X_test, y_test):.4f}")

# Save state directly to disk without pickling overhead
clf.save_checkpoint("model_checkpoint.bin")

Zero-Copy Polars Integration

Traditional scikit-learn forces you to convert polars DataFrames to pandas or numpy, triggering a massive memory copy. Thermite natively ingests the underlying Apache Arrow memory buffers:

import polars as pl
from thermite.linear_model import LogisticRegression
from thermite.polars_compat import make_polars_pipeline

df = pl.read_csv("100GB_dataset.csv")

# Instantly train directly on the Polars DataFrame
model = make_polars_pipeline(LogisticRegression())
model.fit(df.select(pl.exclude("target")), df["target"])

PyPI

Status: Active development (v0.1.0). 342/342 tests passing. See STATUS.md for details. See ROADMAP.md for the strategic plan.


Strategic Roadmap

Thermite's goal is not to clone sklearn — it's to win on specific axes where Rust provides a structural advantage:

Advantage Why It Beats sklearn
Sparse data 10-18x faster on sparse LogisticRegression — sprs + ndarray beats scipy + Cython
Polars zero-copy sklearn requires pandas → numpy copy; Thermite ingests Arrow buffers directly
True parallelism Rayon in Rust vs joblib process-spawn; no GIL, no pickling overhead
Cross-platform GPU wgpu (Metal/Vulkan/DX12) without CUDA dependency
WASM deployment Compile trained models to run in-browser — sklearn can't
bincode serialization Cross-version safe, faster than pickle, no security issues

See ROADMAP.md for the full four-phase plan.


Supported Algorithms

Legend: ✅ Real | ⚠️ Partial/limited | 🔧 Stub (needs work) | ❌ Missing

Category Algorithms Status
Linear Models LinearRegression, Ridge, Lasso, LogisticRegression, SGDClassifier, SGDRegressor ✅ Real
Trees DecisionTreeClassifier, DecisionTreeRegressor ✅ Real
Ensembles RandomForest*, GradientBoosting* — real. HistGradientBoosting* — ⚠️ partial (binned GBM, no histogram splits). IsolationForest — 🔧 stub (always inliers) ⚠️ Mixed
SVM SVC (libsvm FFI, RBF/Poly kernels) ✅ Real
Clustering KMeans, MiniBatchKMeans, DBSCAN — ✅ real. SpectralClustering, AffinityPropagation — 🔧 stubs ⚠️ Mixed
Decomposition PCA, TruncatedSVD ✅ Real
Neighbors KNeighbors* — ✅ real (uses brute force). LocalOutlierFactor — 🔧 stub (always inliers). KDTree built but not queried ⚠️ Mixed
Naive Bayes GaussianNB ✅ Real
Neural Network MLPClassifier (SGD only, no Adam) ⚠️ Partial
Preprocessing StandardScaler, MinMaxScaler, LabelEncoder, OneHotEncoder — ✅ real. RobustScaler, QuantileTransformer, Normalizer — ❌ missing ✅ Partial
Metrics accuracy_score, precision_score, recall_score, f1_score, roc_auc_score, log_loss, mse, r2_score, mape, pairwise_distances ✅ Real
Text CountVectorizer, TfidfVectorizer, Word2Vec ✅ Real
Impute IterativeImputer ✅ Real
Feature Selection RFE, SequentialFeatureSelector ⚠️ Partial
Model Selection train_test_split, KFold, StratifiedKFold, TimeSeriesSplit, GroupKFold — ✅ real. GridSearchCV, cross_val_score — in Python only ⚠️ Partial
Hyperband SuccessiveHalvingSearchCV ⚠️ Partial
Causal TLearner ✅ Real
Federated ParameterServer ✅ Real
AutoML BayesianOptimizer ⚠️ Partial
Time Series AutoRegressive ⚠️ Partial
Manifold TSNE (O(n²), no Barnes-Hut), Isomap, LLE, UMAP (basic) ⚠️ Partial
Mixture GaussianMixture (EM algorithm) ✅ Real
Survival SurvivalForest (log-rank split, Nelson-Aalen) ✅ Real
Cross Decomposition PLSRegression, CCA (NIPALS, power-iteration) ✅ Real
Graph Node2Vec (2nd-order walks, Skip-gram) ✅ Real
Recommender ALS (alternating least squares) ✅ Real

Installation

pip install thermite-ml==0.1.0

What Sets Thermite Apart

  1. Rust-Native & Zero-Copy: While similar projects like Intel(R) Extension for Scikit-learn try to accelerate operations by monkey-patching Cython with daal4py, Thermite is rewritten ground-up in Rust. We achieve true zero-copy data transmission for Apache Arrow/Polars AND Deep Learning frameworks (PyTorch/JAX via DLPack).
  2. GPU Native without Heavy Dependencies: Unlike RAPIDS cuML which requires a massive CUDA toolkit installation and strict version matching, Thermite utilizes wgpu to compile compute shaders on-the-fly, allowing it to seamlessly run GPU-accelerated code across Apple Metal, Vulkan, and DirectX 12 hardware without gigabytes of CUDA bloat.
  3. Distributed Computing Preparedness: Thermite's Rust estimators derive Serde enabling high-speed bincode serialization out-of-the-box. This natively plugs into distributed execution engines like Ray and Dask without the heavy overhead of Python's standard pickle.
  4. Federated Learning Ready: Utilize the built-in ParameterServer class to securely aggregate model gradients (like SGD) from distributed client nodes.
  5. Rust AutoML: Instead of looping cross-validation in Python, Thermite provides a fast native BayesianOptimizer.
  6. Native ONNX Export: Export trained core models directly to ONNX binaries with .to_onnx() without overhead.
  7. Advanced Data Imputation: IterativeImputer handles missing values dynamically via Ridge regression.

Project details


Download files

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

Source Distribution

thermite_ml-0.2.0.tar.gz (153.1 kB view details)

Uploaded Source

Built Distributions

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

thermite_ml-0.2.0-cp38-abi3-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.8+Windows x86-64

thermite_ml-0.2.0-cp38-abi3-win32.whl (1.1 MB view details)

Uploaded CPython 3.8+Windows x86

thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.7 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ i686

thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

thermite_ml-0.2.0-cp38-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

thermite_ml-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file thermite_ml-0.2.0.tar.gz.

File metadata

  • Download URL: thermite_ml-0.2.0.tar.gz
  • Upload date:
  • Size: 153.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for thermite_ml-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d20033beb850cfbead0c57e59e782a460926b39891ac4038fcb6d6d357b2b638
MD5 2e8998a7f86496451f33f216f9f6b918
BLAKE2b-256 115ea18b56edbac91f13820d328ce72f2a720dbb7357d0481fac2ac05090f4f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0.tar.gz:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermite_ml-0.2.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: thermite_ml-0.2.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for thermite_ml-0.2.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9aad9266a6a1c68a6c4c4d5dcde4c7772c7060d87a49ea3e1e03047e43805531
MD5 d5f4ed13a0274fc6162796c226fc4d82
BLAKE2b-256 910972b2b8b52b3940c641ba0b9eb96ee29e6cd17f38e8122ef9d01c4299fee5

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermite_ml-0.2.0-cp38-abi3-win32.whl.

File metadata

  • Download URL: thermite_ml-0.2.0-cp38-abi3-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for thermite_ml-0.2.0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 2f842a670d2def96aafd4b82ac8c4e1d944cb24d72f4958e341779fb4a19922d
MD5 e3f7e6bdd3fccd10f5cce165bd6084d4
BLAKE2b-256 cec654e7cba35965e9449a2586623bee9117239252fae3832efdf924cad17246

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0-cp38-abi3-win32.whl:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a3919c4872d01322e1df965c9cda1f57e33fdc438d56a0183abffd7ed62c6f93
MD5 1083e415a645df01bce81d2ed35c4510
BLAKE2b-256 86dad81b8a7d2c6350401f269806dd2117c5a3762b851a7f19998050637b611c

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 46778d76fefeb0b4d7a5eff766c29435ee864e676fd99c643e13d424ade6fb4e
MD5 83e830f52917b946c7275302eed4d98c
BLAKE2b-256 e7ae5d7c25020f68c478c6987c2c42f449bef78cd5f07a5a40bdcf7474653c90

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 21e58b27a765063a765c3e0c2effc6089bb63964a5fe98f53108b48c9a0e21db
MD5 b2583939f41b62f6c8482647f56b2ff2
BLAKE2b-256 1f23195db13059df5f1578a255eecb275499a0284d511510569aea8778ec0543

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermite_ml-0.2.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thermite_ml-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ea2d175f21e9c9af2a0de8642625a72d6b08d65a53387d921f69ba383e168ff
MD5 92741bdfcfec6a0acd1577a7d08a38b2
BLAKE2b-256 33c42e5bdcacce708b37556625c3c19a84c6efec8b12805abd45e35d6102b3fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermite_ml-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for thermite_ml-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8994cb324c14bfc1182251d5cfc07147bb34a2ff6eb2a9835afca0433f0a9d88
MD5 32ac984254e6ca302fb06dbb0e101dce
BLAKE2b-256 0ceee5b592c8b51a697b3cff981b85f9ff719427c2e71ef311693751850a9689

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on KartavyaDikshit/Thermite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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