A Scalable Approach to Clustering Embedding Projections
Donghao Ren, Fred Hohman, Dominik Moritz
TL;DR
This work tackles the scalability bottleneck of labeling embedding projection visualizations by clustering in the 2D projected space using kernel density estimation (KDE) on a density map rather than on point data. The method produces high‑quality, polygonal cluster regions in a density map within a few hundred milliseconds, enabling fast labeling and summarization for datasets with millions of points. The approach combines hill‑climbing to form initial regions, a cluster‑neighborhood graph to merge near‑boundary maxima, and density‑based truncation to yield clean boundaries, with a final post‑processing step to polygons for downstream querying. An open‑source Rust implementation compiled to WebAssembly demonstrates strong runtime performance (roughly 55 ms for density map processing, with total interactive times around 80–100 ms) and comparable clustering quality to existing point‑based methods, supporting practical interactive visualization and SQL‑based labeling workflows.
Abstract
Interactive visualization of embedding projections is a useful technique for understanding data and evaluating machine learning models. Labeling data within these visualizations is critical for interpretation, as labels provide an overview of the projection and guide user navigation. However, most methods for producing labels require clustering the points, which can be computationally expensive as the number of points grows. In this paper, we describe an efficient clustering approach using kernel density estimation in the projected 2D space instead of points. This algorithm can produce high-quality cluster regions from a 2D density map in a few hundred milliseconds, orders of magnitude faster than current approaches. We contribute the design of the algorithm, benchmarks, and applications that demonstrate the utility of the algorithm, including labeling and summarization.
