Blog Network

Meta FAIR · 2026-11-06 · notable

e-means — Meta FAIR's k-means replacement needs one-tenth the epochs

e-means is a mini-batch replacement for k-means clustering from Meta FAIR. It reaches the loss Lloyd's k-means gets in 25 epochs in 1.4 to 2.6 epochs, and runs 10-45x faster on GPU. The code ships in Faiss.

Chart comparing e-means and Lloyd's k-means test loss over training epochs

A drop-in k-means replacement from Meta FAIR that reaches the same clustering loss in about a tenth of the passes over the data.

Key specs

Epochs to match 25 lloyd epochs1.4–2.6
Gpu wall clock speedup10–45x

What is it?

e-means is a new clustering method from Meta FAIR that replaces Lloyd's k-means algorithm, the standard way to group embedding vectors into clusters. The paper reports that e-means reaches the test loss Lloyd's k-means gets after 25 epochs in 1.4 to 2.6 epochs. The authors include Hugo Touvron, Matthijs Douze and Hervé Jégou.

How does it work?

Instead of recomputing every centroid from the full dataset, e-means reads mini-batches and keeps an exponential moving average of each cluster's count and sum; the centroid is their ratio. Scaling laws pick the batch size and step size from the data size, cluster count and epochs, so there are no extra hyperparameters. Dead clusters are revived by splitting large ones, and fused GPU kernels turn the saved epochs into wall-clock speed.

Why does it matter?

Clustering embeddings is a core step in building vector-search indexes and deduplicating training data, and at scale it is expensive. Meta FAIR reports a 10-45x wall-clock speedup on GPU against Flash-KMeans and 8-15x on CPU against Faiss, and clustered 10 billion DINO embeddings into 16 million clusters in 2.5 epochs.

Who is it for?

ML engineers building vector indexes or clustering embeddings at scale

Try it

pip install faiss-cpu, then: from faiss.contrib.e_means import NumpyEmeans

Sources · 4 outlets

Tags

  • meta
  • fair
  • faiss
  • k-means
  • clustering
  • embeddings
  • e-means
  • vector-search
  • gpu
  • open-source

← All releases