← All news·2026-06-15·4 min read

Flash-KMeans: Exact K-Means 200x Faster on GPUs

Academics have published an open source GPU implementation of vanilla k-means clustering that’s more than 200x faster than FAISS without any approximations.

aiopen-sourcegpuresearch

A team of researchers from UC Berkeley and UT Austin have published Flash-KMeans, an open source implementation of vanilla Lloyd’s k-means clustering on GPUs that they claim is more than 200x faster than FAISS without any approximations. How? By rearranging the way data is moved around instead of approximating. Flash-KMeans is available under the Apache 2.0 license and can be installed via ‘pip install flash-kmeans’.

On an NVIDIA H200 GPU in FP16 with 128 dimensions, Flash-KMeans achieves impressive results including being 33x faster than NVIDIA’s own cuML, up to 17.9x faster end-to-end compared to state-of-the-art baselines, and up to 10.5x faster than fastkmeans in an out-of-core setting with 1 billion points. Furthermore, the two custom kernels achieve up to 21.2x and 6.3x speedups which contribute to these end-to-end improvements.

How it gets the speedup

To achieve these gains, Flash-KMeans uses two clever memory optimizations. First, FlashAssign combines distance calculation and online argmin to avoid storing the entire NxK distance matrix in memory, reducing the IO complexity from O(NK) to O(Nd+Kd). Second, Sort-Inverse Update sorts points according to their cluster IDs, turning atomic writes into segment reductions and reducing atomic contention. Importantly, these optimizations don’t affect the final clusters, only how much data needs to be moved between different levels of the GPU’s memory.

Why it matters

K-means is a fundamental building block in many modern AI applications such as vector search indexing, sparse attention routing, KV cache compression, low-bit KV quantization, and diffusion transformers. In these workflows, clustering is frequently used within training and inference loops, but what matters most is not theoretical complexity but rather latency per invocation. With a simple drop-in replacement for faster exact clustering, you can get the same results in less time and money without having to worry about sacrificing accuracy.

ℹWhat I'd actually do

If you run anything with a vector database or your own embeddings pipeline, this is the kind of release worth a quick benchmark on your real data before you accept it. Exact-but-faster is the rare free lunch: same output, lower bill. The honest test is your own workload on your own hardware — a 200x headline on an H200 won't be your number, but even a fraction of it is worth ten minutes to check.

Source: www.marktechpost.com

Free course

Stop reading about AI — start building with it

The free Claude Code course: your first site, tool or game — no coding. No upsells, no cross-sells — nothing to buy here.

Start free →
EAEvgenii Arsentev

Author

Evgenii Arsentev

PhD · Chief Executive Officer, digital health