Abstract
Modern recommender systems rely on massive embedding tables that can reach hundreds of gigabytes in size. While 8-bit quantization is a standard compression technique, moving to 4-bit quantization often results in significant accuracy degradation due to the unique statistical properties of embedding vectors. This paper presents two novel post-training quantization techniques: a greedy search for optimal clipping thresholds and a row-wise k-means clustering approach. Our methods effectively reduce model size to approximately 13-25% of the original FP32 size while maintaining model quality, as demonstrated on industry-standard benchmarks and Facebook production models.
Introduction
Embedding tables map categorical identifiers to continuous vectors and are the primary memory consumers in large-scale recommender systems, often accounting for over 99.99% of the total model parameters. As these models scale to billions of users and items, the resulting memory footprint poses significant challenges for deployment and inference.
While post-training quantization (PTQ) is a popular solution for compressing deep learning models, standard techniques optimized for Convolutional Neural Networks (CNNs) often fail when applied to embedding tables. The primary reason is the "Small Dimension Trap": embedding vectors typically have low dimensionality (e.g., 64 or 128), which is insufficient for the data to converge to the Gaussian or Laplacian distributions assumed by traditional analytical clipping methods like ACIQ.
Proposed Methods
To bridge the 4-bit accuracy gap, we propose two distinct approaches that move away from rigid statistical assumptions.
1. Uniform Quantization with Greedy Search (GREEDY)
Instead of relying on analytical formulas to determine clipping ranges, we treat the selection of the minimum ($x_{min}$) and maximum ($x_{max}$) values for quantization as an optimization problem. The goal is to minimize the Mean Squared Error (MSE) between the original and quantized values.
Our GREEDY algorithm begins with the full range of the data and iteratively narrows the search space. By evaluating the loss at each step and choosing the direction that yields the greatest reduction in error, we find highly effective clipping thresholds that are tailored to the specific distribution of each row.
2. Codebook-based Quantization (KMEANS)
For scenarios where uniform quantization is insufficient, we employ a non-uniform approach based on k-means clustering. By performing row-wise clustering, we identify 16 optimal centroids (representing 4 bits of information) to represent the values within each row. We also introduce a "Two-Tier" variant (KMEANS-CLS) that clusters similar rows together to further optimize storage.
Hardware-Efficient Inference
To ensure that 4-bit quantization translates to real-world performance gains, we implemented optimized dequantization kernels using Intel AVX512 vector instructions. This allows the CPU to handle bit-level manipulations efficiently, ensuring that the reduced memory bandwidth requirements lead to faster inference rather than becoming a computational bottleneck.
Experimental Evaluation
We evaluated our methods on the Terabyte Criteo dataset, a benchmark for click-through rate (CTR) prediction, and a Facebook production ranking model.
Criteo Benchmark Results
The results on the Criteo dataset demonstrate that both GREEDY and KMEANS significantly outperform existing state-of-the-art methods. As shown in the table below, our methods maintain a log loss nearly identical to the uncompressed FP32 model while achieving substantial compression.
Key observations from our experiments include:
- Row-wise Quantization: Applying quantization parameters per row is essential. Global quantization leads to catastrophic accuracy loss.
- Superiority of Greedy Search: The GREEDY method consistently outperformed complex analytical methods like ACIQ, which were designed for vision models.
- Compression Ratios: The GREEDY method reduced model size to between 13.3% and 25.0% of the original FP32 version, depending on the embedding dimension.
Production Deployment
In a live environment at Facebook, the uniform quantization technique successfully reduced a production model to 13.89% of its original size. Crucially, this was achieved with "neutral" model quality, meaning there was no measurable degradation in the performance metrics relevant to end-users.
Conclusion
This work demonstrates that 4-bit post-training quantization is a viable and highly effective strategy for compressing large-scale embedding tables. By replacing standard statistical assumptions with optimization-driven approaches like greedy search and k-means clustering, we can achieve significant memory savings without sacrificing model accuracy. Future work will explore budget-constrained optimization to further refine the trade-off between model size and performance.
Summary updated