Results
Experimental results
One machine (Apple M3 Ultra, PyTorch on the GPU through MPS and on 32 CPU cores), one exact evaluation for every method, five seeds for the mini-batch methods. "Best e-means" always means the better of e-means's two batch laws for that configuration. Loss is the exact train MSE on all training rows; held-out MSE is on 20,000 rows never seen in training.
Protocol
- Datasets: SIFT-128 (980k), GloVe-100 (1.16M, L2-normalised), NYTimes-256 (229k, L2-normalised), Fashion-MNIST-784 (40k), two synthetic Gaussian mixtures in 96 dimensions (balanced with 4,096 components; Zipf-imbalanced with 2,048), Deep-96 (10M). k from n/k ≈ 120 down to n/k ≈ 7; the e-means laws were fitted for n/k ≥ 8.
- Baselines: Lloyd@25 from random rows (3 seeds); greedy k-means++ seeding (50k sample, 3 trials, and once on the full data) followed by Lloyd@25; Sculley's mini-batch k-means (B = 4,096, 5 passes); e-means at 3 and 5 passes with its default throughput law and at 5 passes with its quality law (5 seeds). Same backend, same random rows per seed, same evaluation for all.
- h-means at 3 and 5 passes in total; its warm start costs about 0.1 pass and is counted.
- Three fixed h-means recipes ran on the full grid (v1, v2, v3, see the design exploration). "h-means" below is the final rule, which sets the EMA fraction from the points per cluster (0.4 below 24, 0.8 below 64, 1.0 above), applied to the logged runs: the v3 rows where it gives 0.4, the v2 rows where it gives 0.8, and later runs with EMA fraction 1.0 where it gives 1.0. Every fixed-recipe row appears in the per-configuration details below.
Main comparison at five passes
h-means train loss relative to the best e-means, all configurations
Negative is h-means better. Each point is one (dataset, k); bars are ± one seed standard deviation. Hover for seeds won.
| dataset | k | n / k | h-means T5 vs best e-means T5 | vs default law | h-means T3 vs best e-means T5 | held-out, vs best | seeds won | time e-means / h-means (s) |
| Fashion-MNIST-784 | 512 | 78 | −0.35% ± 0.04 | −0.52% | +0.01% | −0.19% | 5 / 5 | 0.2 / 0.9 |
| Fashion-MNIST-784 | 2,048 | 20 | −2.19% ± 0.04 | −2.53% | −1.49% | −0.40% | 5 / 5 | 0.3 / 1.1 |
| GloVe-100 | 16,384 | 71 | −0.03% ± 0.01 | −0.22% | +0.37% | +0.12% | 5 / 5 | 2.8 / 4.5 |
| GloVe-100 | 65,536 | 18 | −2.02% ± 0.01 | −2.57% | −1.21% | −0.09% | 5 / 5 | 18.6 / 16.4 |
| GloVe-100 | 131,072 | 9 | −4.44% ± 0.02 | −5.74% | −3.65% | +0.05% | 5 / 5 | 36.5 / 31.8 |
| GMM (d=96) | 8,192 | 61 | −0.18% ± 0.02 | −0.18% | −0.08% | +0.01% | 5 / 5 | 0.9 / 1.7 |
| GMM (d=96) | 32,768 | 15 | −1.62% ± 0.00 | −1.62% | −1.29% | +0.70% | 5 / 5 | 2.1 / 3.8 |
| GMM-Zipf (d=96) | 4,096 | 122 | −2.16% ± 0.17 | −2.16% | −1.92% | −2.15% | 5 / 5 | 0.6 / 1.7 |
| GMM-Zipf (d=96) | 16,384 | 31 | −0.89% ± 0.00 | −1.02% | −0.57% | −0.04% | 5 / 5 | 1.2 / 2.5 |
| NYTimes-256 | 4,096 | 56 | −0.46% ± 0.02 | −0.59% | +0.04% | −0.21% | 5 / 5 | 0.6 / 1.4 |
| NYTimes-256 | 16,384 | 14 | −3.15% ± 0.08 | −4.96% | −2.43% | −1.00% | 5 / 5 | 1.0 / 2.7 |
| NYTimes-256 | 32,768 | 7 | −6.70% ± 0.34 | −9.66% | −5.94% | −1.23% | 5 / 5 | 1.7 / 4.9 |
| SIFT-128 | 16,384 | 60 | −0.24% ± 0.00 | −0.43% | +0.46% | −0.03% | 5 / 5 | 2.7 / 3.5 |
| SIFT-128 | 65,536 | 15 | −2.26% ± 0.01 | −3.07% | −0.97% | −0.54% | 5 / 5 | 16.1 / 14.4 |
| SIFT-128 | 131,072 | 7 | −5.97% ± 0.01 | −7.26% | −4.27% | −1.12% | 5 / 5 | 31.8 / 27.1 |
- The gain is a function of points per cluster: 0.03 to 0.5% at n/k ≈ 60 to 80, 1 to 2.5% at 15 to 20, 4.5 to 7% at 7 to 9. h-means is below the best e-means on every configuration and every seed; the smallest margin is GloVe k = 16,384 (0.03%, within a seed standard deviation of a tie).
- Fewer passes for the same loss: at 15 points per cluster or fewer, h-means after three passes is already below e-means after five.
- Smaller seed variance: the seed standard deviation of h-means is typically 3 to 10 times smaller than that of e-means with its default law.
- Held-out loss follows the train loss at about a fifth of the size on the real datasets (lower on 11 of 15 configurations), and reverses on the balanced synthetic mixture at 15 points per cluster (+0.7%), where the exact passes fit the training rows of a perfectly separable problem. See the limitations below.
- Baselines are consistent with the literature: e-means at five passes beats Lloyd@25 by 0.7 to 3% except at NYTimes k = 32,768 (n/k = 7), where Lloyd is 1.4% better than e-means and h-means is 8.4% better than Lloyd. Sculley is 1.4 to 19% worse than e-means. k-means++ seeding plus Lloyd@25 is 0.5 to 1.3% worse than e-means at five passes and 50 to 100 times slower; seeding on the full SIFT data (419 s of seeding alone) is still 0.7% above e-means at five passes.
Per-configuration tables
Fashion-MNIST-784, n = 40,000, k = 512 (n/k = 78)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 1048168 ± 2.0e+2 | +0.95% | 1081577 | 25.00 | 0.1 |
| Sculley mini-batch T5 | 3 | 1065670 ± 5.5e+2 | +2.63% | 1092416 | 5.00 | 0.3 |
| e-means T3 | 5 | 1042219 ± 7.7e+2 | +0.37% | 1074969 | 3.00 | 0.3 |
| e-means T5 | 5 | 1038353 ± 6.5e+2 | +0.00% | 1072971 | 5.00 | 0.2 |
| e-means T5 quality | 5 | 1036569 ± 7.4e+2 | −0.17% | 1071933 | 5.00 | 1.3 |
| h-means T3 | 5 | 1036695 ± 8.0e+2 | −0.16% | 1071908 | 3.20 | 0.9 |
| h-means T5 | 5 | 1032910 ± 4.5e+2 | −0.52% | 1069871 | 5.20 | 0.9 |
| h-means T5 quality | 5 | 1031827 ± 6.4e+2 | −0.63% | 1069614 | 5.20 | 4.4 |
| h-means v1 T5 | 5 | 1034916 ± 4.5e+2 | −0.33% | 1071477 | 5.20 | 1.1 |
Fashion-MNIST-784, n = 40,000, k = 2,048 (n/k = 20)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 857746 ± 9.7e+2 | +2.51% | 972081 | 25.00 | 0.3 |
| Sculley mini-batch T5 | 3 | 881135 ± 4760 | +5.31% | 980159 | 5.00 | 0.3 |
| e-means T3 | 5 | 843138 ± 1218 | +0.77% | 960842 | 3.00 | 0.3 |
| e-means T5 | 5 | 836721 ± 8.7e+2 | +0.00% | 959237 | 5.00 | 0.3 |
| e-means T5 quality | 5 | 833864 ± 6.5e+2 | −0.34% | 958378 | 5.00 | 1.5 |
| h-means T3 | 5 | 821425 ± 6.1e+2 | −1.83% | 956715 | 3.13 | 1.2 |
| h-means T5 | 5 | 815590 ± 3.0e+2 | −2.53% | 954577 | 5.13 | 1.1 |
| h-means T5 quality | 5 | 815724 ± 3.0e+2 | −2.51% | 954636 | 5.13 | 5.6 |
| h-means v1 T5 | 5 | 817225 ± 5.7e+2 | −2.33% | 955191 | 5.13 | 1.0 |
GloVe-100, n = 1,163,514, k = 16,384 (n/k = 71)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 0.552558 ± 0.000059 | +0.93% | 0.577059 | 25.00 | 12.1 |
| k-means++ (50k sample) Lloyd@25 | 3 | 0.553374 ± 0.000038 | +1.08% | 0.578029 | 25.13 | 253.4 |
| Sculley mini-batch T5 | 3 | 0.598753 ± 0.00056 | +9.37% | 0.610350 | 5.00 | 10.4 |
| e-means T3 | 5 | 0.549935 ± 0.000087 | +0.45% | 0.573457 | 3.00 | 1.9 |
| e-means T5 | 5 | 0.547446 ± 0.000070 | +0.00% | 0.571889 | 5.00 | 2.8 |
| e-means T5 quality | 5 | 0.546400 ± 0.000049 | −0.19% | 0.571168 | 5.00 | 4.3 |
| h-means T3 | 5 | 0.548410 ± 0.000054 | +0.18% | 0.573222 | 3.10 | 3.2 |
| h-means T5 | 5 | 0.546249 ± 0.000038 | −0.22% | 0.571867 | 5.10 | 4.5 |
| h-means T5 quality | 5 | 0.545889 ± 0.000044 | −0.28% | 0.571725 | 5.10 | 7.7 |
| h-means v1 T5 | 5 | 0.546197 ± 0.000032 | −0.23% | 0.572513 | 5.10 | 4.4 |
GloVe-100, n = 1,163,514, k = 65,536 (n/k = 18)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 0.490937 ± 0.000049 | +2.19% | 0.560162 | 25.00 | 89.7 |
| Sculley mini-batch T5 | 3 | 0.538595 ± 0.00089 | +12.11% | 0.582215 | 5.00 | 25.6 |
| e-means T3 | 5 | 0.484113 ± 0.00012 | +0.77% | 0.554186 | 3.00 | 11.3 |
| e-means T5 | 5 | 0.480400 ± 0.000094 | +0.00% | 0.552880 | 5.00 | 18.6 |
| e-means T5 quality | 5 | 0.477735 ± 0.000062 | −0.55% | 0.552889 | 5.00 | 20.3 |
| h-means T3 | 5 | 0.471972 ± 0.000047 | −1.75% | 0.553928 | 3.10 | 11.2 |
| h-means T5 | 5 | 0.468074 ± 0.000030 | −2.57% | 0.552371 | 5.10 | 16.4 |
| h-means T5 quality | 5 | 0.467743 ± 0.000027 | −2.63% | 0.552191 | 5.10 | 21.6 |
| h-means v1 T5 | 5 | 0.468810 ± 0.000023 | −2.41% | 0.552481 | 5.10 | 17.4 |
GloVe-100, n = 1,163,514, k = 131,072 (n/k = 9)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 0.439650 ± 0.0000082 | +2.11% | 0.555786 | 25.00 | 184.4 |
| Sculley mini-batch T5 | 3 | 0.488218 ± 0.00024 | +13.39% | 0.570907 | 5.00 | 46.6 |
| e-means T3 | 5 | 0.435698 ± 0.00041 | +1.19% | 0.549644 | 3.00 | 21.9 |
| e-means T5 | 5 | 0.430573 ± 0.000040 | +0.00% | 0.548373 | 5.00 | 36.5 |
| e-means T5 quality | 5 | 0.424687 ± 0.00032 | −1.37% | 0.549975 | 5.00 | 38.4 |
| h-means T3 | 5 | 0.409203 ± 0.000015 | −4.96% | 0.551452 | 3.09 | 20.8 |
| h-means T5 | 5 | 0.405842 ± 0.000069 | −5.74% | 0.550226 | 5.09 | 31.8 |
| h-means T5 quality | 5 | 0.404415 ± 0.000027 | −6.08% | 0.550117 | 5.10 | 35.9 |
| h-means v1 T5 | 5 | 0.406203 ± 0.000054 | −5.66% | 0.550586 | 5.09 | 32.1 |
GMM (d=96), n = 500,000, k = 8,192 (n/k = 61)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 31.2786 ± 0.023 | +0.78% | 32.4075 | 25.00 | 2.4 |
| Sculley mini-batch T5 | 3 | 31.4805 ± 0.011 | +1.43% | 32.3055 | 5.00 | 2.7 |
| e-means T3 | 5 | 31.0886 ± 0.0097 | +0.16% | 32.2886 | 3.00 | 0.5 |
| e-means T5 | 5 | 31.0378 ± 0.0070 | +0.00% | 32.2890 | 5.00 | 0.9 |
| e-means T5 quality | 5 | 31.0371 ± 0.0056 | −0.00% | 32.2947 | 5.00 | 2.8 |
| h-means T3 | 5 | 31.0124 ± 0.0089 | −0.08% | 32.2892 | 3.10 | 1.5 |
| h-means T5 | 5 | 30.9815 ± 0.0072 | −0.18% | 32.2969 | 5.10 | 1.7 |
| h-means T5 quality | 5 | 30.9813 ± 0.0058 | −0.18% | 32.2975 | 5.10 | 6.0 |
| h-means v1 T5 | 5 | 30.9656 ± 0.0077 | −0.23% | 32.3064 | 5.10 | 2.0 |
GMM (d=96), n = 500,000, k = 32,768 (n/k = 15)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 28.6554 ± 0.00062 | +1.75% | 32.3288 | 25.00 | 9.2 |
| Sculley mini-batch T5 | 3 | 30.1279 ± 0.0030 | +6.97% | 32.3004 | 5.00 | 4.2 |
| e-means T3 | 5 | 28.1678 ± 0.013 | +0.01% | 32.5436 | 3.00 | 1.4 |
| e-means T5 | 5 | 28.1636 ± 0.0038 | +0.00% | 32.5489 | 5.00 | 2.1 |
| e-means T5 quality | 5 | 28.2222 ± 0.013 | +0.21% | 32.5192 | 5.00 | 3.3 |
| h-means T3 | 5 | 27.7997 ± 0.0014 | −1.29% | 32.7272 | 3.10 | 3.5 |
| h-means T5 | 5 | 27.7081 ± 0.00059 | −1.62% | 32.7777 | 5.10 | 3.8 |
| h-means T5 quality | 5 | 27.6993 ± 0.0011 | −1.65% | 32.7862 | 5.10 | 8.5 |
| h-means v1 T5 | 5 | 27.7223 ± 0.00091 | −1.57% | 32.7687 | 5.10 | 3.6 |
GMM-Zipf (d=96), n = 500,000, k = 4,096 (n/k = 122)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 32.6293 ± 0.089 | +3.04% | 33.6003 | 25.00 | 1.2 |
| Sculley mini-batch T5 | 3 | 37.6070 ± 0.81 | +18.76% | 38.3496 | 5.00 | 2.5 |
| e-means T3 | 5 | 31.8544 ± 0.079 | +0.59% | 32.7769 | 3.00 | 0.4 |
| e-means T5 | 5 | 31.6666 ± 0.077 | +0.00% | 32.6419 | 5.00 | 0.6 |
| e-means T5 quality | 5 | 32.1762 ± 0.13 | +1.61% | 33.2230 | 5.00 | 2.5 |
| h-means T3 | 5 | 31.0597 ± 0.065 | −1.92% | 31.9475 | 3.13 | 1.4 |
| h-means T5 | 5 | 30.9811 ± 0.054 | −2.16% | 31.9386 | 5.13 | 1.7 |
| h-means T5 quality | 5 | 31.3056 ± 0.038 | −1.14% | 32.3322 | 5.13 | 6.2 |
| h-means v1 T5 | 5 | 31.0683 ± 0.074 | −1.89% | 32.0489 | 5.13 | 2.0 |
GMM-Zipf (d=96), n = 500,000, k = 16,384 (n/k = 31)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 28.5311 ± 0.0023 | +1.20% | 30.8247 | 25.00 | 4.6 |
| Sculley mini-batch T5 | 3 | 32.2836 ± 0.077 | +14.51% | 33.5721 | 5.00 | 3.3 |
| e-means T3 | 5 | 28.3164 ± 0.012 | +0.44% | 30.8369 | 3.00 | 0.8 |
| e-means T5 | 5 | 28.1932 ± 0.0035 | +0.00% | 30.8088 | 5.00 | 1.2 |
| e-means T5 quality | 5 | 28.1582 ± 0.0059 | −0.12% | 30.8283 | 5.00 | 2.2 |
| h-means T3 | 5 | 27.9981 ± 0.0020 | −0.69% | 30.7939 | 3.11 | 2.2 |
| h-means T5 | 5 | 27.9066 ± 0.0012 | −1.02% | 30.8148 | 5.11 | 2.5 |
| h-means T5 quality | 5 | 27.8856 ± 0.0011 | −1.09% | 30.8131 | 5.11 | 7.0 |
| h-means v1 T5 | 5 | 27.8853 ± 0.0011 | −1.09% | 30.8309 | 5.11 | 2.8 |
NYTimes-256, n = 228,969, k = 4,096 (n/k = 56)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 0.730985 ± 0.00025 | +0.74% | 0.761385 | 25.00 | 1.0 |
| k-means++ (50k sample) Lloyd@25 | 3 | 0.729205 ± 0.00024 | +0.49% | 0.759260 | 25.66 | 53.9 |
| Sculley mini-batch T5 | 3 | 0.823581 ± 0.0051 | +13.50% | 0.839905 | 5.00 | 1.8 |
| e-means T3 | 5 | 0.730591 ± 0.00014 | +0.69% | 0.759311 | 3.00 | 0.4 |
| e-means T5 | 5 | 0.725616 ± 0.00027 | +0.00% | 0.755356 | 5.00 | 0.6 |
| e-means T5 quality | 5 | 0.724670 ± 0.00027 | −0.13% | 0.754786 | 5.00 | 2.4 |
| h-means T3 | 5 | 0.724934 ± 0.00012 | −0.09% | 0.755936 | 3.12 | 1.4 |
| h-means T5 | 5 | 0.721325 ± 0.00017 | −0.59% | 0.753169 | 5.12 | 1.4 |
| h-means T5 quality | 5 | 0.721005 ± 0.00013 | −0.64% | 0.752426 | 5.12 | 5.5 |
| h-means v1 T5 | 5 | 0.723070 ± 0.00013 | −0.35% | 0.754864 | 5.12 | 1.7 |
NYTimes-256, n = 228,969, k = 16,384 (n/k = 14)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 0.627850 ± 0.000060 | +0.31% | 0.721688 | 25.00 | 3.5 |
| Sculley mini-batch T5 | 3 | 0.716094 ± 0.00080 | +14.41% | 0.775475 | 5.00 | 1.9 |
| e-means T3 | 5 | 0.635280 ± 0.0059 | +1.50% | 0.724359 | 3.00 | 0.7 |
| e-means T5 | 5 | 0.625906 ± 0.0072 | +0.00% | 0.718948 | 5.00 | 1.0 |
| e-means T5 quality | 5 | 0.614229 ± 0.00087 | −1.87% | 0.712810 | 5.00 | 1.9 |
| h-means T3 | 5 | 0.599325 ± 0.000091 | −4.25% | 0.708778 | 3.10 | 2.0 |
| h-means T5 | 5 | 0.594855 ± 0.00051 | −4.96% | 0.705694 | 5.10 | 2.7 |
| h-means T5 quality | 5 | 0.594344 ± 0.00010 | −5.04% | 0.705634 | 5.11 | 10.2 |
| h-means v1 T5 | 5 | 0.596103 ± 0.00013 | −4.76% | 0.705779 | 5.10 | 2.4 |
NYTimes-256, n = 228,969, k = 32,768 (n/k = 7)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 0.543969 ± 0.000042 | −1.37% | 0.709567 | 25.00 | 7.1 |
| Sculley mini-batch T5 | 3 | 0.624395 ± 0.00095 | +13.21% | 0.741809 | 5.00 | 2.7 |
| e-means T3 | 5 | 0.565915 ± 0.0077 | +2.61% | 0.713856 | 3.00 | 1.1 |
| e-means T5 | 5 | 0.551540 ± 0.0080 | +0.00% | 0.706575 | 5.00 | 1.7 |
| e-means T5 quality | 5 | 0.534047 ± 0.0018 | −3.17% | 0.700823 | 5.00 | 2.7 |
| h-means T3 | 5 | 0.502311 ± 0.00091 | −8.93% | 0.695365 | 3.10 | 3.0 |
| h-means T5 | 5 | 0.498276 ± 0.0018 | −9.66% | 0.692202 | 5.10 | 4.9 |
| h-means T5 quality | 5 | 0.495315 ± 0.000087 | −10.19% | 0.694010 | 5.10 | 8.6 |
| h-means v1 T5 | 5 | 0.497698 ± 0.000072 | −9.76% | 0.692873 | 5.10 | 3.2 |
SIFT-128, n = 980,000, k = 16,384 (n/k = 60)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 38233 ± 5.6 | +1.07% | 41021 | 25.00 | 10.4 |
| k-means++ (50k sample) Lloyd@25 | 3 | 38328 ± 3.3 | +1.31% | 41190 | 25.15 | 201.6 |
| k-means++ (full data) Lloyd@25 | 1 | 38107 ± 0.0 | +0.73% | 40869 | 36.00 | 429.5 |
| Sculley mini-batch T5 | 3 | 39808 ± 46 | +5.23% | 41978 | 5.00 | 7.7 |
| e-means T3 | 5 | 38119 ± 3.6 | +0.76% | 40926 | 3.00 | 1.6 |
| e-means T5 | 5 | 37830 ± 2.5 | +0.00% | 40838 | 5.00 | 2.7 |
| e-means T5 quality | 5 | 37759 ± 2.7 | −0.19% | 40774 | 5.00 | 5.2 |
| h-means T3 | 5 | 37935 ± 1.7 | +0.28% | 40849 | 3.10 | 2.7 |
| h-means T5 | 5 | 37669 ± 1.3 | −0.43% | 40762 | 5.10 | 3.5 |
| h-means T5 quality | 5 | 37631 ± 2.7 | −0.53% | 40756 | 5.10 | 7.8 |
| h-means v1 T5 | 5 | 37790 ± 3.3 | −0.11% | 40818 | 5.10 | 4.2 |
SIFT-128, n = 980,000, k = 65,536 (n/k = 15)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 30581 ± 6.9 | +2.89% | 37200 | 25.00 | 79.5 |
| Sculley mini-batch T5 | 3 | 31949 ± 1.3e+2 | +7.49% | 37850 | 5.00 | 21.6 |
| e-means T3 | 5 | 30082 ± 24 | +1.21% | 36996 | 3.00 | 9.8 |
| e-means T5 | 5 | 29722 ± 14 | +0.00% | 36899 | 5.00 | 16.1 |
| e-means T5 quality | 5 | 29478 ± 2.7 | −0.82% | 36794 | 5.00 | 17.6 |
| h-means T3 | 5 | 29193 ± 1.9 | −1.78% | 36723 | 3.09 | 9.8 |
| h-means T5 | 5 | 28811 ± 3.8 | −3.07% | 36597 | 5.09 | 14.4 |
| h-means T5 quality | 5 | 28757 ± 2.8 | −3.25% | 36584 | 5.09 | 19.4 |
| h-means v1 T5 | 5 | 28917 ± 3.2 | −2.71% | 36646 | 5.09 | 15.9 |
SIFT-128, n = 980,000, k = 131,072 (n/k = 7)
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 3 | 25059 ± 4.6 | +4.39% | 34996 | 25.00 | 158.1 |
| Sculley mini-batch T5 | 3 | 26646 ± 82 | +11.00% | 35628 | 5.00 | 37.5 |
| e-means T3 | 5 | 24326 ± 29 | +1.33% | 34795 | 3.00 | 18.7 |
| e-means T5 | 5 | 24006 ± 40 | +0.00% | 34729 | 5.00 | 31.8 |
| e-means T5 quality | 5 | 23678 ± 5.8 | −1.37% | 34604 | 5.00 | 33.9 |
| h-means T3 | 5 | 22666 ± 3.6 | −5.58% | 34326 | 3.09 | 18.3 |
| h-means T5 | 5 | 22264 ± 1.8 | −7.26% | 34216 | 5.09 | 27.1 |
| h-means T5 quality | 5 | 22222 ± 5.8 | −7.43% | 34240 | 5.09 | 31.4 |
| h-means v1 T5 | 5 | 22407 ± 3.8 | −6.66% | 34258 | 5.09 | 29.7 |
Dependence on k (SIFT-128)
SIFT-128, n = 980,000, k from 2,048 to 262,144, three seeds, five passes.
h-means train loss relative to the best e-means, SIFT-128, 5 passes
Negative is h-means better. Bars show ± one seed standard deviation.
| k | n / k | e-means T5 | e-means T5 quality | h-means T5 | h-means vs best | time e-means / h-means (s) |
| 2,048 | 479 | 47239 ± 4 | 47200 ± 5 | 47213 ± 2 | +0.03% | 0.7 / 2.0 |
| 4,096 | 239 | 44192 ± 5 | 44148 ± 3 | 44157 ± 2 | +0.02% | 1.0 / 2.3 |
| 8,192 | 120 | 41113 ± 8 | 41051 ± 2 | 41040 ± 2 | −0.03% | 1.5 / 2.6 |
| 16,384 | 60 | 37831 ± 2 | 37757 ± 1 | 37668 ± 1 | −0.24% | 2.6 / 3.7 |
| 32,768 | 30 | 34185 ± 9 | 34024 ± 1 | 33705 ± 4 | −0.94% | 4.5 / 6.1 |
| 65,536 | 15 | 29718 ± 16 | 29480 ± 2 | 28809 ± 4 | −2.28% | 15.1 / 15.5 |
| 131,072 | 7 | 23996 ± 49 | 23681 ± 5 | 22264 ± 1 | −5.98% | 30.4 / 29.1 |
| 262,144 | 4 | 16714 ± 68 | 16448 ± 10 | 14026 ± 0 | −14.73% | 60.0 / 67.1 |
Above two hundred points per cluster h-means (EMA fraction 1.0 there) ties e-means with the quality law within ±0.03% and is 0.05 to 0.2% below its default law. From sixty points per cluster down the gap widens to 15% at four points per cluster, where Lloyd's algorithm is itself competitive with e-means. With a fixed 0.4 EMA fraction the large-k end was 0.25% worse than e-means and the small end 14.7% better; with a fixed 0.8 fraction, 0.07% worse and 7.4% better.
Held-out loss as a function of passes
Seed 0, held-out MSE after every pass. Dashed: three-pass runs; dotted: e-means quality law. The last point of each curve is the final centroids after e-means's last-pass finalisation, which is why the e-means curves can tick up at the end.
Deep-96 at 10M rows
Deep-96, 9.97M training rows, k = 65,536 (152 points per cluster), two seeds. This is the regime of IVF training the e-means authors target: h-means is 0.2% below e-means in 10% less time (EMA fraction 1.0; the fixed 0.4 split was a tie).
| method | seeds | train MSE | vs e-means T5 | held-out MSE | passes | time (s) |
| Lloyd@25 (random init) | 1 | 0.330926 | +0.50% | 0.342026 | 25.00 | 733 |
| e-means T3 | 2 | 0.330463 | +0.36% | 0.341167 | 3.00 | 93 |
| e-means T5 | 2 | 0.329273 | +0.00% | 0.340803 | 5.00 | 151 |
| h-means T3 | 2 | 0.329802 | +0.16% | 0.340643 | 3.09 | 92 |
| h-means T5 | 2 | 0.328614 | −0.20% | 0.340295 | 5.09 | 135 |
CPU wall-clock time
PyTorch CPU backend, 32 cores, three seeds. The official faiss implementation (NumpyEmeans) is included as a reference; its assignment runs through faiss.knn, which is about four times slower than a torch matmul on this machine, so compare the two torch rows.
| dataset | k | method | train MSE | time (s) | passes |
| GloVe-100 | 16,384 | e-means T5 (torch cpu) | 0.547438 | 23.3 | 5.00 |
| GloVe-100 | 16,384 | e-means official (faiss cpu) T5 | 0.547465 | 90.9 | 5.00 |
| GloVe-100 | 16,384 | lloyd@25 (torch cpu) | 0.552574 | 118.8 | 25.00 |
| GloVe-100 | 65,536 | e-means T5 (torch cpu) | 0.480463 | 98.8 | 5.00 |
| GloVe-100 | 65,536 | e-means official (faiss cpu) T5 | 0.480476 | 324.5 | 5.00 |
| GloVe-100 | 65,536 | h-means T3 (torch cpu) | 0.471999 | 59.0 | 3.10 |
| GloVe-100 | 65,536 | h-means T5 (torch cpu) | 0.468068 | 92.4 | 5.10 |
| SIFT-128 | 16,384 | e-means T5 (torch cpu) | 37830 | 19.6 | 5.00 |
| SIFT-128 | 16,384 | e-means official (faiss cpu) T5 | 37830 | 76.8 | 5.00 |
| SIFT-128 | 16,384 | h-means T3 (torch cpu) | 37931 | 12.1 | 3.10 |
| SIFT-128 | 16,384 | h-means T5 (torch cpu) | 37668 | 19.0 | 5.10 |
| SIFT-128 | 16,384 | lloyd@25 (torch cpu) | 38234 | 100.5 | 25.00 |
| SIFT-128 | 65,536 | e-means T5 (torch cpu) | 29718 | 78.7 | 5.00 |
| SIFT-128 | 65,536 | e-means official (faiss cpu) T5 | 29719 | 304.0 | 5.00 |
| SIFT-128 | 65,536 | h-means T3 (torch cpu) | 29191 | 40.6 | 3.09 |
| SIFT-128 | 65,536 | h-means T5 (torch cpu) | 28809 | 61.0 | 5.09 |
Ablations
Five passes, five seeds, each component switched off in turn, relative to the recipe with the fixed 0.4 EMA fraction (the final rule's choice at 15 and 18 points per cluster; at 60 and 122 the rule picks 0.8 and 1.0, which appear as rows). Sorted by train MSE.
SIFT-128 k=65,536
| variant | train MSE | vs full | time (s) |
| ema_frac 0.8 (v2 split) | 28788 | −0.08% | 14.4 |
| h-means (full) | 28811 | +0.00% | 15.6 |
| - SSE donors (mass donors) | 28811 | +0.00% | 14.3 |
| - SSE allocation (uniform children) | 28844 | +0.11% | 14.1 |
| - Hartigan in EMA phase | 28917 | +0.37% | 14.9 |
| - warm start | 28986 | +0.61% | 13.8 |
| - Hartigan tail (EMA only, same passes) | 29243 | +1.50% | 14.1 |
| ema_frac 1.0 (no tail, Hartigan-EMA only) | 29243 | +1.50% | 14.3 |
| e-means + Hartigan-EMA only | 29436 | +2.17% | 12.8 |
| - Hartigan rule in tail (Lloyd-rule tail) | 29572 | +2.64% | 16.0 |
| e-means (all off) | 29730 | +3.19% | 15.1 |
SIFT-128 k=16,384
| variant | train MSE | vs full | time (s) |
| ema_frac 0.8 (v2 split) | 37669 | −0.25% | 3.7 |
| - Hartigan tail (EMA only, same passes) | 37672 | −0.24% | 3.7 |
| ema_frac 1.0 (no tail, Hartigan-EMA only) | 37672 | −0.24% | 3.8 |
| e-means + Hartigan-EMA only | 37711 | −0.14% | 2.7 |
| h-means (full) | 37764 | +0.00% | 4.1 |
| - SSE donors (mass donors) | 37764 | +0.00% | 4.0 |
| - SSE allocation (uniform children) | 37767 | +0.01% | 4.0 |
| - Hartigan in EMA phase | 37790 | +0.07% | 4.0 |
| e-means (all off) | 37831 | +0.18% | 2.7 |
| - warm start | 37841 | +0.20% | 3.1 |
| - Hartigan rule in tail (Lloyd-rule tail) | 37973 | +0.55% | 4.2 |
GMM-Zipf (d=96) k=4,096
| variant | train MSE | vs full | time (s) |
| ema_frac 1.0 (no tail, Hartigan-EMA only) | 30.9568 | −0.31% | 1.7 |
| ema_frac 0.8 (v2 split) | 30.9641 | −0.28% | 1.7 |
| - Hartigan tail (EMA only, same passes) | 30.9784 | −0.24% | 1.7 |
| - Hartigan in EMA phase | 31.0492 | −0.01% | 2.1 |
| - SSE donors (mass donors) | 31.0495 | −0.01% | 2.1 |
| h-means (full) | 31.0522 | +0.00% | 2.2 |
| - Hartigan rule in tail (Lloyd-rule tail) | 31.1191 | +0.22% | 2.0 |
| e-means + Hartigan-EMA only | 31.6389 | +1.89% | 0.8 |
| e-means (all off) | 31.6988 | +2.08% | 0.7 |
| - warm start | 31.9150 | +2.78% | 1.2 |
| - SSE allocation (uniform children) | 33.9888 | +9.46% | 1.8 |
GloVe-100 k=65,536
| variant | train MSE | vs full | time (s) |
| - SSE donors (mass donors) | 0.468065 | −0.00% | 16.3 |
| h-means (full) | 0.468067 | +0.00% | 16.4 |
| - SSE allocation (uniform children) | 0.468465 | +0.08% | 15.7 |
| - Hartigan in EMA phase | 0.468836 | +0.16% | 17.3 |
| - warm start | 0.470682 | +0.56% | 14.8 |
| ema_frac 0.8 (v2 split) | 0.471041 | +0.64% | 16.3 |
| - Hartigan tail (EMA only, same passes) | 0.475586 | +1.61% | 16.2 |
| ema_frac 1.0 (no tail, Hartigan-EMA only) | 0.475602 | +1.61% | 16.0 |
| e-means + Hartigan-EMA only | 0.477000 | +1.91% | 14.3 |
| - Hartigan rule in tail (Lloyd-rule tail) | 0.478863 | +2.31% | 18.9 |
| e-means (all off) | 0.480423 | +2.64% | 17.8 |
Every component except the loss-proportional donors matters somewhere. The Hartigan rule in the tail is the largest single lever at small n/k; a Lloyd-rule tail with identical bookkeeping gains nothing. The warm start is worth 0.3 to 2.3% and its loss-proportional allocation is what makes it survive imbalance (uniform children: +9% on the Zipf mixture). "e-means (all off)" is the faithful reimplementation.
Limitations
- Regime. Above about two hundred points per cluster h-means ties e-means's quality law on SIFT (±0.03%); its clear wins are a small-cluster effect. In the IVF-training regime the e-means authors target (hundreds of points per cluster) it is a tie to a small win (Deep-10M: 0.2%).
- Held-out. Train gains carry to held-out loss at about a fifth of their size on real data and can reverse on separable synthetic data at 15 points per cluster.
- The pass split is a heuristic in n/k only. Its thresholds (24 and 64 points per cluster) were set from the grid, the SIFT sweep and one synthetic check; the ablation shows the 0.4 and 0.8 splits within 0.1% of each other at 15 points per cluster and 0.6% apart at 18, so the lower threshold is soft. Separability and imbalance are not used.
- Selection on the reported grid. The final recipe was chosen after seeing all three recipes on the full grid. The k sweep, Deep-10M, CPU and ablation runs were made afterwards; the main grid should be read as "best of three recipes", all three of which beat e-means at small n/k.
- Hyperparameters. For the user h-means has the same two inputs as e-means, k and the pass budget; batch and step sizes follow the e-means laws, and the coarse level (k/16), the two local Lloyd iterations and the EMA constants are fixed. The one method constant e-means does not have, the pass split as a function of n/k, was set on the grid evaluated here, whereas the e-means laws were fitted on a dedicated sweep and evaluated elsewhere. Deep-10M and the ends of the SIFT sweep, run after the rule was fixed, are its only out-of-sample checks.
- Wall-clock at small scale. On problems that take e-means under five seconds on the accelerator, h-means is two to five times slower at equal passes: the warm start and the per-batch Hartigan bookkeeping are fixed costs. On the large problems it is 10 to 15% faster at equal passes, and h-means at three passes gives a lower loss than e-means at five in 60% of the time. Distance computations are the hardware-independent comparison.
- One machine, one backend. Everything ran on one Apple M3 Ultra through PyTorch. The official faiss implementation was used only as a correctness cross-check on CPU.
- Memory. The exact passes keep one int64 label per point and the exact per-cluster sums; e-means keeps only the centroids.
- Low-d playground. The 2-D demos show 35 to 48% lower loss, in the regime the e-means authors flag as outside their laws. It is a demonstration, not part of the claim.