Smaller Text Classifiers with Discriminative Cluster Embeddings

Mingda Chen, Kevin Gimpel

Introduction

Modern Natural Language Processing (NLP) models rely heavily on word embeddings to map vocabulary to high-dimensional vectors capturing semantic meaning. However, the embedding matrix often constitutes the largest portion of the model's parameters. For a vocabulary of 100,000 words and 300-dimensional vectors, the lookup table alone requires 30 million parameters. This memory footprint poses significant challenges for deploying high-quality models on resource-constrained edge devices. This paper addresses this bottleneck by proposing Discriminative Cluster Embeddings, a method that learns to group words into task-specific clusters, drastically reducing model size while maintaining competitive accuracy.

Methodology

The core idea is to replace unique word embeddings with a shared set of cluster centroids. Instead of a $V \times m$ matrix (where $V$ is vocabulary size and $m$ is dimension), the model learns a $k \times m$ matrix, where $k \ll V$.

Cluster Embeddings (CE)

In the basic Cluster Embedding (CE) approach, each word is assigned a latent variable representing its membership in one of $k$ clusters. To enable end-to-end training via backpropagation, the authors utilize the Gumbel-Softmax trick. This provides a continuous relaxation of the non-differentiable "hard" assignment during training. At inference, the model uses simple integer pointers to the cluster matrix, achieving massive storage savings.

The cluster pointer mechanism maps words to a shared embedding matrix of size k.

Hybrid Variants

Recognizing that word importance follows a power law (Zipf's Law), the authors propose two extensions:

  1. Mixture Embeddings (ME): This hybrid model assigns unique embeddings to the most frequent $u$ words (the "head" of the distribution) while clustering the remaining "tail" of the vocabulary.
  2. Cluster Adjustment Embeddings (CAE): Every word is assigned a shared cluster embedding, which is then refined by a unique, low-dimensional scalar "tweak."

Experimental Setup

The proposed methods were evaluated on five standard text classification benchmarks: AG News (topic classification), DBpedia (Wikipedia categories), Yelp Review Polarity (binary sentiment), Yelp Review Full (fine-grained sentiment), and IMDB Movie Reviews. The primary metrics were classification accuracy and model size (memory footprint).

Results and Discussion

The Mixture Embedding (ME) approach consistently emerged as the most effective strategy, outperforming standard embeddings (SE) at extremely low memory budgets.

Performance comparison across four datasets showing accuracy vs. model size for different embedding methods.

Key Findings

  • Compression Efficiency: On the AG News dataset, the ME model achieved approximately 90% accuracy with a footprint of only 0.05 MB.
  • Regularization Effects: In several instances, clustered models outperformed full-sized counterparts. This suggests that discriminative clustering acts as a regularizer, preventing overfitting on rare words by forcing them into semantically or task-relevant groups.
  • Qualitative Analysis: Learned clusters revealed intuitive groupings, such as clusters dedicated to quantities, tech companies (e.g., Google, IBM), or sports-related terminology.

Conclusion

Discriminative Cluster Embeddings provide a robust framework for compressing text classifiers by up to 100x. By learning task-specific clusters end-to-end, the method preserves the discriminative power necessary for high performance while minimizing redundancy. Future research may explore the integration of pre-trained embeddings like GloVe into this framework and extending the approach to sequence-to-sequence tasks like machine translation.

Summary updated

BibTeX
@inproceedings{chen2018smaller,
  author = {Mingda Chen and Kevin Gimpel},
  title = {{Smaller Text Classifiers with Discriminative Cluster Embeddings}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2018},
  doi = {10.18653/v1/n18-2116},
}
Figure