Skip to main content
QUICK REVIEW

[Paper Review] Compressing Word Embeddings via Deep Compositional Code Learning

Raphael Shu, Hideki Nakayama|arXiv (Cornell University)|Nov 3, 2017
Topic ModelingComputer Science31 references29 citations
TL;DR

This paper proposes deep compositional code learning to compress word embeddings by representing each word as a combination of a few learned basis vectors via discrete hash codes. Using Gumbel-softmax differentiable training, the method achieves up to 98% compression in sentiment analysis and 94–99% in machine translation with no performance loss, while enabling language-independent, architecture-agnostic model compression.

ABSTRACT

Natural language processing (NLP) models often require a massive number of parameters for word embeddings, resulting in a large storage or memory footprint. Deploying neural NLP models to mobile devices requires compressing the word embeddings without any significant sacrifices in performance. For this purpose, we propose to construct the embeddings with few basis vectors. For each word, the composition of basis vectors is determined by a hash code. To maximize the compression rate, we adopt the multi-codebook quantization approach instead of binary coding scheme. Each code is composed of multiple discrete numbers, such as (3, 2, 1, 8), where the value of each component is limited to a fixed range. We propose to directly learn the discrete codes in an end-to-end neural network by applying the Gumbel-softmax trick. Experiments show the compression rate achieves 98% in a sentiment analysis task and 94% ~ 99% in machine translation tasks without performance loss. In both tasks, the proposed method can improve the model performance by slightly lowering the compression rate. Compared to other approaches such as character-level segmentation, the proposed method is language-independent and does not require modifications to the network architecture.

Motivation & Objective

  • Reduce the memory and storage footprint of neural NLP models by compressing word embeddings without sacrificing performance.
  • Address the redundancy in standard word embeddings, where semantically similar words are represented by independent vectors.
  • Develop a method that is language-independent and does not require architectural modifications to existing models.
  • Enable end-to-end training of discrete hash codes using differentiable relaxation via the Gumbel-softmax trick.
  • Maximize compression efficiency while preserving semantic fidelity through multi-codebook quantization and code sharing among similar words.

Proposed method

  • Represent each word as a code $ C_w = (C_w^1, C_w^2, ..., C_w^M) $, where each component selects a codeword from a codebook $ E_i $.
  • Construct the final embedding as a sum: $ E(C_w) = \sum_{i=1}^M E_i(C_w^i) $, using $ M \times K $ basis vectors instead of $ |V| $ unique vectors.
  • Use multi-codebook quantization with discrete integer codes (e.g., $ (3,2,1,8) $) to maximize compression over binary coding.
  • Apply the Gumbel-softmax trick to enable end-to-end backpropagation through discrete codes during training.
  • Optimize the code and codebook parameters by minimizing the reconstruction loss: $ \frac{1}{|V|} \sum_w || \sum_i E_i(C_w^i) - \tilde{E}(w) ||^2 $.
  • Learn codes directly from pre-trained embeddings (e.g., GloVe) to preserve semantic quality while drastically reducing parameter count.

Experimental results

Research questions

  • RQ1Can word embeddings be compressed to 95% or more reduction in parameter count without performance degradation?
  • RQ2Can discrete, learnable codes effectively capture semantic similarity between words like 'dog' and 'dogs'?
  • RQ3Does the proposed method maintain performance across diverse NLP tasks such as sentiment analysis and machine translation?
  • RQ4How efficient is code utilization—do all codewords get meaningfully assigned, or are some wasted?
  • RQ5Can the method be applied universally across languages and models without architectural changes?

Key findings

  • The method achieves 98% compression in the IMDB sentiment analysis task with no performance drop, maintaining BLEU scores at 29.04 for $32\times16$ codes.
  • In machine translation, compression rates of 94–99% were achieved with minimal performance loss, e.g., 98% compression in De→En with BLEU 29.04 vs. 29.45 for baseline.
  • Even at high compression rates, the model can improve performance slightly by reducing compression slightly, indicating room for trade-off optimization.
  • Qualitative analysis shows that semantically similar words (e.g., 'dog', 'dogs', 'cat') are assigned codes that are close in Hamming space.
  • Code utilization is efficient: even the least used codewords are assigned to over 1,000 words, indicating no significant code wastage.
  • The method is language-independent and does not require modifications to network architecture, enabling broad deployment on mobile and low-resource devices.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.