TL;DR
LightRNN introduces a "2-Component shared embedding" scheme that represents words as combinations of row and column vectors in a table. This approach slashes model size by a factor of up to 100 and doubles training speed while maintaining—or even improving—state-of-the-art accuracy in language modeling.
What Problem Does This Paper Address?
Recurrent Neural Networks (RNNs) are the workhorses of modern NLP, but they have a massive "vocabulary problem." In standard architectures, every unique word in a vocabulary $|V|$ gets its own high-dimensional embedding vector. When dealing with web-scale corpora containing millions of unique words, the embedding matrices become gargantuan.
For a vocabulary of 10 million words and 1024-dimensional embeddings, the input matrix alone requires 40GB of memory. Add the output matrix and hidden layers, and you easily exceed 80GB—far beyond the capacity of a single high-end GPU. Furthermore, calculating the probability distribution over the entire vocabulary (the "softmax" layer) at every step is computationally ruinous. This makes training slow and deployment on mobile devices nearly impossible.
Methods
The core innovation is the 2-Component (2C) Shared Embedding. Instead of assigning a unique vector to every word, the authors arrange the vocabulary into a $\sqrt{|V|} \times \sqrt{|V|}$ table.
- Shared Vectors: Each row $i$ is associated with a vector $x^r_i$, and each column $j$ is associated with a vector $x^c_j$.
- Joint Representation: A word located at position $(i, j)$ is represented by the pair of vectors $(x^r_i, x^c_j)$.
- Efficiency: This reduces the number of required vectors from $|V|$ to $2\sqrt{|V|}$. For a 10M word vocabulary, you go from 10,000,000 vectors to just over 6,300.
To make this work, the authors designed a new RNN cell that processes these components sequentially. To predict the next word, the model first predicts the row, then uses that row information to predict the column. This transforms a single, massive $|V|$-way softmax into two much smaller $\sqrt{|V|}$-way normalizations.
The Bootstrap Allocation Problem
A major challenge is deciding which word goes into which cell $(i, j)$. The authors use a bootstrap framework:
- Cold Start: Randomly allocate words to the table.
- Train: Train the embeddings based on the current allocation.
- Refine: Fix the embeddings and re-allocate words to cells to minimize the global loss. This is formulated as a Minimum Weight Perfect Matching problem in graph theory, solved using the Minimum Cost Maximum Flow (MCMF) algorithm or a faster linear-time approximation.
Datasets
The authors evaluated LightRNN on:
- ACLW (2013 ACL Workshop): Morphological datasets for Spanish, French, English, Czech, German, and Russian.
- One-Billion-Word Benchmark (BillionW): A standard large-scale benchmark for language modeling.
Key Insights and Ideas
- Semantic Emergence: Perhaps the most surprising finding is that the automated allocation process (MCMF) actually discovers linguistic structure. Words in the same row often share semantic or syntactic traits (e.g., all being place names, time expressions, or URLs). This structured sharing might explain why the model performs so well despite having fewer parameters.
- Communication Efficiency: In distributed training, the bottleneck is often syncing model weights between workers. Because LightRNN is so compact, the communication overhead is drastically reduced, making it highly scalable.
- Breaking the Softmax Bottleneck: By factorizing the word prediction into row and column steps, the computational complexity of the output layer drops from $O(|V|)$ to $O(\sqrt{|V|})$.
Key Results
- Massive Compression: On the Billion-Word dataset, LightRNN reduced the model size from 1.6GB (standard Hierarchical Softmax) to just 41MB—a 40x reduction. Compared to BlackOut RNNs, the reduction was 100x.
- Speedup: The algorithm achieved the same perplexity as baseline models in roughly half the training time.
- Accuracy: Despite the compression, LightRNN achieved comparable or better perplexity (PPL) across all ACLW datasets. On BillionW, an ensemble of LightRNN and a 5-gram model achieved a state-of-the-art PPL of 43.
Limitations and Future Work
- Allocation Overhead: While the word reallocation step is a small fraction of total training time, it still adds complexity to the training pipeline.
- Task Generalization: The paper focuses exclusively on language modeling. The authors note that future work should explore how this shared embedding scheme performs in machine translation and question answering.
- Hyperparameter $k$: The authors suggest exploring $k$-component embeddings ($k > 2$) to see if even higher compression ratios are possible without losing accuracy.
Summary updated