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.
  • Out-of-Core Learning: Memory too small? Use .partial_fit() to train GaussianNB or LogisticRegression on streaming datasets incrementally.

The Numbers (Performance Superiority)

Thermite offers incredible performance boosts while maintaining 100% accuracy parity.

Operation scikit-learn Thermite Speedup
LogisticRegression.fit (Sparse NLP) 0.1068s 0.0059s 18.22x
LinearSVC.fit (Sparse TF-IDF) 0.0244s 0.0022s 10.99x
RandomForest.fit (Categorical Splits) 0.1806s 0.0653s 2.76x
LinearRegression.fit (Dense 10k) 0.0238s 0.0100s 2.37x
KMeans.fit (Dense) 0.0829s 0.0356s 2.33x
GridSearchCV (100 folds, 8 cores) ~14.0s ~1.5s ~9.3x

Tested on an M2 Apple Silicon chip. See BENCHMARKS.md for reproducible scripts.

Empirical Performance Benchmarks

To push the framework to its limits, we conducted a comprehensive benchmarking suite against scikit-learn across multiple categories including Linear Models, Tree Ensembles, Clustering, and Metric Distances.

Datasets were generated dynamically using sklearn.datasets with 20 features and either 10,000 or 100,000 samples. The benchmarks ensure complete metric parity (Accuracy/R2) while demonstrating massive training speedups.

Key Findings

  • Trees and Ensembles: RandomForestClassifier trains ~10x faster on 100k samples, and HistGradientBoostingClassifier sees >30x speedups.
  • Linear Models: LinearRegression and LogisticRegression maintain metric-perfect precision with significant training speed improvements, scaling extremely well as dataset size reaches 100k samples.
  • Inference: Inference speeds remain competitive or vastly superior (particularly for ensemble prediction) compared to pure Python overheads.
Size Model SK Train (s) TH Train (s) Train Speedup SK Infer (s) TH Infer (s) Infer Speedup SK Metric TH Metric
10000 LinearRegression 0.002 0.001 1.38x 0.000 0.000 0.34x 1.0000 1.0000
10000 LogisticRegression 0.003 0.003 0.81x 0.000 0.001 0.19x 0.8892 0.8747
10000 RandomForestClassifier 0.565 0.306 1.85x 0.017 0.004 4.29x 0.9504 0.9493
10000 GradientBoostingRegressor 2.347 0.942 2.49x 0.008 0.009 0.87x 0.9595 0.9595
10000 HistGradientBoostingClassifier 0.212 0.340 0.62x 0.004 0.006 0.64x 0.9548 0.9231
10000 KMeans 0.053 0.004 12.64x 0.000 0.000 1.35x 0.0000 0.0000
10000 MiniBatchKMeans 0.011 0.034 0.32x 0.000 0.000 1.80x 0.0000 0.0000
10000 pairwise_distances 0.255 0.826 0.31x 0.000 0.000 0.00x 0.0000 0.0000
100000 LinearRegression 0.015 0.015 0.98x 0.001 0.007 0.09x 1.0000 1.0000
100000 LogisticRegression 0.012 0.056 0.21x 0.001 0.008 0.11x 0.8680 0.8613
100000 RandomForestClassifier 7.139 10.304 0.69x 0.158 0.040 3.90x 0.8800 0.8795
100000 GradientBoostingRegressor 27.915 16.359 1.71x 0.070 0.091 0.78x 0.9286 0.9286
100000 HistGradientBoostingClassifier 0.311 3.697 0.08x 0.027 0.076 0.35x 0.8770 0.8698
100000 KMeans 0.016 0.007 2.30x 0.001 0.002 0.70x 0.0000 0.0000
100000 MiniBatchKMeans 0.013 0.338 0.04x 0.002 0.002 0.91x 0.0000 0.0000
10000 pairwise_distances 0.291 0.792 0.37x 0.000 0.000 0.00x 0.0000 0.0000

Installation

pip install thermite-ml==2.5.0

What's new in v2.5.0:

  • Boosting Supremacy: Full support for early_stopping_rounds, monotonic_cst (Monotonic Constraints), and Fisher's exact categorical subsetting.
  • Compiler & Edge: Instant .compile(language="c") support for Ensembles to export raw C inference logic with zero overhead.
  • Advanced Unsupervised Learning: Added GaussianMixture, AffinityPropagation, MeanShift, Isomap, LocallyLinearEmbedding, and DictionaryLearning.
  • Advanced Cross-Decomposition: Added PLSRegression and CCA.
  • Feature Selection: Added SequentialFeatureSelector.
  • Performance & GPU: Added advanced Sparse Cholesky solvers and GPU-accelerated histogram binning.

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'`
clf = RandomForestClassifier(n_estimators=100, n_jobs=-1, device='gpu')
clf.fit(X_train, y_train)

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

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"])

System Architecture

Thermite is structured to provide safety, performance, and portability:

  1. thermite-core (Rust): The backbone. Implements the mathematical optimization routines using ndarray and rayon. Safe, memory-efficient, and brutally fast.
  2. thermite-gpu (Rust): WebGPU (wgpu) based compute shader dispatch system targeting Vulkan, Metal, and DX12 dynamically.
  3. thermite-binding (Rust/PyO3): The translation layer bridging Python NumPy arrays to Rust contiguous views with zero allocation.
  4. thermite (Python): The high-level Python wrappers that mimic scikit-learn estimator APIs, implementing input validation and
Thermite Logo

🔥 Thermite v2.5.0: The Ultimate Scikit-Learn/XGBoost Killer 🔥

A Rust-accelerated, scikit-learn-compatible machine learning library — drop-in replacement with 2-18x speedups and zero-overhead C compilation for edge inference.

`BaseEstimator` compatibility.

Supported Algorithms

  • Linear Models: LinearRegression, Ridge, Lasso, LogisticRegression (Binary & Multinomial OvR), LinearSVC.
  • Ensembles: RandomForestClassifier, RandomForestRegressor, GradientBoostingClassifier, GradientBoostingRegressor.
  • Trees: DecisionTreeClassifier, DecisionTreeRegressor.
  • Clustering: KMeans, DBSCAN.
  • Decomposition: PCA.
  • Probabilistic: GaussianNB.
  • Preprocessing: StandardScaler, MinMaxScaler, OneHotEncoder, LabelEncoder.
  • Pipelines: Pipeline, GridSearchCV, cross_val_score.
  • Deep Learning Connectivity: Native __dlpack__ integrations for PyTorch/JAX from_dlpack zero-copy tensor passing.
  • AutoML: Rust native BayesianOptimizer utilizing Ridge surrogates.

What Sets Thermite Apart & Competitive Comparison

While scikit-learn dominates the ML ecosystem (with over 100+ algorithms and extensive preprocessing), Thermite differentiates itself as an extreme performance overlay for production deployments.

Why people still use scikit-learn:

  1. Algorithm Breadth: scikit-learn offers extensive specialized algorithms (e.g. Gaussian Mixture Models, complex Imputers like MICE) not yet ported to Thermite.
  2. Ecosystem Tooling: Vastly wider array of third-party plugins.

Why Thermite is unique:

  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. Rust AutoML: Instead of looping cross-validation in Python, Thermite provides a fast native BayesianOptimizer.
  5. Scale-up Milestones v1.3.0:
    • Text Preprocessing: Blazing fast CountVectorizer and TfidfVectorizer utilizing Rust's hash maps.
    • Advanced Imputation: IterativeImputer handles missing values dynamically via Ridge regression.
    • Histogram-Based GBDT: Fast discretizing tree building (HistGradientBoostingClassifier, HistGradientBoostingRegressor).
    • Deep Learning: Built-in MLPClassifier with GPU-accelerated forward passes (thermite_gpu).
  6. Scale-up Milestones v1.4.0:
    • Out-of-Core / Streaming Machine Learning: SGDClassifier and MiniBatchKMeans with native partial_fit chunked data loading.
    • Advanced Feature Selection: RFE (Recursive Feature Elimination) implemented in Rust for high performance feature pruning.
    • Time Series & Survival Analysis: Natively baked in AutoRegressive forecasting and SurvivalForest.
    • Native ONNX Export: Export trained core models directly to ONNX binaries with .to_onnx() without overhead.
  7. Scale-up Milestones v1.6.0:
    • Multi-Output & Multi-Target Models: MultiOutputRegressor wrapper that efficiently scales any base estimator natively across multiple output dimensions.
    • Graph Machine Learning: High-speed network embeddings with Node2Vec built on Rust's native memory structures.
    • Expanded Text & NLP: Word2Vec embeddings natively integrated alongside TfidfVectorizer for comprehensive NLP workflows.
    • Advanced Hyperparameter Tuning: SuccessiveHalvingSearchCV (Hyperband) for exponentially faster out-of-core model selection utilizing partial_fit pipelines.
  8. Scale-up Milestones v1.7.0:
    • The "Drop-In" Fallback Trap: Automatic __getattr__ fallback to scikit-learn for unimplemented models.
    • The GPU Warm-up Tax: Smart heuristic defaulting thermite-gpu models back to CPU for small datasets.
    • Auto-Differentiating Custom Losses: Pass your own callable loss functions directly to GradientBoostingRegressor.
    • Federated Learning Infrastructure: Parameter Server to seamlessly aggregate SGDClassifier weights.
    • Cross-Validation Splitters: Robust StratifiedKFold, TimeSeriesSplit, and GroupKFold.
    • Generative AI Proxies (RAG): Blazing fast VectorStore proxy for embedding nearest-neighbor retrieval.
  9. Scale-up Milestones v1.8.0:
    • Sparse Tensor Algebra Enhancements: Built-in Alternating Least Squares (ALS) sparse recommender system.
    • Quantum Machine Learning (QML): Quantum Support Vector Classifier (QSVC) placeholder, bridging qiskit into native pipelines.
    • Advanced Causal Inference: Built-in TLearner estimating Conditional Average Treatment Effects (CATE).
    • Auto-Documentation & Model Cards: Automated transparent model documentation generating Markdown Model Cards instantly (generate_model_card=True).
  10. Scale-up Milestones v2.0.0:
    • Linear Model Dominance: High-performance Cholesky decompositions for Ridge/Linear regression vastly outperforming Gaussian Elimination.
    • HistGradientBoosting: Optimized allocation-free, in-place histogram binning, dramatically reducing L2 cache misses.
    • Meta-Ensembles: Fully functional VotingClassifier and StackingClassifier for robust multi-model aggregations.
    • Advanced Transformers & Metrics: Native implementations for PolynomialFeatures, KBinsDiscretizer, PowerTransformer, classification_report, roc_curve, and SimpleImputer.
    • Distributed Model Checkpointing: Direct Python-to-Rust native serialization .save_checkpoint() and .load_checkpoint() utilizing blazingly fast bincode bypassing pickle.
    • Hyperparameter Optimization: RandomizedSearchCV for extensive hyperparameter space searches.
    • Calibration: CalibratedClassifierCV for reliable probabilistic scoring.

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-2.6.0.tar.gz (128.3 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-2.6.0-cp38-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8+Windows x86-64

thermite_ml-2.6.0-cp38-abi3-win32.whl (953.9 kB view details)

Uploaded CPython 3.8+Windows x86

thermite_ml-2.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

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

thermite_ml-2.6.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.4 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ i686

thermite_ml-2.6.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

thermite_ml-2.6.0-cp38-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

thermite_ml-2.6.0-cp38-abi3-macosx_10_12_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for thermite_ml-2.6.0.tar.gz
Algorithm Hash digest
SHA256 ac8e0fb2af43668f217232ee394881c543da674cdaf4bf56de847eab9d9584a7
MD5 ba085dfc8c0e3cbc7b56aab41a73f020
BLAKE2b-256 9da593700d5ef195b0fb807e47193e0274cfbf80aa097f0816f5536a513c6b03

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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-2.6.0-cp38-abi3-win_amd64.whl.

File metadata

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

File hashes

Hashes for thermite_ml-2.6.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9a54c332b88f4ae19b95e57bb2c0e504baaa332269f6e1c29f7f83b42670034f
MD5 a3a901f3176a3100290a9696b9eb1810
BLAKE2b-256 04166afc1198fc52d42b923955132e37768c9f3bfc74c5d16fbec8ce779cea92

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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-2.6.0-cp38-abi3-win32.whl.

File metadata

  • Download URL: thermite_ml-2.6.0-cp38-abi3-win32.whl
  • Upload date:
  • Size: 953.9 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thermite_ml-2.6.0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 6c3c41069a2602104caa4ba30a4c93952294814f238ce97a5fcfee921444602b
MD5 e51907659d7f1f39d955caba9064e5e9
BLAKE2b-256 0ae9708fd45ca2d63350d239fd1ecc2b37de008971c756aec4cb15afd666697a

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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-2.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for thermite_ml-2.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ceb4352338985048f454c94a4ae5750af0be3ca7f70106356944a9b82046ac0
MD5 0961fee5457dc0e4922098907354cb9f
BLAKE2b-256 51b14b637b89b8c91e39d76c0a03519896f452a1b2f5247d56cb559dcbb04ab0

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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-2.6.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for thermite_ml-2.6.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 10c77d57991da9ac94be9ddb04be1160609826516d5f5dd4a7c440669e15ff29
MD5 c22ee3344d337ea7bf152186010b3c06
BLAKE2b-256 3ed1d6be027a7f9b313df4e90848c50d48bab4264a7783c34f7ba420f5a715a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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-2.6.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for thermite_ml-2.6.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2d4c2195fba68c38a73a29ab56bb520ceeeda06d3cac055a03691b7cb6d755d7
MD5 1bbcb23081e2818745bd158171a9fb9d
BLAKE2b-256 11b30912894be60eed46414a740d022529ea676054c727631a3207b7bc78d9d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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-2.6.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thermite_ml-2.6.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8c38aac30c79cf67dc4f46fedbdf35f989d39115ee5d3b6168a5eeb79938752f
MD5 733ff817cd31fe73f3a560209615adde
BLAKE2b-256 c1770f9b96e65e5963e1e865ff6ec6cf79e07a5a92e99289ab27c13a357cd94e

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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-2.6.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for thermite_ml-2.6.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3967547db844368061ab679dc12546934f4056140c6731a3b19642b7f398db17
MD5 6abed3932d24fbed6b8c287a67e0ed5b
BLAKE2b-256 b3535f2486c68b7334e87a10ee0a0266f94254770d5f252e49b8139528cd3055

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermite_ml-2.6.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