NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Quantum (Inspired) D2-sampling with Applications

Poojan Chetan Shah, Ragesh Jaiswal

Introduction

Clustering is a cornerstone of data science, and the $k$-means problem is its most famous formulation. Because finding the absolute optimal clustering is NP-hard, practitioners rely on the $k$-means++ algorithm. This algorithm uses a process called $D^2$-sampling to pick initial cluster centers that are far apart, providing a provable $O(\log k)$ approximation guarantee.

However, $k$-means++ has a major bottleneck: it takes $O(Nkd)$ time, where $N$ is the number of points, $k$ is the number of clusters, and $d$ is the dimension. As datasets grow into the millions or billions, this linear dependence on $N$ becomes prohibitively expensive. While previous quantum algorithms attempted to speed this up, they often lacked robust proofs that the resulting clusters were actually good (i.e., they didn't prove the $O(\log k)$ guarantee held up under quantum noise).

This paper introduces a quantum algorithm for $D^2$-sampling achieving a running time that is polylogarithmic in the number of data points $N$. By "dequantizing" this approach, the authors also present a fast, quantum-inspired classical algorithm ($QI$-$k$-means++) that significantly outperforms standard implementations on large datasets where the data's "aspect ratio" is bounded.

Methods

The authors tackle the problem from two angles:

  1. Quantum $D^2$-sampling: They design a quantum algorithm using the QRAM model. It utilizes standard quantum tools like the swap test, coherent amplitude estimation, and median estimation to estimate distances and sample points. Crucially, they perform a "robustness analysis" to prove that the errors introduced by quantum estimation don't break the $O(\log k)$ approximation guarantee of $k$-means++.
  2. Dequantization ($QI$-$k$-means++): Following the "dequantization" framework, they translate the quantum logic into a classical algorithm. This involves a tree-based Sample-Query (SQ) access data structure. Once this structure is built (in $O(Nd)$ time), subsequent sampling is extremely fast and independent of $N$.
Tree-based Sample-Query data structure
  1. Quantum Approximation Scheme: They go a step further by quantizing a parallel sampling scheme to create the first quantum algorithm that provides a $(1 + \epsilon)$ approximation for $k$-means with only polylogarithmic dependence on $N$.

Datasets

The authors evaluated their quantum-inspired classical algorithm ($QI$-$k$-means++) against standard $k$-means++ and other fast variants using:

  • Binarized MNIST: 70,000 images of handwritten digits.
  • IRIS: A small, classic 150-point dataset.
  • KDD: A larger dataset with ~145,000 points and 74 dimensions.
  • SUSY: A massive dataset with 5,000,000 points.
  • DIGITS: Used for variance testing.

Key Insights

  • The Aspect Ratio ($\zeta$) is Key: The performance of these algorithms depends heavily on the "aspect ratio"—the ratio of the maximum to the minimum distance between any two points. If your data is well-behaved (bounded $\zeta$), the speedup is massive.
  • $D^2$-sampling is Naturally "Quantum-Ready": $D^2$-sampling picks points with probability proportional to their squared distance from centers. Since quantum states naturally represent probabilities as squared amplitudes, the mapping is very clean.
  • Robustness Matters: The authors didn't just show a speedup; they proved that "noisy" $D^2$-sampling (inherent in quantum estimation) still yields high-quality clusters.
  • Preprocessing Trade-off: The $QI$-$k$-means++ algorithm requires an initial $O(Nd)$ pass to build the tree. However, this is highly parallelizable and only needs to be done once. After that, you can re-run the seeding for different values of $k$ almost instantly.

Key Results

  • Theoretical Speedup: The quantum algorithm runs in $\tilde{O}(\zeta^2 k^2)$ time, effectively removing $N$ from the runtime equation.
Algorithm comparison table
  • Empirical Performance: On the SUSY dataset (5M points), the sampling time for $QI$-$k$-means++ was several orders of magnitude faster than standard $k$-means++. For $k=200$, $QI$-$k$-means++ took ~0.43 seconds compared to 195 seconds for the classical version.
  • Constant Scaling: In experiments on MNIST, the cumulative runtime for $QI$-$k$-means++ remained almost constant as $k$ increased, whereas the classical version scaled linearly.
  • Quality Preservation: The clustering costs (the "error" of the clusters) for the quantum-inspired version were nearly identical to the classical version, confirming that the speedup doesn't come at the cost of accuracy.

Limitations and Future Work

  • Sensitivity to Outliers: Because the runtime depends on $\zeta^2$, a single outlier very far from the rest of the data can significantly slow down the algorithm.
  • Preprocessing Cost: While the sampling is fast, the $O(Nd)$ cost to build the SQ data structure is still there. For small datasets or one-off runs, standard $k$-means++ might still be faster.
  • Future Directions: The authors suggest investigating ways to reduce the dependence on the aspect ratio $\zeta$ and exploring how these techniques might apply to other clustering problems like $k$-median or constrained clustering.

Summary updated

BibTeX
@inproceedings{shah2025quantum,
  author = {Poojan Chetan Shah and Ragesh Jaiswal},
  title = {{Quantum (Inspired) D2-sampling with Applications}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
}
Figure