Meta FAIR Releases e-means: An Algorithm Beating k-means in 10x Fewer Epochs
Meta FAIR researchers have released e-means, a drop-in replacement for Lloyd’s k-means algorithm.The e-means clustering algorithm reaches the loss Lloyd’s k-means gets in 25 epochs in 1.4 to 2.6 epochs.
It ships in FAISS 1.16.0 under faiss.contrib.e_means.For anyone building vector indexes, quantizers or data-curation pipelines, clustering is often the slowest offline step.e-means targets exactly that step.
e-means is a mini-batch k-means algorithm from Meta FAIR that updates centroids with exponential moving averages.
Every k-means variant keeps a sum S and a count N per cluster. The centroid is S divided by N. Methods differ only in how S and N change.
Older assignments fade, so centroids track recent data. The research team expa Lloyd is a corner case: full batch with α = 1. On DEEP, that corner sits 1.8% above the best loss.
The team tested plain gradient descent as an alternative. At its best setting, it ended 1.6% (DEEP) and 0.4% (SIFT) above EMA. The authors suspect EMA wins because centroids always stay inside the hull of their assigned points.
Two fitted scaling laws set batch size B and initial step α0 from dataset size n, cluster count k and epochs T. On held-out datasets, median regret was 0.07% for the step law. The step then follows a cosine schedule from α0 to 0.1α0.
[EMBED: e-means interactive explainer]
All numbers below are self-reported by the authors.
The release thread shows a 1-CPU-thread demo. Lloyd took 4.39 s for 25 epochs. e-means took 0.43 s for 2.2 epochs. One Lloyd step touched 100,000 points (0.176 s). One e-means step touched 512 points (0.001 s).
Mini-batch noise also helps escape bad local minima. On a 5-blob toy, Lloyd stayed stuck on 46% of 200 starts. e-means stayed stuck on 0%.
Revival matters at large k. On DEEP with 16,384 clusters, proportional splitting left 47 dead clusters (0.3%). With revival off, 4,313 clusters (26.3%) died.
Check out the paper, the blog post and the FAISS code. Wait! are you on telegram? now you can join us on telegram as well.
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
Michal Sutter is a data science professional with a Master of Science in Data Science from the University of Padova. With a solid foundation in statistical analysis, machine learning, and data engineering, Michal excels at transforming complex datasets into actionable insights.
What 70,000+ AI engineers read before standup
Get the AI releases that matter, before they trend.
Model releases, open weights, agents and papers with code — the 5 that matter, in 1 email. Free.
Get the stories that didn’t make it on the homepage.
Last issue: ▲ what's inside: claude fable 5.2, muse ember, aspen, inkling 2 small
The newsletter 70,000+ AI builders read
Model releases, open weights and papers with code — in 1 email. Free.
▲ AI DEV SIGNALS · FREE NEWSLETTER
Get the AI releases that matter, before they trend.
70,000+ AI builders · Past issues →
The newsletter 70,000+ AI builders read. Model releases, tools and research, without the hype.
Practitioner-first AI/ML news and analysis, read by 1M+ developers and researchers every month.