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

Scalable K-Means++

Bahman Bahmani, Benjamin Moseley, Andrea Vattani, Ravi Kumar, Sergei Vassilvitskii

Introduction

K-means clustering is a fundamental tool in data science, but its performance is heavily dependent on the quality of initial cluster centers. While the k-means++ algorithm provides a robust initialization with theoretical guarantees, its sequential nature makes it a bottleneck for massive, distributed datasets. This paper introduces k-means||, a parallelized version of k-means++ that significantly reduces the number of passes over the data while maintaining clustering quality.

The Bottleneck of Sequential Initialization

The standard k-means++ algorithm selects $k$ initial centers one by one. In each step, it calculates the distance of all data points to the existing centers to sample the next center with a probability proportional to its squared distance. This requires $k$ full passes over the dataset. For modern applications where $k$ can reach thousands and data is distributed across clusters, these $k$ sequential passes introduce prohibitive network I/O and synchronization overhead.

The k-means|| Algorithm

To overcome this, k-means|| (k-means parallel) employs an oversampling strategy. Instead of picking one center per round, it samples multiple points independently in each pass.

  1. Parallel Oversampling: In each round, the algorithm samples $O(k)$ points based on their distance to current centers. This is repeated for a small number of rounds (theoretically $O(\log n)$, but empirically ~5).
  2. Weighted Reclustering: The resulting set of candidate centers (roughly $O(k \log n)$ points) is much smaller than the original dataset. Each candidate is assigned a weight based on the number of original points it represents.
  3. Local Reduction: A standard k-means++ is run on this small, weighted set to select the final $k$ centers.

This approach allows the most computationally intensive part—distance calculations across the entire dataset—to be fully parallelized.

Key Insights and Results

The authors evaluated k-means|| on several datasets, including the massive KDDCup1999 (4.8 million points).

Rapid Convergence

A critical finding is that while theory suggests $O(\log n)$ rounds, the algorithm achieves near-optimal cost in just a few iterations.

Clustering cost vs. number of rounds on the KDD dataset for various values of $k$ and oversampling factors $l/k$.

As shown in the figure above, the clustering cost drops precipitously in the first few rounds and plateaus quickly. Increasing the oversampling factor ($l/k$) further accelerates this convergence, often reaching a stable solution in fewer than 10 rounds regardless of the value of $k$.

Performance Gains

On the KDDCup1999 dataset with $k=500$, the parallel MapReduce implementation of k-means|| completed in approximately 75 minutes. This is a massive improvement over parallel Random initialization (300 minutes) and the Partition baseline (420 minutes). Furthermore, the high-quality seeds provided by k-means|| reduced the number of subsequent Lloyd's iterations needed for convergence. For instance, on the Spam dataset, k-means|| required only 30 iterations to converge, compared to 176 for random initialization.

Conclusion

k-means|| effectively bridges the gap between high-quality initialization and computational scalability. By replacing $k$ sequential passes with a small constant number of parallel passes, it enables efficient k-means clustering on a scale previously unattainable with smart initialization techniques.

Summary updated

BibTeX
@article{bahmani2012scalable,
  author = {Bahman Bahmani and Benjamin Moseley and Andrea Vattani and Ravi Kumar and Sergei Vassilvitskii},
  title = {{Scalable K-Means++}},
  journal = {Proc. VLDB Endow.},
  year = {2012},
  doi = {10.14778/2180912.2180915},
}
Figure