Supporting Clustering with Contrastive Learning

Dejiao Zhang, Feng Nan, Xiaokai Wei, Shangwen Li, Henghui Zhu, Kathleen McKeown, Ramesh Nallapati, Andrew Arnold, Bing Xiang

TL;DR

The paper introduces Supporting Clustering with Contrastive Learning (SCCL), an end-to-end framework that significantly improves unsupervised short-text clustering. By jointly optimizing a top-down clustering loss with a bottom-up instance-wise contrastive loss, SCCL effectively separates overlapping semantic categories and tightens clusters. This approach yields a 3%–11% improvement in accuracy and a 4%–15% boost in Normalized Mutual Information (NMI) across multiple benchmarks.

What Problem Does This Paper Address?

Unsupervised text clustering aims to group documents into semantic categories without human labels. This is particularly challenging for short texts (like tweets, search snippets, or question titles) because they suffer from severe data sparsity and lack contextual signals.

While deep neural networks help map text into lower-dimensional spaces, different semantic categories still heavily overlap at the beginning of the learning process. Traditional distance-based clustering methods (like K-Means or Deep Embedding Clustering) get trapped in these overlapping regions, resulting in low-purity clusters. The authors set out to find a way to cleanly untangle these representations before and during the clustering process.

Methods

SCCL tackles the overlapping problem by combining two complementary objectives into a single, end-to-end architecture:

  1. The Backbone: A pretrained Sentence Transformer (distilbert-base-nli-stsb-mean-tokens) maps input text into a dense representation space.
  2. Instance-wise Contrastive Learning (Instance-CL) Head: This bottom-up head takes pairs of augmented text instances (generated via a Contextual Augmenter that substitutes words using BERT/RoBERTa) and minimizes a contrastive loss. It pulls embeddings of the same sentence closer together while pushing embeddings of different sentences apart, effectively scattering the initial overlapping mass of data.
  3. Clustering Head: This top-down head uses a Student’s t-distribution to calculate soft-assignment probabilities between instance embeddings and cluster centroids. It minimizes the Kullback-Leibler (KL) divergence between these soft assignments and a sharpened auxiliary target distribution, forcing the model to commit to high-confidence cluster assignments.

Instead of training these heads sequentially, SCCL optimizes them jointly via a weighted objective function: $$\mathcal{L} = \mathcal{L}_{\text{Instance-CL}} + \eta \mathcal{L}_{\text{Cluster}}$$

SCCL Training Framework

Datasets

The authors evaluated SCCL on eight widely used short-text clustering benchmarks:

  • SearchSnippets: Web search snippets across 8 groups.
  • StackOverflow: Question titles from 20 different technical categories.
  • Biomedical: PubMed paper titles from 20 groups.
  • AgNews: News titles covering 4 topics.
  • Tweet: Social media posts spread across 89 categories.
  • GoogleNews (TS, T, S): Three variations (Titles + Snippets, Titles only, Snippets only) of news articles spanning 152 distinct events.

No new benchmarks were introduced, allowing for direct comparison with prior state-of-the-art methods.

Key Insights and Ideas

  • The Synergy of Push and Pull: Instance-CL acts as a bottom-up regularizer that disperses individual instances across the embedding space, which naturally breaks up overlapping class boundaries. Simultaneously, the clustering head acts top-down to pull semantically similar instances into tight, distinct groups.
  • Joint Optimization is Crucial: The authors experimented with a sequential version (SCCL-Seq) where the model is trained on contrastive learning first and clustered second. Joint training consistently outperformed sequential training, proving that the two objectives actively assist each other during gradient descent.
  • Augmentation Composition Fails in Text: In computer vision, stacking multiple augmentations (e.g., cropping + color jitter) is vital for contrastive learning. However, the authors discovered that in NLP, composing augmentations (e.g., contextual word substitution + character swapping) actually hurts performance on very short texts like StackOverflow titles. Because short texts have so few words, changing too much text quickly destroys the fragile semantic meaning.

Key Results

SCCL achieved substantial performance gains over previous state-of-the-art methods (including STCC, Self-Train, and HAC-SD):

  • Accuracy & NMI Boosts: SCCL advanced accuracy by 3%–11% and NMI by 4%–15% on most datasets. For example, on StackOverflow, accuracy jumped from a previous best of 64.8% to 75.5%.
  • Better Cluster Geometry: Quantitative tracking of embedding distances showed that SCCL successfully minimizes intra-cluster distance (making clusters tighter) while maximizing inter-cluster distance (pushing different categories further apart).
  • Linear Scalability: Unlike traditional hierarchical agglomerative clustering methods (like HAC-SD) which suffer from a prohibitive $O(N^2 \log N)$ time complexity, SCCL utilizes standard stochastic optimization. This allows its time complexity to scale linearly ($O(N)$) with the number of documents, making it highly viable for large-scale production datasets.

Limitations and Future Work

The primary bottleneck for SCCL is the discrete nature of text augmentation. While computer vision models enjoy infinitely adjustable geometric transformations, changing even a single word in a short sentence can completely invert its semantic meaning (e.g., changing a "not" or a core noun).

To bypass the limitations of discrete token substitution, the authors suggest that future work should explore data mixing strategies (such as Mixup) in the continuous embedding space to create smoother, more robust representations without relying entirely on word-swapping tools.

Summary updated

Abstract

Unsupervised clustering aims at discovering the semantic categories of data according to some distance measured in the representation space. However, different categories often overlap with each other in the representation space at the beginning of the learning process, which poses a significant challenge for distance-based clustering in achieving good separation between different categories. To this end, we propose Supporting Clustering with Contrastive Learning (SCCL) -- a novel framework to leverage contrastive learning to promote better separation. We assess the performance of SCCL on short text clustering and show that SCCL significantly advances the state-of-the-art results on most benchmark datasets with 3%-11% improvement on Accuracy and 4%-15% improvement on Normalized Mutual Information. Furthermore, our quantitative analysis demonstrates the effectiveness of SCCL in leveraging the strengths of both bottom-up instance discrimination and top-down clustering to achieve better intra-cluster and inter-cluster distances when evaluated with the ground truth cluster labels.
BibTeX
@inproceedings{zhang2021supporting,
  author = {Dejiao Zhang and Feng Nan and Xiaokai Wei and Shangwen Li and Henghui Zhu and Kathleen McKeown and Ramesh Nallapati and Andrew Arnold and Bing Xiang},
  title = {{Supporting Clustering with Contrastive Learning}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.naacl-main.427},
}
Figure