Abstract
Hierarchical Agglomerative Clustering (HAC) is a cornerstone of unsupervised learning, yet its high computational cost and sensitivity to data changes hinder its use in dynamic environments. We introduce DynHAC, the first fully dynamic algorithm for average-linkage HAC that provides a provable $(1+\epsilon)$ approximation guarantee. DynHAC handles both insertions and deletions of data points up to 423x faster than recomputing from scratch while maintaining significantly higher clustering quality than existing dynamic baselines.
Introduction
Modern applications, such as social media streams and financial monitoring, generate data in a constant state of flux. HAC is prized for its ability to discover multi-scale structures, but it is notoriously brittle: adding or removing a single point can theoretically force a total recomputation of the dendrogram. While incremental algorithms handle new data, "fully dynamic" algorithms—those that also handle deletions efficiently without sacrificing $(1+\epsilon)$ approximation quality—have remained elusive until now.
Methods
DynHAC builds upon TeraHAC, a parallel static algorithm, using a partitioned, round-based approach to manage updates:
- Graph-Based Representation: The algorithm operates on a similarity graph (e.g., k-nearest neighbor) rather than a dense matrix.
- Partitioning and Local Re-clustering: The graph is partitioned into disjoint subgraphs. When an update occurs, DynHAC identifies "dirty" partitions—those directly affected or within a 4-hop neighborhood—and reruns the clustering logic only on these areas.
- Approximation as a Stability Tool: By allowing a $(1+\epsilon)$ approximation, the algorithm gains the structural stability needed to make local updates valid for the global solution, preventing "cascading" changes.
Results
The authors evaluated DynHAC using three benchmarks: MNIST (70,000 digits), ALOI (108,000 images), and ILSVRC_SMALL (50,000 ImageNet points).
Clustering Quality
DynHAC maintains a high Normalized Mutual Information (NMI) score, staying very close to the static baseline and outperforming existing dynamic algorithms like GRINCH and GraphGrove by up to 0.21 in NMI.
Computational Speedup
Compared to recomputing from scratch, DynHAC achieved massive speedups. Insertion speedups reached 423x on MNIST, 41x on ALOI, and 10x on ILSVRC. Deletion speedups were also significant, demonstrating the efficiency of the "dirty partition" approach.
Discussion
The key insight of DynHAC is that while exact HAC is too brittle for dynamic updates, an approximate version is robust. The 4-hop neighborhood rule ensures that the impact of a single update is spatially limited, allowing for massive computational savings. While fast in practice, the algorithm's worst-case performance and the overhead of maintaining the underlying k-NN graph remain areas for future optimization.
Summary updated