Introduction
Recurrent Neural Language Models (RNNLMs) have become a cornerstone of modern natural language processing. However, their practical deployment is often hindered by the sheer size of their embedding layers. These layers, which map vocabulary words to high-dimensional vectors, scale linearly with the number of words. For large-scale applications with vocabularies reaching hundreds of thousands or millions of entries, the embedding layer becomes a massive memory bottleneck, often exceeding the capacity of mobile devices or single GPUs.
This paper introduces Slim Embedding (SE) layers, a novel approach to compress these layers by up to 99% without sacrificing accuracy. By employing structured random parameter sharing, SE layers not only reduce memory footprint but also provide a regularization effect that can improve model performance.
The Slim Embedding Mechanism
The core innovation of the SE layer is Random Parameter Sharing. Instead of maintaining a unique, full-length vector for every word in the vocabulary, the SE approach utilizes a fixed pool of $M$ sub-vectors.
As illustrated in Figure 1, each word's embedding is constructed by randomly selecting $K$ sub-vectors from this pool and concatenating them to form the final representation.
This method offers several advantages:
- Arbitrary Compression: Researchers can choose any compression ratio by simply adjusting the size of the sub-vector pool ($M$).
- Structured Sharing: By sharing contiguous blocks (sub-vectors) rather than individual elements, the method remains "cache-friendly," allowing for efficient hardware processing.
- Regularization: Forcing words to share parameters prevents the model from over-fitting on rare words, often leading to better generalization than uncompressed models.
Optimization and Efficiency
Beyond memory reduction, the authors address computational efficiency, particularly in the output (softmax) layer. Compressing the output layer is typically challenging because it requires calculating dot products for the entire vocabulary. The authors implement a dynamic programming approach that pre-calculates dot products for the unique sub-vectors in the pool. These are then summed to derive final word probabilities, resulting in a 4x speedup on CPUs and a 1.5x speedup on GPUs during inference.
Experimental Results
The SE method was evaluated across diverse datasets, including the Penn Treebank (PTB), English Gigaword, and the One Billion Word Benchmark.
A key finding is the robustness of SE layers compared to other compression techniques. As shown in Figure 5, while alternative parameter-sharing methods (such as PM and SM) see a sharp increase in perplexity (PPL) as compression increases, the SE layer maintains performance much closer to the uncompressed baseline even at extreme compression rates.
Key Performance Highlights:
- Extreme Compression: On the PTB dataset, an SE model using only 1% of the original parameters achieved a PPL of 82.62, outperforming the uncompressed baseline (85.33).
- Large-Scale Scalability: On the One Billion Word benchmark, SE achieved a PPL of 38.3 with just 0.25 billion parameters, rivaling models with four times the parameter count.
- Translation Quality: In machine translation reranking tasks, compressed models maintained nearly identical BLEU scores to their full-sized counterparts despite the massive reduction in size.
Conclusion and Future Work
Slim Embedding layers provide a simple, effective, and hardware-efficient way to compress RNNLMs. By breaking the linear dependency between vocabulary size and memory usage, SE layers enable the deployment of state-of-the-art language models on resource-constrained devices. Future research may explore "data-driven" sub-vector assignments—grouping semantically similar words—and extending this technique to Transformer-based architectures.
Summary updated