[Paper Review] Differentiable Product Quantization for End-to-End Embedding Compression
This paper proposes Differentiable Product Quantization (DPQ), a novel end-to-end trainable framework for compressing neural network embedding layers by learning discrete product quantized codes. By making product quantization differentiable, DPQ enables single-stage training with 14–238× compression ratios and near-zero performance drop across 10 language datasets, outperforming prior methods in efficiency and compression without distillation.
Embedding layers are commonly used to map discrete symbols into continuous embedding vectors that reflect their semantic meanings. Despite their effectiveness, the number of parameters in an embedding layer increases linearly with the number of symbols and poses a critical challenge on memory and storage constraints. In this work, we propose a generic and end-to-end learnable compression framework termed differentiable product quantization (DPQ). We present two instantiations of DPQ that leverage different approximation techniques to enable differentiability in end-to-end learning. Our method can readily serve as a drop-in alternative for any existing embedding layer. Empirically, DPQ offers significant compression ratios (14-238$ imes$) at negligible or no performance cost on 10 datasets across three different language tasks.
Motivation & Objective
- Address the high memory and storage cost of large embedding tables in neural networks, especially in NLP and recommendation systems.
- Overcome limitations of prior methods that use fixed or non-differentiable discrete codes, which require two-stage training with distillation.
- Develop a general, end-to-end differentiable framework that learns compact discrete codes for embedding vectors without performance degradation.
- Enable efficient inference and training by replacing full embedding tables with quantized codes while maintaining model accuracy.
Proposed method
- Propose a differentiable product quantization (DPQ) framework that maps continuous embedding vectors to discrete codes via a differentiable discretization function φ(·) and a reverse-discretization function ρ(·).
- Introduce two approximation techniques—DPQ-SX and DPQ-VQ—using straight-through gradient estimation and vector quantization with soft assignment to enable backpropagation through discrete codes.
- Use product quantization (PQ) to partition the embedding space into D orthogonal subspaces, each with K centroids, enabling compact code representation as a D-dimensional index vector.
- Train the entire model end-to-end by backpropagating through the quantization process, allowing the centroids and codes to be jointly optimized for downstream task performance.
- Replace standard embedding layers with DPQ modules as a drop-in alternative, maintaining the same input-output behavior while drastically reducing parameter count.
- Achieve differentiability by approximating the hard discretization with continuous relaxations, enabling gradient flow during backpropagation without stochastic sampling.
Experimental results
Research questions
- RQ1Can product quantization be made differentiable to enable end-to-end training of discrete embedding codes?
- RQ2How do the choice of code size K and code length D affect compression ratio and model performance?
- RQ3Can DPQ achieve high compression ratios without performance degradation, especially compared to non-differentiable or two-stage methods?
- RQ4What is the computational overhead of DPQ during training and inference compared to standard embedding layers?
- RQ5Does DPQ eliminate the need for distillation or pre-training stages used in prior work?
Key findings
- DPQ achieves compression ratios of 14–238× across 10 diverse NLP datasets with negligible or no performance drop compared to full-precision embedding layers.
- The combination of small K (e.g., K=2) and large D (e.g., D=128) yields better performance and compression than large K and small D, due to improved quantization accuracy.
- Training with DPQ incurs only a 10% increase in training time on average and zero additional memory usage, with no inference overhead.
- DPQ-VQ shows better computational efficiency than DPQ-SX for large K and D, due to optimized vector quantization operations.
- DPQ eliminates the need for distillation or two-stage training, enabling single-stage end-to-end learning with superior convergence and stability.
- Empirical results on BERT pre-training confirm that DPQ maintains competitive performance while compressing the embedding layer significantly.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.