Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

mlx-learn

Latest version: v0.1.7

Overview

Last scanned
23 Nov 2026
Published
23 Nov 2026
PyPI package Publisher: tabulai
59 Stars
4 Forks
6 Versions
1.3K Downloads
Python Repo language

Scan summary

mlx-learn was last scanned on 23 Nov 2026 at version 0.1.7. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 6 versions; the latest 4 were published within 6 days (18–23 Nov 2026).
  • Findings: No rules fired in version 0.1.7.
  • Downloads: 1,315 downloads.

Versions

6 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.1.7 LATEST 23 Nov 2026 No rules fired
0.1.6 19 Nov 2026 No rules fired
0.1.5 19 Nov 2026 No rules fired
0.1.4 18 Nov 2026 Not shown
0.1.2 11 Nov 2026 Not shown

No rules fired in 0.1.7

Findings

Findings for v0.1.7. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.1.7; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

mlxlearn

Classical machine learning on Apple silicon, accelerated with MLX, with a scikit-learn compatible API.

mlxlearn is not officially associated with scikit-learn or PROBABL, nor with Apple.

mlxlearn has two layers.

Layer 1 — the library. Explicit imports, typed solver configuration and state, strict errors, eager fit, no mutation of scikit-learn, no data-keyed caches:

from mlxlearn.neighbors import KNeighborsClassifier

clf = KNeighborsClassifier(n_neighbors=5).fit(X_train, y_train)
y_pred = clf.predict(X_test)

Layer 2 — the patching shell. A thin adapter that points scikit-learn's own names at Layer 1 estimators, so existing code — including code an LLM generated against the scikit-learn API — runs accelerated without being edited:

from mlxlearn import patch_sklearn
patch_sklearn()

from sklearn.svm import SVC          # now resolves to the accelerated class

The numerical library is fully usable and fully tested with the patching mechanism absent.

Direct KNN classes use sklearn's public estimator interface without inheriting its concrete neighbor classes, avoiding those imports during ordinary startup. isinstance against a stock neighbor class is therefore false for direct KNN objects. Use their own graph methods; sklearn's standalone graph helpers do not accept these objects as fitted-estimator inputs. Patched KNN classes retain stock inheritance. See the compatibility details.

Status

0.1.7 — alpha. The API may change. See CHANGELOG.md.

Estimator Status
mlxlearn.neighbors.NearestNeighbors 0.1.0
mlxlearn.neighbors.KNeighborsClassifier 0.1.0
mlxlearn.neighbors.KNeighborsRegressor 0.1.0
mlxlearn.neighbors.RadiusNeighborsClassifier 0.1.7
mlxlearn.neighbors.RadiusNeighborsRegressor 0.1.7
mlxlearn.linear_model.LogisticRegression 0.1.0
mlxlearn.linear_model.LinearRegression 0.1.7, dense host solver with certified rank
mlxlearn.svm.SVC (exact) 0.1.0
mlxlearn.decomposition.PCA 0.1.2
mlxlearn.cluster.EMeans 0.1.3; Metal GPU, paper/Faiss recipes
mlxlearn.cluster.KMeans 0.1.3; Metal GPU, Lloyd clustering; Metal k-means++ seeding since 0.1.6
mlxlearn.cluster.OMeans 0.1.5; Metal GPU, e-means with a two-level centroid search
Ridge, DBSCAN, TSNE planned, 0.2.x
SVR, NuSVR, NuSVC deferred — will not ship until they implement the true objective
tree ensembles out of scope

Recent benchmark highlights

  • Radius neighbors (0.1.7). On an M4 Max, repeated radius searches were 4.42× faster than scikit-learn across 28 workloads, and repeated radius predictions were 3.51× faster across 12 workloads (geometric means). Including fit and the first call, the speedups were 1.07× for search and 0.54× for prediction. Benchmark results
  • K-means++ seeding on the GPU (0.1.6). KMeans(init="k-means++") now chooses its starting centers with a Metal screen, and for a given random_state it selects the same rows as sklearn.cluster.kmeans_plusplus. On MNIST (60,000 × 784, M4 Max) seeding 8,192 centers takes 5.4 s instead of 217 s, and the default fit at 1,024 to 8,192 centers takes 1.4–7.0 s instead of 27–219 s, with the same iterations and inertia. K-means++ initialization
  • O-means against e-means (0.1.5). Over 18 datasets and three seeds, OMeans reached EMeans' held-out error 4.44× faster in float32 and 3.55× in BF16 on an M5 Ultra, and 4.13× and 3.96× on an M4 Max, as geometric means. At ten million rows and 65,536 centroids it was 8.8× faster in float32 on the M5 Ultra. It compares each row with a median 11% of the centroids, and its held-out error at the same epochs stays within −1.14% to +0.36% of EMeans'. M5 Ultra report · M4 Max report
  • O-means on the MNIST family (0.1.5). On three 60,000 × 784 datasets, an OMeans fit at 4,096 to 8,192 centroids takes 150–242 ms on an M4 Max, against 107–223 s for scikit-learn's KMeans, with held-out error within 1% of it. Against EMeans this small data gains 1.4× in training at 4,096 centroids and 2.0–2.3× at 8,192. MNIST-family results

0.1.4 benchmark highlights

  • E-means against Lloyd at 25 iterations. The 0.1.3 benchmark gave both methods the same two or three passes. The new comparison adopts the paper's 25-iteration Lloyd reference for held-out mean squared error. On four datasets with 10 million vectors and 65,536 centers each, e-means ran 6.58–9.49× as fast in two or three epochs, with test MSE within 0.28% of Lloyd. Both methods started from identical centers and timed final labeling and inertia. The results use one seed and preset whole epochs on M4 Max. E-means paper · Full Lloyd-25 benchmark
  • Faster Metal clustering. Streaming FP32 assignment on M4 Max cut fixed-center assignment on 10 million DEEP vectors from 22.88 to 14.77 s. A two-update Lloyd fit with final labeling fell from 115.56 to 55.67 s, with identical labels and inertia. In the four-dataset comparison run in the same session, e-means fits were 1.06–1.53× as fast as with the previous assignment kernel. Lloyd can also reuse labels that its center-separation bound certifies. Full clustering benchmark · Four-dataset kernel comparison
  • Faster RBF SVC fitting. The native solver caches kernel rows across working sets when the full Gram matrix exceeds cache_size. At 200 MiB on M4 Max, standard MNIST fit time fell from 9.09 to 3.59 s (2.53×) and Fashion-MNIST from 10.29 to 4.59 s (2.24×) against the previous solver. On standard MNIST, accuracy was 97.92% and all 450,000 decision scores matched the previous build. Full SVC benchmark

E-means clustering

Version 0.1.3 includes e-means, with Metal assignment and update kernels for Apple Silicon:

from mlxlearn.cluster import EMeans

model = EMeans(n_clusters=4096, max_iter=3, random_state=10).fit(X_train)
labels = model.predict(X_test)

It supports the published recipe, a separately specified Faiss recipe, last-epoch means, slow EMA, and spherical clustering. See the implementation guide and reproducible paper-data benchmarks. Measured results are in the M4 Max benchmark report. The direct Faiss e-means comparison measures runtime, process memory, and held-out quality with matched Faiss recipes. precision="bfloat16" enables native BF16 Metal assignment with float32 accumulation and state, plus the Faiss BF16 statistics semantics. The optimization and H100 protocol report compares it with a matched Metal GEMM baseline and documents the limits of comparison with published H100 times. The subsequent hardware-gap investigation separates arithmetic throughput from implementation overhead and compares further optimizations against a frozen native-BF16 implementation in fresh paired runs. The five-dataset 10M-vector comparison measures matched FP32 Metal and original Faiss CPU runs: Metal is 3.98–18.95× faster, with test-MSE differences within 0.061% in this single-seed campaign. EMeans is an explicit estimator; it does not replace sklearn's KMeans through patching.

For full-batch Lloyd clustering, Metal KMeans is available through from mlxlearn.cluster import KMeans. It supports dense FP32 training, explicit, random or k-means++ initialization, multiple restarts, and final nearest-centroid labels and inertia. Use the direct estimator; it is not part of patch_sklearn(). Since 0.1.6 its k-means++ initialization runs on the GPU and selects the same centers as scikit-learn's helper for a given random_state; see K-means++ initialization.

The 0.1.3 equal-pass comparison reports runtime, peak fit memory, and test MSE for four methods on five 10M-vector datasets.

O-means clustering

Version 0.1.5 adds OMeans for clustering with many centroids. During two-level training, each row is compared with the centroids of a few nearby coarse cells, covering 6–25% of the centroids on the measured embedding datasets. The estimator follows the o-means post with separate Metal kernels.

from mlxlearn.cluster import OMeans

model = OMeans(n_clusters=16384, max_iter=2, random_state=10).fit(X_train)

Against EMeans(recipe="faiss") with the same batch law, seed and starting centroids, over 18 datasets and three seeds. Each entry is a geometric mean of e-means' fit time divided by o-means'.

M5 Ultra, float32 M5 Ultra, BF16 M4 Max, float32 M4 Max, BF16
Time to EMeans' held-out error 4.44× 3.55× 4.13× 3.96×
Same epochs 4.44× 3.42× 4.20× 3.90×
Time to EMeans' error, 10M rows and 65,536 centroids 8.8× 5.9× 7.3× 7.0×
  • Range: 1.6–10.4× across datasets on M5 Ultra and 1.5–8.0× on M4 Max. The gain grows with the number of centroids and is smallest on unnormalized GloVe-200, whose cells come out uneven.
  • Quality: at the same epochs, held-out error is −1.14% to +0.10% of EMeans' at one epoch and −0.17% to +0.36% at two. O-means needs 2 to 2.5 epochs to match EMeans' two-epoch error.
  • Method: the M5 Ultra campaign timed one configuration after another, with every call at nominal thermal pressure. The M4 Max is a laptop whose GPU throttles under sustained load, which slows the full search more than the two-level search, so its campaign timed all configurations in turn.
  • Routing: On M1 Ultra, M4 Max, and M5 Ultra, assignment="auto" can select the two-level search from 4,224 centroids, or from 2,176 with 512 features or more. On M1 Ultra and M5 Ultra, fits shorter than two epochs keep the full search from 2,176 to 4,223 centroids at 512 features or more, where one-epoch fits on M5 Ultra were measured slower than EMeans. It returns to the full search when a fit's cells turn out too uneven to save comparisons. Final labels, predict and score always use a full search.

See the implementation guide and the benchmark reports for M5 Ultra and M4 Max. Results on the much smaller MNIST family are below.

Requirements

  • macOS on Apple silicon (arm64)
  • Python 3.10 – 3.13
  • scikit-learn ≥ 1.7, MLX ≥ 0.29

Python 3.10 is supported with scikit-learn 1.7.x; scikit-learn 1.8+ requires Python ≥ 3.11. CI tests only valid pairs — see docs/support_matrix.md.

Install

pip install mlx-learn

Version 0.1.7 provides Apple silicon wheels for Python 3.10–3.13 with Metal and C++ CPU extensions. Source builds can also include these optional extensions. The KNN CPU extension handles small workloads and is compiled at build time; fitting or querying never invokes the C++ compiler. A compatible wheel includes the extensions built into it. Without a compiler or CPU extension, the certified portable CPU implementation remains available with the same ordering contract; native-build benchmark timings do not describe that fallback's performance.

The CPU module uses the full CPython C API, so wheels containing it target a specific Python minor version. The Metal component itself retains its stable abi3 interface. Installing a compatible prebuilt wheel needs no compiler.

Import-order semantics

Patching replaces attributes on scikit-learn modules. Attribute access (sklearn.svm.SVC) therefore resolves to the mlxlearn class whether import sklearn happened before or after patch_sklearn().

Symbols captured before patching are local bindings and cannot be rebound:

from sklearn.svm import SVC     # binds the stock class into your namespace
patch_sklearn()                 # cannot reach back and change SVC
SVC()                           # still the stock class

That is Python name binding, not a bug in mlxlearn. The supported pattern is patch-first. patch_sklearn() is idempotent, and unpatch_sklearn() fully restores scikit-learn.

When mlxlearn falls back

Layer 1 raises a precise error when it cannot honor a request. Layer 2 falls back to stock scikit-learn instead — but only for capability mismatches (sparse input, an unsupported parameter, an unsupported dtype), never to hide a bug:

Situation Direct import Patched
Capability mismatch precise MLXLearnError falls back, warns once per class, records diagnostics
KNN with device="auto" owned CPU/GPU search owned CPU/GPU search
Other estimators below the measured crossover internal CPU path dispatches to scikit-learn
Invalid user input sklearn-equivalent validation error scikit-learn's own exception, unmasked
Unexpected backend runtime failure raises raises — never silently rerun on scikit-learn

Set the policy with fallback_policy="warn" | "raise" | "silent". Diagnostics are recorded in every mode:

import mlxlearn

with mlxlearn.config_context(fallback_policy="raise"):
    ...                                     # any capability fallback becomes an error

mlxlearn.get_last_backend_event()           # what the last fit/predict actually did
mlxlearn.get_backend_diagnostics()          # everything recorded this session

Sticky fitted policy. execution_backend_ records the fit backend ("mlx", "cpu", or "sklearn"). Inference reuses that backend, except for NumPy KNN estimators fitted with device="auto": their execution_policy_ is "auto", allowing each query batch to use the owned CPU or GPU search. Small datasets and single queries can avoid GPU launch overhead, while larger batches retain the GPU path. last_query_backend_ and backend diagnostics report the actual search. Explicit KNN device choices use a "fixed" policy. Changing global configuration after fit does not alter either fitted policy, and automatic CPU search does not invoke a scikit-learn solver. A new fit clears state and may choose differently. PCA records the fit backend and selects CPU or GPU projection per batch according to input size and precision.

Configuration

The public surface is deliberately small:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases mlx-learn

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

Frame 2085668439 (1)
Group 1261154229