All articles

e-means: k-means in a Tenth of the Passes, and Why IVF Search Should Care

e-means trains k-means centroids in far fewer passes. For IVF vector search, the opportunity is cheaper rebuilds and finer partitions, but recall per byte still needs measuring.

Updated

A compact blue sculptural mechanism reshapes a broad field of loose pieces into distinct clusters, illustrating less training work to build useful search partitions.

The centroids in an inverted-file vector index decide which parts of the collection each query will read. Yet training those centroids often gets a fixed budget: a sample of the data, a capped iteration count, then no further attention until the next rebuild. Expensive training makes that compromise understandable.

Our IVF explainer covers how centroids, list scans and compressed codes fit together. This follow-up focuses on the cost of training those centroids.

e-means is a mini-batch optimizer for the standard k-means objective. It maintains moving averages of cluster counts and vector sums, updating centroids throughout a pass instead of waiting for the entire dataset. Its value for search is cheaper partition training; it does not, by itself, optimize recall, query traffic or storage reads. Bessa et al.'s November 2026 paper gives IVF builders a reason to revisit that training budget.

IVF quality starts with the partition

An inverted-file index, or IVF index, divides vectors into lists represented by centroids. A query searches the centroids, chooses a subset of lists, then examines their contents. The nprobe parameter controls how many lists are visited. Missing the list containing a true neighbor creates an approximate-search error. Faiss documents this search process.

Think of a library searched through shelf labels. Good labels guide you to a few useful shelves. A relevant book filed near a boundary can sit on a shelf whose label looks less promising, so you must visit more shelves to find it. Bigger shelves also take longer to inspect. Two indexes with the same number of shelves visited can do very different amounts of work.

Problem Effect on search Does ordinary e-means solve it?
Training stops before useful centroids emerge Poor routing at the available build budget It can reach lower clustering error sooner
A neighbor lies across a partition boundary More lists may need probing No boundary-recall guarantee
Lists have unequal lengths Uneven scan work and latency No equal-size constraint
Production queries favor a small region Data density can be a poor guide to useful partitioning No query-weighted objective

These problems need different remedies. Google's SOAR adds secondary assignments chosen to reduce correlated retrieval failures, trading extra storage for better access to neighbors. SuperKMeans includes early termination based on centroid retrieval quality. Faster optimization of squared error is another useful tool, but it does not replace those search-specific decisions.

What changes inside the training loop

The standard k-means objective is mean squared distance from each vector to its nearest centroid, usually shortened to MSE. Lloyd's algorithm assigns the dataset to centroids and recomputes each centroid once per full pass. e-means updates running statistics after each mini-batch. If s and n are a batch's vector sum and count for one cluster, the core update is:

sum   = (1 - alpha) * sum   + alpha * s
count = (1 - alpha) * count + alpha * n
centroid = sum / count

Older assignments gradually lose influence. Here alpha controls how much weight the new batch receives; both the sum and the count must be updated before taking their ratio. With a full-dataset batch and step size one, this core update reduces to Lloyd's recomputation.

The distinction matters operationally: an epoch measures data processed, not the number of centroid updates. Step through one pass below. Lloyd accumulates assignments with its centroid held fixed; the e-means update changes it after each batch. With multiple clusters, those new positions can change where the next batch's vectors are assigned.

One pass reads four batches: [2, 4], [6, 8], [4, 6], [8, 10]. Starting at centroid 2, Lloyd holds it fixed until all eight points are read, then moves it to their mean, 6. With alpha 0.5 and initial running sum 4 and count 2, the e-means core update moves the centroid after each batch: 2.5, 4.75, 4.875, 6.9375. Both methods have read the same data; one has updated once, the other four times.

One cluster in one dimension isolates update timing. Step forward or back through the same eight points. Squares mark centroids on a shared scale. The e-means rule uses fixed alpha = 0.5, initial sum = 4 and count = 2, with no scheduling, revival or finalization. This is a worked example of the update rule, not a convergence or speed benchmark. Requires JavaScript for controls.

More updates alone do not establish the reported speedup. The project explanation also describes a cosine schedule that reduces the update step, revival of underused clusters by splitting larger ones, and empirical scaling laws that select batch size and step size. The paper's default finalization step replaces the running centroids with the means of their last-epoch assignments. Those assignments were made while centroids were moving; this is not another full nearest-centroid assignment pass.

Reviving an almost unused centroid also differs from enforcing balanced lists. The project now separately describes Balanced e-means, which adds cluster biases to encourage equal sizes. The ordinary e-means results discussed here should not be read as results for that additional method.

What the measurements establish

The paper reports beating the loss of 25 Lloyd epochs in 1.4 to 2.6 epochs, with 10-45x GPU wall-clock speedups against its comparison implementations. Those are clustering results, not query-latency speedups. The authors' project site separately reports 8-15x CPU speedups against Faiss.

At the largest scale, Appendix M, Table 21 reports clustering 10 billion vectors into 16,777,216 centroids. Exact-assignment e-means beats the 25-epoch Lloyd test-error target in 2.5 epochs and 779 aggregate GPU-hours; IVF-accelerated assignment does so in 3 epochs and 23.2 GPU-hours. That is about 34x less GPU time than exact-assignment e-means, with one eight-GPU machine rather than 32 machines. The paper cautions that matching test error favors approximate assignment; matching the baseline's training error requires a different budget. Clustering for search is itself accelerated by search.

Retrieval evidence is encouraging but narrower. Appendix L evaluates IVF recall@10 across eleven in-distribution VIBE datasets, at 0.1% and 1% selectivity, using medians over twenty seeds. It finds faster convergence to similar or better recall on most datasets. It does not establish an object-storage p99 improvement. As checked on November 28, 2026, the arXiv record lists only v1 and no publication venue.

For an engineering decision, separate three questions: how long training takes, how well held-out queries retrieve neighbors, and how much work those queries cause. Lower clustering error is a proxy, not a measurement of retrieval quality. The reported CPU results are useful evidence too, but neither CPU nor GPU speedups establish the payoff for a different build pipeline or a small collection whose training already takes seconds.

Translate partition quality into bytes and requests

Cheaper training creates room to rebuild after distribution changes, train on a larger sample, or try more centroids. Those are opportunities to test. More centroids also consume routing memory, and finer partitions can require more probes at the same recall. Training on every vector still has a data-loading cost.

For cold data, storage layout adds another constraint. A list can require one range request, several reads, or no remote read if cached. Adjacent ranges may be coalesced. Consequently, nprobe is neither a byte count nor a GET count. S3 prices requests separately, so request behavior belongs beside transfer volume in the cost model.

Consider an illustration, not a benchmark: 10 million 768-dimensional vectors, with a one-bit-per-dimension payload of 96 bytes each. Assume 4,096 equal-length lists, uncached codes, and one GET per selected list. Ignore identifiers, quantizer metadata, full-vector rescoring and request overhead.

Average list payload = 10,000,000 / 4,096 * 96 = 234,375 bytes
16 lists             = 3,750,000 bytes and 16 GETs
12 lists             = 2,812,500 bytes and 12 GETs

If a different training recipe reached the same recall with twelve such lists, code payload and request count would each fall 25%. That conditional is the experiment. The e-means paper does not supply this reduction, and unequal list sizes can erase it. Agent workloads amplify whatever the actual per-query difference turns out to be.

Evaluate the trainer as part of the index

WarpSearch's vector index uses IVF over quantized codes, with exact rescoring of selected candidates and exact scans for small segments. Merged segments receive fresh indexes. That makes cheaper centroid training relevant to recurring maintenance, alongside initial ingestion. For WarpSearch, e-means is a candidate to benchmark against the current trainer.

An evaluation should hold the embedding dataset, metric, code format and held-out queries constant, then compare training recipes under the same compute budget. Sweep probe counts to find matched recall. Report build time, cold and warm bytes read, request counts, list-size distribution and p99 latency. Repeat with documents added after training to expose stale partitions.

There is also a concrete integration trap. The Faiss e-means README says labels returned by training come from the last epoch, while centroids were still moving. They are not necessarily assignments to the nearest final centroid. If your IVF construction requires that relationship, run a final assignment and include its cost in the benchmark.

Takeaways

  • e-means reduces the cost of optimizing the usual k-means objective; recall and list balance remain separate concerns.
  • Spend the saved build budget deliberately: fresher partitions, larger training samples or more centroids.
  • Compare recall against bytes and requests, alongside tail latency. Equal probe counts do not imply equal work.
  • Treat the reported speedups as reasons to run an index experiment, not as predicted query savings.

Next, The Next Generation of Vector Search Won't Fit in RAM puts training, compact codes and selective reads into the broader case for cost-efficient vector search at a billion vectors.

Cookie settings

Optional tracking stays off until you choose it. Your choice applies to this browser for 180 days. Read the details.

Essential storage keeps you signed in, protects forms, and remembers this choice. It is always available.