code-itCurated Benchmark & ReviewUpdated: October 2026AISpotNav Editorial Team

e-means: FAIR Clustering in FAISS

e-means is Meta FAIR mini-batch clustering method, shipped in FAISS. The paper says it beats Lloyd k-means at 25 epochs in 1.4 to 2.6 epochs. Those speedups are the authors measurements.

e-means clusteringe-means faissfaiss e-means

e-means is a clustering method from FAIR at Meta and École Nationale des Ponts et Chaussées. The preprint is arXiv:2611.09501, "e-means: outperforming k-means (in one-tenth the epochs)," by Swann Bessa, Pierre-Emmanuel Mazaré, Gergely Szilvasy, Hugo Touvron, David Picard, Matthijs Douze, and Hervé Jégou. The code ships in FAISS under contrib/e_means, and the project site is e-means.github.io, including a browser demo. This guide sits in Open-Source AI Developer Stack. It is a library call, not a chat model. The speed figures below are the paper's and the README's. This page did not rerun them.


What it changes about k-means

Lloyd's algorithm passes over the data many times and moves each centroid to the mean of its points. The abstract says e-means instead uses an exponential moving average with mini-batches, plus a decay schedule, a dead-cluster revival rule, and a short finalization stage. A scaling law sets the batch size and the decay from the problem size, so the README says that beyond the number of clusters you do not bring extra hyperparameters.

The abstract's summary of the embedding tests: e-means reaches a test loss below Lloyd k-means at 25 epochs in 1.4 to 2.6 epochs, which the authors translate to 10–45× GPU wall-clock against the k-means implementations they compared. One example in the abstract is DINO10B, 10 billion DINO embeddings partitioned into 16 million clusters in 2.5 epochs, at a loss below Lloyd at 25 epochs. The README's shorter claim is about a 10× reduction in epochs and wall-clock, with lower loss than Lloyd. Use the paper when you need the range, and treat both as author measurements.

The FAISS changelog for 1.16.0, dated 9 November 2026, lists the e-means additions, including the reference implementation, distributed training, and the paper's benchmark scripts.


How to call it

The README says pip install faiss-cpu is enough for NumPy on CPU, and also for GPU runs, because the GPU path uses PyTorch rather than the FAISS CUDA build. GPU runs need a CUDA build of PyTorch. The README names CuTe kernels for H100 and H200, and Triton for other recent NVIDIA GPUs.

On CPU, the README's example is:

import numpy as np
from faiss.contrib.e_means import NumpyEmeans

x = np.random.rand(200_000, 64).astype("float32")
em = NumpyEmeans(64, 500)
centroids, labels = em.train(x)

NumpyEmeans(d, k) takes the dimension and the cluster count. The default nepochs in the README is 5, and fractional epochs such as 2.5 are allowed. Labels come from the last training epoch. The README says they are not always the nearest final centroid, because the centroids still moved during that epoch. Call assign when you need exact nearest-centroid labels.

On a GPU, pass a tensor that is already on the device. e-means does not copy CPU data to the GPU for you:

import torch
from faiss.contrib.e_means import Emeans

xg = torch.from_numpy(x).cuda().to(torch.bfloat16)
em = Emeans(64, 1024)
centroids, labels = em.train(xg)

em.recipe["assignment_backend"] tells you whether it picked CuTe, Triton, or the PyTorch fallback. The browser demo linked from the README is https://e-means.github.io/playground.html. The reproduction scripts are benchs/e_means in the FAISS repository.


Frequently Asked Questions

Does e-means replace FAISS search?

No. It trains centroids. You still build and query an index with the rest of FAISS. The clustering step is the part this method shortens.

Are the 10–45× figures independent?

No. They are the authors' comparison against the Lloyd implementations named in the paper, including Flash-KMeans on GPU. Read the preprint before you budget a cluster job from the headline.