Provably faster randomized and quantum algorithms for $k$-means clustering via uniform sampling
Tyler Chen, Archan Ray, Akshay Seshadri, Dylan Herman, Bao Bach, Pranav Deshpande, Abhishek Som, Niraj Kumar, Marco Pistoia
TL;DR
This work presents both a simple randomized mini-batch k-means algorithm with uniform sampling and a quantum counterpart that mimics the one-step Lloyd update. The classical method achieves provable accuracy with batch sizes scaling with a data-dependent partition quality parameter $\phi$, improving over prior data-norm based guarantees. The quantum algorithm attains a quadratic improvement in the estimation error dependence via QRAM-based mean estimation, yielding a per-iteration QRAM query bound that scales as $\tilde{O}\left(k^{3/2} k_C \sqrt{d}\left( \frac{\sqrt{\phi}}{\varepsilon} + \sqrt{\frac{dk}{k_C}}\right)\right)$ and, under balanced clusters, simplifies to $\tilde{O}\left(k^{5/2} \sqrt{d} \left(\frac{\sqrt{\phi}}{\varepsilon} + \sqrt{d}\right)\right)$. A key contribution is highlighting the symmetry-preserving role of uniform sampling, quantified by $\phi$, which can be substantially smaller than prior η-based parameters, thereby enabling tighter worst-case guarantees. Together, these results offer practical guidance for fast one-step approximations to k-means in both classical and quantum settings, with potential benefits in big-data clustering where $n$ is large and cluster structure is favorable.
Abstract
The $k$-means algorithm (Lloyd's algorithm) is a widely used method for clustering unlabeled data. A key bottleneck of the $k$-means algorithm is that each iteration requires time linear in the number of data points, which can be expensive in big data applications. This was improved in recent works proposing quantum and quantum-inspired classical algorithms to approximate the $k$-means algorithm locally, in time depending only logarithmically on the number of data points (along with data dependent parameters) [q-means: A quantum algorithm for unsupervised machine learning, Kerenidis, Landman, Luongo, and Prakash, NeurIPS 2019; Do you know what $q$-means?, Cornelissen, Doriguello, Luongo, Tang, QTML 2025]. In this work, we describe a simple randomized mini-batch $k$-means algorithm and a quantum algorithm inspired by the classical algorithm. We demonstrate that the worst case guarantees of these algorithms can significantly improve upon the bounds for algorithms in prior work. Our improvements are due to a careful use of uniform sampling, which preserves certain symmetries of the $k$-means problem that are not preserved in previous algorithms that use data norm-based sampling.
