e-means: outperforming k-means (in one-tenth the epochs)
This lightning talk presents e-means, an exponential-moving-average-based optimizer that dramatically accelerates large-scale k-means clustering. By combining EMA sufficient statistics with cosine decay, dead-cluster revival, and empirically fitted scaling laws, e-means reaches the test distortion of 25-iteration Lloyd's algorithm in just 1.4 to 2.6 epochs—delivering 9.5× to 45.5× wall-clock speedups across billion-scale embedding datasets. The method eliminates manual tuning while often achieving lower final distortion than both random and k-means++ initialized baselines, scaling to ten billion vectors with approximate assignment.Script
K-means clustering is everywhere, but Lloyd's algorithm demands 25 exhaustive passes through your data to converge. What if you could get better results in just two epochs?
E-means replaces Lloyd's iterative assignment-update loop with exponential moving averages of cluster statistics. Instead of recomputing exact centroids from scratch each iteration, it maintains weighted counts and sums that adapt quickly early on and stabilize as training progresses.
The method combines three mechanisms: a cosine schedule that decays the effective step size from aggressive early updates to gentle refinement, automatic revival that splits healthy clusters to replace dead ones every five batches, and a finalization stage that separates training-set optimization from out-of-sample performance. Dead-cluster revival alone prevents over 4,000 clusters from vanishing on million-point datasets.
The authors fitted scaling laws from 75,000 optimization runs, discovering that peak step size scales with batch to the 0.9 power but inversely with cluster count and dataset size. These laws achieve 95 percent R-squared fit and median regret below 0.2 percent on held-out configurations, eliminating manual tuning while transferring across image descriptors, text embeddings, and transformer representations.
On billion-scale embeddings, e-means reaches Lloyd's 25-iteration test error in 1.4 to 2.6 epochs and delivers wall-clock speedups from 9.5 times to 45.5 times on a single GPU. More striking: it converges to lower final distortion than greedy k-means++ initialized Lloyd, despite starting from random centroids.
At ten billion vectors and 16.7 million clusters, exact assignment becomes impractical, so the method switches to approximate nearest-centroid search. The result: partitioning ten terabytes of DINOv3 embeddings in 22.8 GPU-hours on a single machine. If you want clustering that scales without tuning paralysis, explore e-means at EmergentMind.com and generate your own deep dives into the methods reshaping large-scale learning.