Interleave your benchmark runs on a Mac

mlx-learn OMeans vs scikit-learn KMeans, 8,192 centroids on MNIST: 191 s vs 103 ms on an M5 Ultra
Fig. 1. Numbers from @tabul_ai's mlx-learn 0.1.5 thread.

Yesterday @tabul_ai shipped mlx-learn 0.1.5 with a new clustering method called OMeans. mlx-learn is a scikit-learn compatible classical ML library that runs on Apple silicon through MLX (repo). The headline number is the kind that gets screenshotted: 8,192 centroids on MNIST took 191 s with scikit-learn's KMeans and 103 ms with OMeans on an M5 Ultra. They say that's 1,854x faster, with held-out error within 0.1%.

I spend a lot of my time trying to make models run faster on Mac silicon, so the speedup is fun to read. The part I actually want to keep is in post 7 of their thread, where they explain how they measured it.

How they timed it

They used three seeds, computed held-out error in float64, and ran the methods in interleaved rounds so every method shared the same machine state. Their reason, in their words: "a laptop GPU throttles under sustained load, and timing one method after the other flatters the faster one."

That's a real trap on a Mac. If you run baseline A for ten minutes and then candidate B for ten minutes, B runs on a chip that's been hot for ten minutes and A ran on a cool one. Your comparison now includes the thermals. Interleaving (A, B, A, B) spreads that drift across both sides, so the gap you see is closer to the gap the code makes.

Where it doesn't help

The thread is also upfront about limits, which I like. On small data it helps less. On MNIST, below about 2,200 centroids OMeans falls back to the full search and simply matches mlx-learn's own EMeans, and at 4,096 to 8,192 centroids its edge over EMeans is 1.1 to 1.5x. They also point out that KMeans and OMeans are different tools: KMeans runs full-batch Lloyd to convergence, OMeans makes a few mini-batch passes. The speed comes from a two-level search. Centroids get grouped into coarse cells and each row is compared only against centroids in a few nearby cells, which they say is about 11% of the centroids on typical embedding data.

What I'm taking from it

If you're benchmarking anything on a Mac, whether that's a model, a quant or a kernel, interleave the runs and write down the order you ran them in, next to the hardware and settings. A big speedup is easy to believe. A writeup that tells you how it could have fooled itself is easier to trust.

If you want to try it, the thread gives the install as pip install -U mlx-learn, and benchmarks, method and known limits are in the repo.

Credit: numbers and method from @tabul_ai's mlx-learn 0.1.5 thread (Nov 19, 2026). Found via @ivanfioravanti.

Tags: MLX macOS Benchmarks Local inference

All ship logs