# e-means — Meta FAIR's k-means replacement needs one-tenth the 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.

- Org: Meta FAIR
- Date: 2026-11-06
- Category: paper, algorithm, repo
- Source: https://e-means.github.io/
- Canonical page: https://ai-tldr.dev/releases/meta-fair-e-means/

## In short

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.

## What it is

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 it works

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 it matters

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 it's 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

## Links

- [Project Page](https://e-means.github.io/)
- [Paper](https://arxiv.org/abs/2611.09501)
- [Code in Faiss](https://github.com/facebookresearch/faiss/tree/main/contrib/e_means)
- [HN Discussion](https://news.ycombinator.com/item?id=50429734)
