KEOClustering benchmark

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.

Read the blog post GitHub PyPI

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.

1.4 to 3.2
passes

for e-means to match Lloyd@25 across all four datasets. Lloyd itself used 25. The number needed varies by dataset.

0.26
full scans

for our o-means reconstruction on GloVe-100 at k = 16,384, against 1.90 for e-means.

2.24
full scans

for o-means on NYTimes-256 at k = 16,384, against 3.04 for e-means. The big GloVe saving did not carry over.

1.05
full scans

for o-means on GIST-960 at k = 4,096, against 2.49 for e-means. A moderate saving at a small k.

Failed
parity gate

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.

DatasetkPassesFull scans
e-means (ours)e-means (authors)o-meanse-means (ours)o-means
GloVe-1004,0961.932.111.961.921.10
GloVe-10016,3841.911.711.821.900.26
GloVe-10032,7681.781.471.441.770.14
NYTimes-2564,0961.981.912.271.911.54
NYTimes-25616,3843.193.104.693.042.24
Fashion-MNIST2,0481.741.361.621.720.41†
GIST-9604,0962.542.461.902.491.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

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.

How 4,096 clusters form on HIGGS. The 2-D picture is a squash of 28 features that keeps 21.6% of the spread, and the dots are interpolated between measured passes (seed 0). The film shows the benchmark run itself: every frame is drawn from its stored results. 66 seconds, with sound effects.

Cost to match Lloyd@25

DatasetkPassesFull scans
e-means (ours)e-means (authors)o-meanse-means (ours)o-means
HIGGS4,0961.731.471.801.690.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.

Read this before quoting it

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 →

All posts

Quick start

pip install keo

keo download glove100   # ~460 MB, SHA-256 verified
keo smoke               # end-to-end check, about 10 seconds
keo figures smoke

Python 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.sh

HIGGS (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_higgs28

The 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.