Deep Learning meets Projective Clustering

Alaa Maalouf, Harry Lang, Daniela Rus, Dan Feldman

Introduction

Researchers have developed a novel approach to shrink massive Natural Language Processing (NLP) models, such as BERT and RoBERTa, without sacrificing their performance. By replacing standard matrix factorization techniques with a geometric method called projective clustering, they can compress embedding layers by over 40% while maintaining significantly higher accuracy than traditional compression methods.

The Bottleneck of Embedding Layers

Modern NLP models are giants. Architectures like RoBERTa and XLNet contain hundreds of millions of parameters, making them difficult to deploy on smartphones, IoT devices, or in real-time applications. A massive portion of this size—often 20% to 40%—comes directly from the embedding layer, which maps vocabulary words to high-dimensional vectors.

The standard way to shrink this layer is using Singular Value Decomposition (SVD). Geometrically, SVD assumes that all word vectors in a model live near a single "flat" subspace (akin to a single sheet of paper in 3D space). However, language is highly complex and nuanced; words do not all fit neatly into one semantic category. Forcing them into a single subspace often results in a "lossy" compression that causes a sharp drop in the model's accuracy.

Geometric comparison: fitting data to a single subspace (left) versus multiple subspaces (right).

The MESSI Architecture

To solve this, the authors introduce MESSI (Multiple Estimated SVDs for Smaller Intralayers). Instead of assuming one subspace fits all, MESSI uses projective clustering to find $k$ different subspaces that best represent the data.

The core "aha" moment is that word embeddings are better represented as a collection of different "clusters of meaning" rather than one giant cloud. By allowing for multiple subspaces, the model preserves the nuances of different word groups. The process works in five steps:

  1. Projective Clustering: Treat the word embeddings as points in space and find $k$ different subspaces (each of dimension $j$) that are closest to these points.
  2. Partitioning: Group the words based on which of the $k$ subspaces they are closest to.
  3. Factorization: Perform a mini-SVD on each group separately.
  4. Architecture Re-design: Replace the original massive embedding layer with $k$ smaller parallel layers that feed into a single recombination layer.
  5. Fine-tuning: Train the new, slimmer model for a few epochs to recover any lost precision.
The MESSI architecture replaces a single massive embedding layer with multiple smaller, parallel layers based on clustered subspaces.

While finding the absolute best subspaces is mathematically Max-SNP-Hard, the authors use an Expectation-Maximization (EM) algorithm—similar to how K-means clustering works—to find highly effective local minima. Even before fine-tuning, the MESSI approach yields much lower error than SVD, providing a "better head start" for the model to reach high accuracy with minimal additional training.

Experimental Results on GLUE

The researchers evaluated their method using the GLUE (General Language Understanding Evaluation) benchmark, testing against three major architectures: RoBERTa, DistilBERT, and ALBERT.

The quantitative improvements over standard SVD are striking:

  • DistilBERT: Compressed the embedding layer by 40% with only a 0.5% average drop in accuracy across all nine GLUE tasks. Standard SVD at the same compression rate caused a much steeper 2.8% drop.
  • RoBERTa: Achieved 43% compression with less than a 0.8% drop in accuracy, compared to a 3% drop using SVD.
  • Efficiency: On specific tasks like CoLA and RTE, the gap was even wider, with MESSI outperforming SVD-based accuracy by up to 10% in high-compression scenarios.
  • Accuracy Boost: Interestingly, for the ALBERT model, replacing the embedding layer with the MESSI architecture actually increased accuracy across almost all GLUE tasks while keeping the parameter count exactly the same.

Limitations and Future Directions

The authors acknowledge that while the EM algorithm is efficient, it does not guarantee the global mathematical optimum. Additionally, the current implementation requires a custom sparse matrix setup in frameworks like PyTorch to fully realize the speed benefits during inference.

Future directions for this research include testing the method on non-NLP networks, such as computer vision models. The authors also plan to explore "non-uniform dimensions," where different clusters are assigned subspaces of different sizes based on their complexity, and developing more efficient "coresets" to speed up the initial clustering process for even larger datasets.

Summary updated

BibTeX
@inproceedings{maalouf2021deep,
  author = {Alaa Maalouf and Harry Lang and Daniela Rus and Dan Feldman},
  title = {{Deep Learning meets Projective Clustering}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=EQfpYwF3-b},
}
Figure