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

Efficient Hierarchical Clustering for Classification and Anomaly Detection

Ishita Doshi, Sreekalyan Sajjalla, Jayesh Choudhari, Rushi Bhatt, Anirban DasguptaarXiv 2020

Abstract

This paper presents a scalable, top-down hierarchical clustering framework designed for real-time processing of high-volume social media content. By leveraging spectral partitioning and the Hierarchical Tree Based Nearest Neighbor (HTNN) algorithm, the system achieves efficient multiclass classification and robust anomaly detection. Theoretical cost guarantees based on Dasgupta’s objective function ensure near-optimal tree structures. Evaluated on datasets with up to 40 million records, the approach demonstrates sub-millisecond query times and significant improvements in human labeling efficiency, particularly for emerging content types.

Introduction

Social networks face a massive scale problem: millions of user-generated comments are posted daily, and the variety of topics—and spam tactics—evolves faster than human editors can label them. Traditional flat classification models struggle when new, unlabeled "anomalies" appear. This research addresses the need for a system that can perform high-precision multiclass classification while simultaneously detecting emerging trends. The authors propose a hierarchical approach to enable faster lookups ($O(\log k)$ vs $O(k)$), handle label sparsity through parent-category context, and provide a "human-in-the-loop" framework for rapid categorization.

Methodology

The core of the proposed system is the Hierarchical Tree Based Nearest Neighbor (HTNN) algorithm, a top-down recursive partitioning method that builds a binary tree. The innovation lies in the splitting rules used at each node:

  • Spectral Partitioning (EV & AEV): The algorithm uses the second-largest eigenvector to find the "sparsest cut" in the data. This is grounded in Dasgupta’s hierarchical clustering cost function, providing theoretical guarantees that the resulting tree is close to optimal.
  • Approximate Eigenvectors (AEV): To ensure scalability, power iterations estimate eigenvectors, significantly reducing computational burden while maintaining clustering quality.
  • Classification & Anomaly Detection: New content is classified by traversing the tree to a leaf node for a local k-nearest neighbor search. If a data point is significantly distant from known class centroids within its branch, it is flagged as a potential anomaly.

Hierarchical Context and Anomaly Detection

A key advantage of the hierarchical structure is the ability to "borrow strength" from parent nodes. When a new sub-cluster emerges without existing labels, the system can apply the policy of its parent node to take immediate action.

Figure 1: (a) A hierarchical taxonomy of fraud types. (b) The HTNN framework identifying labeled, unlabeled, and new data points within the hierarchy.

As illustrated in Figure 1, the hierarchy also serves as a navigation aid for human editors. Presenting a new anomaly within its taxonomic context (e.g., identifying a new scam as a sub-type of "Phone Fraud") allows editors to categorize content significantly faster than navigating a flat list of thousands of classes.

Experimental Results

The authors evaluated HTNN on standard benchmarks (ALOI, 20 Newsgroups, MNIST) and massive real-world datasets, including a proprietary dataset of 40 million records.

  • Accuracy: Spectral splitting (EV) consistently outperformed traditional linkage-based trees and often surpassed Support Vector Machines (SVMs) on high-dimensional text datasets.
  • Scalability: Implemented in Apache Spark, the AEV algorithm clustered 40 million data points into over 16,000 leaf nodes in approximately 3 hours.
  • Efficiency: The system achieved query times under 1 millisecond for most datasets, making it viable for real-time production use.
  • Human Impact: In controlled experiments, human labelers were approximately 30% faster (100s vs 141s per document) when using the hierarchy to categorize new content.

Conclusion

While the current tree-building process is batch-oriented, the HTNN framework provides a robust foundation for large-scale content moderation. Future work will focus on moving toward an incremental, online learning setting where the tree updates dynamically as new data arrives, further tightening theoretical bounds for specific data distributions.

Summary updated

BibTeX
@misc{doshi2020efficient,
  author = {Ishita Doshi and Sreekalyan Sajjalla and Jayesh Choudhari and Rushi Bhatt and Anirban Dasgupta},
  title = {{Efficient Hierarchical Clustering for Classification and Anomaly Detection}},
  year = {2020},
  eprint = {2008.10828},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2008.10828},
}
Figure