KEO
A reproducible evaluation of k-means, e-means and o-means on independent datasets.
Preliminary Results so far cover four embedding datasets and three physics datasets (HIGGS, and CaloChallenge 2022 Dataset 1 photons and pions), with 3 random seeds each.
The question
Two recent papers report that e-means matches k-means quality in roughly 1.4–2.6 passes over the data, and that o-means cuts the cost of nearest-centroid search further. None of our test datasets is in either paper's evaluation list: four embedding sets (GloVe-100, NYTimes-256, Fashion-MNIST, GIST-960) and three physics sets: HIGGS collision events, and the photon and pion showers of CaloChallenge 2022 Dataset 1. Do the reported improvements generalize to datasets that were not used to develop or tune them?
KEO runs all three algorithms under one protocol: the same data, initialization, metrics and result store. Every result records which implementation produced it.
The three algorithms
K k-means
Lloyd's algorithm with exact assignment and centroid updates. The baseline.
Lloyd (1982)
E e-means
Mini-batch k-means with EMA updates, cosine step scheduling, scaling laws and dead-cluster revival.
Bessa et al. (2026) · arXiv
O o-means
e-means with a two-level inverted-file index over the centroids, so assignment compares against far fewer of them.
Bajaj, Nupur, Garg (2026) · project page only
What we found so far
Target: Lloyd's k-means after 25 iterations (Lloyd@25). 4 datasets, Apple M4 CPU, 3 seeds each, preliminary. Medians over 3 seeds.
for e-means to match Lloyd@25 across all four datasets. Lloyd itself used 25. The number needed varies by dataset.
for our o-means reconstruction on GloVe-100 at k = 16,384, against 1.90 for e-means.
for o-means on NYTimes-256 at k = 16,384, against 3.04 for e-means. The big GloVe saving did not carry over.
for o-means on GIST-960 at k = 4,096, against 2.49 for e-means. A moderate saving at a small k.
Our e-means and the authors' differ by up to 1.95% test MSE at fractional pass budgets (Fashion-MNIST) and up to 0.70% at integer budgets (NYTimes-256), against a 0.5% target.
Cost to match Lloyd@25
Passes over the data, and full-scan equivalents (distance computations ÷ n×k, index upkeep included). Lower is better.
| Dataset | k | Passes | Full scans | |||
|---|---|---|---|---|---|---|
| e-means (ours) | e-means (authors) | o-means | e-means (ours) | o-means | ||
| GloVe-100 | 4,096 | 1.93 | 2.11 | 1.96 | 1.92 | 1.10 |
| GloVe-100 | 16,384 | 1.91 | 1.71 | 1.82 | 1.90 | 0.26 |
| GloVe-100 | 32,768 | 1.78 | 1.47 | 1.44 | 1.77 | 0.14 |
| NYTimes-256 | 4,096 | 1.98 | 1.91 | 2.27 | 1.91 | 1.54 |
| NYTimes-256 | 16,384 | 3.19 | 3.10 | 4.69 | 3.04 | 2.24 |
| Fashion-MNIST | 2,048 | 1.74 | 1.36 | 1.62 | 1.72 | 0.41† |
| GIST-960 | 4,096 | 2.54 | 2.46 | 1.90 | 2.49 | 1.05 |
† One of 3 seeds was already below Lloyd@25 at the smallest budget (1 pass) and counts as 1 pass.
Read this before quoting any of it
- o-means is our reconstruction. The paper is unreleased and the authors' code was not available.
- Four datasets, one machine (Apple M4, CPU only), 3 seeds each. No significance tests.
- k and the dataset size differ between datasets, so a difference between datasets cannot be put down to the data alone.
- Costs are counted in distance computations. CPU wall-clock times are indicative only.
- We have not yet found out why o-means saves so little on NYTimes-256.
A physics dataset: HIGGS
10,978,000 simulated collision events, 28 features (z-scored), k = 4,096, 3 seeds, test set 10,431 events. Reported on its own, not pooled with the embedding datasets above.
Cost to match Lloyd@25
| Dataset | k | Passes | Full scans | |||
|---|---|---|---|---|---|---|
| e-means (ours) | e-means (authors) | o-means | e-means (ours) | o-means | ||
| HIGGS | 4,096 | 1.73 | 1.47 | 1.80 | 1.69 | 0.96 |
Median over 3 seeds. Across seeds, e-means (ours) crossed at 1.30 to 3.10 passes and o-means at 1.69 to 2.59.
- k-means is 8.4% above its own 25-pass answer after 1 pass and 0.7% after 10. e-means is within about 0.5% from the first pass.
- The whole e-means and o-means curve sits within about plus or minus 0.5% of Lloyd@25, so the crossing points are real but come from a very flat curve. Across seeds, e-means (ours) crossed at 1.30 to 3.10 passes.
- o-means needs about the same number of passes as e-means (1.80 against 1.73) but costs 0.96 full scans against 1.69, and it missed the true nearest centre for only about 0.1% of points (on GloVe-100 it was about 3%).
- Our e-means and the authors' agree within 0.30% at every budget, inside the 0.5% target. That held on HIGGS but not on three of the four embedding datasets.
Read this before quoting it
- These are physics features, not embeddings, and neither paper evaluates them. The e-means paper describes its method for embedding datasets.
- One k (4,096), 3 seeds, one machine. Six of the 28 features are azimuth angles that carry no signal on their own; we kept all 28.
- The dataset comes from OpenML (a copy of the UCI HIGGS file); only its first rows were compared with the UCI original.
Featured post
Clustering a Particle Detector: e-Means and o-Means on CaloChallenge 2022 Dataset 1 (ATLAS Photon and Pion Showers) What happens when e-means and o-means are tested on detector data instead of embeddings? We benchmark them on 121,000 simulated photon showers (368 voxels each) and 120,800 pion showers (533 voxels each) from CaloChallenge 2022, Dataset 1. 52 min read →Quick start
pip install keo
keo download glove100 # ~460 MB, SHA-256 verified
keo smoke # end-to-end check, about 10 seconds
keo figures smokePython 3.8 to 3.14. Current release: keo 0.1.5.
Reproduce the GloVe results
git clone https://github.com/rajveer43/keo.git && cd keo
uv sync
bash scripts/run_main_glove.shHIGGS (OpenML copy of the UCI file) is converted first, then run like any other benchmark:
curl -LO https://data.openml.org/datasets/0004/45570/dataset_45570.pq
python scripts/convert_physics_dataset.py dataset_45570.pq \
--out data/higgs28/higgs28.hdf5 --exclude Target --test-fraction 0.002 --seed 0
keo run bench_higgs28The script runs the full-dataset experiments from the repository root. Configs are in configs/experiments, the run summary is results/main_glove/RUN_SUMMARY.md, and the script is scripts/run_main_glove.sh.
Cite
@software{keo,
author = {Rathod, Rajveer},
title = {KEO: a reproducible benchmark of k-means, e-means and o-means},
doi = 10.5281/zenodo.24273473,
url = https://github.com/rajveer43/keo,
license = MIT
}Metadata also in CITATION.cff.