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

Meta-Learning to Cluster

Yibo Jiang, Nakul VermaarXiv 2019

Abstract

Clustering is one of the most fundamental and wide-spread techniques in exploratory data analysis. Yet, the basic approach to clustering has not really changed: a practitioner hand-picks a task-specific clustering loss to optimize and fit the given data to reveal the underlying cluster structure. Some types of losses---such as k-means, or its non-linear version: kernelized k-means (centroid based), and DBSCAN (density based)---are popular choices due to their good empirical performance on a range of applications. Although every so often the clustering output using these standard losses fails to reveal the underlying structure, and the practitioner has to custom-design their own variation. In this work we take an intrinsically different approach to clustering: rather than fitting a dataset to a specific clustering loss, we train a recurrent model that learns how to cluster. The model uses as training pairs examples of datasets (as input) and its corresponding cluster identities (as output). By providing multiple types of training datasets as inputs, our model has the ability to generalize well on unseen datasets (new clustering tasks). Our experiments reveal that by training on simple synthetically generated datasets or on existing real datasets, we can achieve better clustering performance on unseen real-world datasets when compared with standard benchmark clustering techniques. Our meta clustering model works well even for small datasets where the usual deep learning models tend to perform worse.

Introduction

Clustering is a cornerstone of exploratory data analysis, yet the methodology has remained largely static for decades. Practitioners typically select an algorithm like $k$-means or DBSCAN based on assumptions about the data's geometry—such as expecting spherical blobs or consistent density. If these assumptions are violated, the resulting clusters often fail to capture the true underlying structure. This "Clustering Choice" problem is compounded by Kleinberg’s Impossibility Theorem, which posits that no single algorithm can satisfy the axioms of Scale-Invariance, Richness, and Consistency simultaneously.

In this work, we propose a paradigm shift: meta-learning to cluster. Instead of optimizing a hand-picked loss, we train a recurrent neural network to learn the "act" of clustering from diverse examples. This approach allows the model to adapt to unseen data distributions and complex non-linear geometries, effectively bypassing the limitations of fixed algorithms.

Methodology

The core of the proposed approach is a Stacked LSTM architecture (4 layers deep) designed to process data points sequentially. Unlike traditional batch-based clustering, the LSTM’s hidden state serves as a dynamic memory, building a representation of the data manifold as it encounters each point in a specific task.

The Stacked LSTM architecture used for meta-clustering, featuring residual connections and multiple layers to capture complex data structures.

The model is trained on a "meta-dataset" where each example is an entire dataset paired with its ground-truth cluster labels. The training objective utilizes a hybrid loss function:

  1. Classification Loss ($L_{classify}$): Ensures predicted labels match ground truth during the meta-training phase.
  2. Local Consistency Loss ($L_{local}$): A KL-divergence regularizer that encourages neighboring points in the input space to receive similar cluster assignments.

Mathematically, we demonstrate that by introducing this meta-learning layer, we can satisfy a "meta-version" of Kleinberg’s axioms, providing a theoretical foundation for the model's flexibility.

Experimental Results

We evaluated the meta-clustering model on a mix of synthetic and real-world benchmarks. Synthetic data included multivariate Gaussians transformed into complex, non-convex shapes such as interlocking moons and spirals to test the model's ability to handle non-linear geometries.

Visualization of the meta-clustering model's performance on various synthetic non-convex datasets, demonstrating its ability to handle diverse geometries.

Performance on Synthetic and Real Data

On 2D non-convex synthetic datasets, the model achieved an average error rate of 0.08, significantly outperforming $k$-means (0.17) and deep clustering baselines like DEC (0.18). The model's generalization capabilities were further validated on real-world datasets:

  • Iris: The model achieved a 0.09 error rate, compared to 0.19 for $k$-means.
  • MNIST: On PCA-reduced handwritten digits, the model reached a 0.32 error rate, surpassing both $k$-means (0.35) and Spectral Clustering (0.40).
  • Robustness: The model exhibited strong location and scale invariance, maintaining performance even when test data was shifted or scaled relative to the training distribution.

Discussion and Conclusion

Our results suggest that a model can learn a fundamental, transferable notion of "clustering" from synthetic data that generalizes to real-world tasks. Notably, the model can automatically approximate the number of clusters ($k$) during inference, a significant advantage over traditional methods that require $k$ as a pre-specified hyperparameter.

However, limitations remain. The current architecture has a fixed output dimension, imposing a maximum cap on the number of clusters. Additionally, while LSTMs are effective, they are sensitive to input order; future work may explore permutation-invariant architectures like Transformers or PointNets. Despite these challenges, meta-learning offers a promising new direction for automated, data-driven clustering.

Summary updated

BibTeX
@misc{jiang2019meta,
  author = {Yibo Jiang and Nakul Verma},
  title = {{Meta-Learning to Cluster}},
  year = {2019},
  eprint = {1910.14134},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.14134},
}
Figure