English

Do you know what q-means?

Quantum Physics 2025-07-18 v3 Data Structures and Algorithms Machine Learning

Abstract

Clustering is one of the most important tools for analysis of large datasets, and perhaps the most popular clustering algorithm is Lloyd's algorithm for kk-means. This algorithm takes nn vectors V=[v1,,vn]Rd×nV=[v_1,\dots,v_n]\in\mathbb{R}^{d\times n} and outputs kk centroids c1,,ckRdc_1,\dots,c_k\in\mathbb{R}^d; these partition the vectors into clusters based on which centroid is closest to a particular vector. We present a classical ε\varepsilon-kk-means algorithm that performs an approximate version of one iteration of Lloyd's algorithm with time complexity O~(VF2nk2dε2(k+logn))\tilde{O}\big(\frac{\|V\|_F^2}{n}\frac{k^{2}d}{\varepsilon^2}(k + \log{n})\big), exponentially improving the dependence on the data size nn and matching that of the "qq-means" quantum algorithm originally proposed by Kerenidis, Landman, Luongo, and Prakash (NeurIPS'19). Moreover, we propose an improved qq-means quantum algorithm with time complexity O~(VFnk3/2dε(k+d)(k+logn))\tilde{O}\big(\frac{\|V\|_F}{\sqrt{n}}\frac{k^{3/2}d}{\varepsilon}(\sqrt{k}+\sqrt{d})(\sqrt{k} + \log{n})\big) that quadratically improves the runtime of our classical ε\varepsilon-kk-means algorithm in several parameters. Our quantum algorithm does not rely on quantum linear algebra primitives of prior work, but instead only uses QRAM to prepare simple states based on the current iteration's clusters and multivariate quantum amplitude estimation. Finally, we provide classical and quantum query lower bounds, showing that our algorithms are optimal in most parameters.

Keywords

Cite

@article{arxiv.2308.09701,
  title  = {Do you know what q-means?},
  author = {Arjan Cornelissen and Joao F. Doriguello and Alessandro Luongo and Ewin Tang},
  journal= {arXiv preprint arXiv:2308.09701},
  year   = {2025}
}

Comments

21 pages. v2: improved the quantum complexity, references added; v3: new co-author added, new algorithms and upper bounds, improved old upper bounds, new lower bounds, references added

R2 v1 2026-06-28T11:58:58.524Z