KEO
A reproducible evaluation of k-means, e-means, and o-means on an independent dataset.
KEO is an experimental benchmarking framework for evaluating three large-scale clustering algorithms under a unified experimental protocol. It provides consistent implementations, evaluation metrics, experiment tracking, and result generation to investigate whether the performance improvements reported by recent e-means and o-means research generalize to datasets outside their original evaluations.
The goal is not to establish another leaderboard, but to conduct a controlled and reproducible investigation of algorithmic performance, computational cost, and practical limitations.
Research motivation
Recent work has proposed improvements to traditional k-means clustering:
- k-means: The classical Lloyd algorithm, serving as the baseline.
- e-means: A mini-batch approach using exponential moving average updates and adaptive optimization strategies, reported to achieve comparable clustering quality in substantially fewer epochs.
- o-means: An extension of e-means that uses an inverted-file index over centroids to reduce assignment costs as the number of clusters increases.
KEO evaluates these approaches using the same dataset, initialization, evaluation metrics, and experiment-tracking infrastructure.
| Algorithm | Approach | Reference |
|---|---|---|
| K — k-means | Lloyd's algorithm with exact assignment and centroid updates. | 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) |
| O — o-means | e-means with a two-level inverted-file index over centroids to reduce assignment comparisons. | Bajaj, Nupur, Garg (2026) |
Research question
The central research question is:
Do the reported improvements of e-means and o-means generalize to datasets that were not used to develop or tune these algorithms?
Specifically, KEO investigates:
- Whether e-means can achieve k-means-level clustering quality in approximately 1.4–2.6 epochs.
- Whether o-means reduces assignment costs as the number of clusters increases.
- How clustering quality, computational cost, and cluster stability change across experimental configurations.
- Under what conditions these algorithms fail to deliver their expected improvements.
Dataset
GloVe-100
KEO currently uses the GloVe-100 dataset from ANN-Benchmarks.
| Property | Value |
|---|---|
| Dataset | GloVe-100 |
| Number of vectors | 1,183,514 |
| Dimensions | 100 |
| Query vectors | 10,000 |
| Source | ANN-Benchmarks |
| Configuration | glove-100-angular |
| Preprocessing | L2 normalization |
| Integrity verification | SHA-256 checksum |
The dataset was selected because it does not appear in the evaluation dataset lists of either the e-means or o-means papers, based on the papers and project materials examined for this study.
The dataset is downloaded automatically and verified using its SHA-256 checksum.
Installation
Requirements
- Python 3.8 to 3.14 are supported (CI runs the tests on every one of them)
- Python 3.12 is recommended for the development environment
- Python 3.8 installs older library versions (for example numpy 1.24, scikit-learn 1.3, pandas 2.0), so numerical results may differ slightly in the last digits from newer Pythons. The provenance record stored with each run lists the library versions used.
- The adapter for the official faiss E-means (
faiss.contrib.e_means) needs faiss-cpu 1.16 or newer, which itself requires Python 3.10 or newer. On Python 3.8 and 3.9 that adapter reports itself as unavailable; the reference implementations and the faiss Lloyd adapter work as usual.
Install KEO using pip:
pip install keo
Development installation
Clone the repository and install dependencies using uv:
git clone https://github.com/rajveer43/keo.git
cd keo
uv sync
Quick start
Run your first experiment:
# Download the GloVe-100 dataset (~460 MB)
keo download glove100
# Run an end-to-end smoke test
keo smoke
# Generate figures from the smoke experiment
keo figures smoke
# Check available official implementations
keo adapters
The smoke experiment runs on a small subset of the dataset and takes approximately 10 seconds.
Running experiments
Preview an experiment before execution:
keo run <name-or-path.yaml> --dry-run
Execute the experiment:
keo run <name-or-path.yaml>
Inspect experiment progress:
keo status <name>
Generate figures:
keo figures <name> --theme both
From a source checkout, prefix commands with uv run. For example:
uv run keo smoke
uv run pytest
Data and results
KEO uses configurable directories for datasets, results, and experiment configurations.
| Environment variable | Purpose |
|---|---|
KEO_DATA_DIR |
Dataset storage |
KEO_RESULTS_DIR |
Experiment results |
KEO_CONFIGS_DIR |
Experiment configurations |
By default:
- Source installations use
data/andresults/within the repository. - Installed packages cache datasets in
~/.cache/keo/data. - Results are written to
./resultsrelative to the current working directory.
Methodology
Implementation strategy
Each algorithm is evaluated through two separate implementations.
1. Reference implementation
Our own PyTorch CPU implementations, developed from the corresponding research papers.
2. Official implementation
The authors' released implementations, accessed through isolated worker processes and adapters, including Faiss contrib/e_means.
These implementations are never mixed within an experiment. Every result records its implementation provenance.
Clustering quality is compared across implementations. Wall-clock execution time is compared only within the same implementation to avoid misleading performance comparisons.
Evaluation metrics
KEO tracks the following metrics:
| Metric | Description |
|---|---|
| MSE | Mean squared L2 distance to the assigned centroid, evaluated on training and held-out points. |
| Relative MSE (Gap) | Error relative to k-means run for 25 iterations from the same initialization and random seed. |
| Cluster health | Dead clusters, empty clusters, and Faiss imbalance factor. |
| Computational cost | Distance computations for assignment and index maintenance. |
| Wall-clock time | Fitting time, compared within the same implementation. |
MSE is computed using exact assignment in float64 precision on both training and held-out points.
Computational cost is reported in two forms:
- Actual distance computations performed.
- Nominal cell arithmetic.
This provides a hardware-independent perspective on algorithmic complexity.
e-means configurations
KEO supports two e-means recipes:
official: Uses the constants provided by the official implementation. This is the default configuration.paper: Uses the values specified in the research paper.
The two configurations differ slightly. All headline evaluations use the official recipe.
Reproducibility and experiment tracking
Reproducibility is a central design principle of KEO.
Each experiment result is associated with a content hash derived from its configuration.
This provides several benefits:
- Experiments can resume after interruption.
- Previously completed result cells are not recomputed.
- Configuration provenance is preserved.
- Results remain traceable to their corresponding experimental settings.
Figures and reporting
KEO generates six figures directly from stored experiment results.
Each figure includes:
- A corresponding CSV containing the exact plotted values.
- Light and dark theme variants.
- Data-driven headline calculations.
No headline metrics are manually entered into the figures.
Project status
KEO is under active development. The experimental infrastructure and core algorithm implementations are complete, while the main benchmark and analysis phases remain in progress.
| Phase | Scope | Status |
|---|---|---|
| 0–2 | Specification, dataset pipeline, metrics, k-means | Complete |
| 3–4 | e-means and o-means reference implementations | Complete |
| 5 | Official implementation adapters | Complete |
| 6 | Result storage, resumable execution, figure generation | Complete |
| 7 | Full benchmark grid | Not started |
| 8 | Analysis and report generation | Not started |
| 9 | Ablations, scaling-law transfer, secondary experiments | Not started |
| 10 | Hardening and packaging | Not started |
Current validation
- 179 automated tests passing on the development machine.
- Smoke experiment covering 26 experimental cells.
- Successful end-to-end execution of the smoke pipeline.
- GitHub Actions CI badge tracks the latest Linux test run.
Implementation agreement
On GloVe subsets, the reference e-means implementation matches the official implementation within approximately 0.2% on held-out error.
The remaining difference is suspected to be related to remainder-batch handling, but this has not yet been isolated.
Important: No benchmark conclusions are claimed yet.
Results currently available in results/smoke/ are based on two repetitions at k = 512. They validate the experimental pipeline and should not be interpreted as answers to the research question.
Limitations
The current evaluation has several limitations that should be considered when interpreting its results.
1. o-means reconstruction
The o-means paper has not been released. Its implementation is reconstructed using the available project page, with unspecified details documented as explicit assumptions. Conclusions about o-means therefore apply to this reconstruction.
2. Hardware limitations
The reference development environment uses an Apple M4 CPU without GPU execution for the reference implementations. GPU performance claims from the original papers cannot currently be reproduced in this environment.
Clustering quality and computational operation counts can still be evaluated.
3. CPU timing limitations
Index maintenance in o-means may have different performance characteristics on GPUs and CPUs. Consequently, CPU wall-clock measurements should not be treated as a definitive assessment of the algorithm's performance.
4. Dataset coverage
The current evaluation uses only GloVe-100. Results may not generalize to other datasets, dimensionalities, or data distributions.
5. Dataset novelty
The claim that GloVe-100 is an independent evaluation dataset is bounded to the dataset lists examined in the two papers. It is not a claim that the dataset has never been used in previous clustering research.
Repository structure
keo/
├── configs/ # Dataset and experiment configurations
├── src/
│ └── keo/
│ ├── algos/ # k-means, e-means, o-means
│ │ └── adapters/ # Official implementation adapters
│ ├── bench/ # Experiment runner and result storage
│ ├── metrics/ # Evaluation metrics and operation counting
│ ├── analysis/ # Figure generation and analysis
│ └── data/ # Download, verification, preparation
├── tests/ # Unit and phase-gate tests
├── results/ # Experiment outputs
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
├── SECURITY.md
├── CHANGELOG.md
└── LICENSE
References
Clustering algorithms
- e-means: Bessa et al. (2026). e-means: Outperforming k-means (in one-tenth the epochs). Paper · Project page
- o-means: Bajaj, Nupur, Garg (2026). o-means: Index the centroids, don't scan them. Project page, November 2026. Paper not yet released.
- Flash-KMeans: GPU k-means baseline. arXiv:2603.09229
- Faiss: Douze et al. (2024). arXiv:2401.08281
Related research
- VQ-VAE: van den Oord et al. (2017). arXiv:1711.00937
- ANN-Benchmarks: Aumüller et al. (2018). arXiv:1807.05614
- GloVe: Pennington et al. Project page
- VIBE: arXiv:2505.17810
Classical foundations
- Lloyd (1982). Least squares quantization in PCM.
- Arthur and Vassilvitskii (2007). k-means++: The advantages of careful seeding.
- Sculley (2010). Web-scale k-means clustering.
Contributing
Contributions are welcome, and you do not need to write code to help. Running the benchmark on a GPU, suggesting a dataset, or reviewing the o-means reconstruction are all useful. See CONTRIBUTING.md for how to set up, what a good pull request looks like, and the rules that keep the benchmark trustworthy. Please follow the Code of Conduct. To report a security problem, see SECURITY.md.
If you use KEO in your work, please cite it using CITATION.cff or the DOI badge above.
License
KEO is released under the MIT License.
The GloVe vectors are not redistributed with the package. They are downloaded from ANN-Benchmarks and remain subject to their respective terms.
KEO — Reproducible clustering research.
Built for transparent, controlled, and reproducible evaluation.
Metadata
Release files for keo 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keo-0.1.4.tar.gz | 84.9 kB | Without provenance | Details for keo-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keo-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for keo-0.1.4-py3-none-any.whl |
Total release size: 159.7 kB
Release files / keo-0.1.4.tar.gz
| Download URL | keo-0.1.4.tar.gz |
|---|---|
| Size | 84.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ac012ef6d0aaad72247712cfe69732f11a66f2c458bdee249c2cc982b26e33b
|
|
BLAKE2b-256 checksum How to use checksums |
e2fb29af9a3fe635016b86eeb8136b3abc284d166198040e7fd79a0eca6d0921
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / keo-0.1.4-py3-none-any.whl
| Download URL | keo-0.1.4-py3-none-any.whl |
|---|---|
| Size | 74.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa9f14271f3887e54dd78a7050b47ad8e50bab25ca472194d2f84b8cfda9fc8f
|
|
BLAKE2b-256 checksum How to use checksums |
b832b84adeaadcff0bd88b75fe8122d3452f0681669bfe7e1b00a3961f699a4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for keo 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.