Mixed-Precision Embeddings for Large-Scale Recommendation Models

Shiwei Li, Zhuoqi Hu, Fuyuan Lyu, Xing Tang, Haozhao Wang, Shijie Xu, Weihong Luo, Yuhua Li, Xue Liu, Xiuqiang He, Ruixuan LiarXiv 2024 · DOI

TL;DR

This paper introduces Mixed-Precision Embeddings (MPE), a novel method for compressing massive embedding tables in recommendation systems. MPE intelligently assigns different precision levels to features based on their importance, achieving significant memory savings (up to 200x) without sacrificing prediction accuracy, outperforming existing compression techniques.

What Problem Does This Paper Address?

Deep learning recommendation models (DLRMs) rely heavily on embedding tables to represent categorical features (like user IDs or item IDs) as dense vectors. While effective, these tables can become enormous, consuming terabytes of storage, especially when dealing with billions of features in large-scale advertising systems. Existing compression methods often apply uniform compression across all features, failing to account for their varying importance. This leads to over-compression of less important features or under-compression of crucial ones, ultimately impacting model accuracy. The paper aims to bridge this gap by developing a compression technique that can dynamically adapt precision based on feature importance.

Methods

The core of the proposed solution is Mixed-Precision Embeddings (MPE). MPE tackles the challenge in two main steps:

  1. Frequency-Aware Grouping: To manage the vast search space of individual feature precisions, MPE first groups features based on their frequency. The intuition is that more frequent features are generally more important. This grouping significantly reduces the number of precision decisions needed.
  2. Learnable Probability Distribution for Precision: Instead of directly selecting a single bit-width for each group, MPE learns a probability distribution over a set of candidate bit-widths. This is achieved by inserting a fake quantizer into the training process and using a Straight-Through Estimator (STE) for backpropagation. The model learns a probability distribution p for each feature group, indicating the likelihood of assigning each candidate bit-width. The final quantized embedding is then computed as an expected value across these probabilities and quantized values.
  3. Regularization and Sampling: To balance accuracy and memory usage, MPE incorporates regularization on the expected bit-width of feature groups. After learning the probability distribution, a specific bit-width is sampled for each group based on this distribution.
  4. Retraining: Finally, the model is retrained using the sampled bit-widths to fine-tune performance and recover any potential accuracy loss from the quantization process.

Datasets

The paper evaluates MPE on three real-world datasets:

  • Avazu: An advertising dataset with 22 categorical features.
  • Criteo: A display advertising dataset with 26 categorical and 13 numerical features.
  • KDD12: A dataset with 11 categorical features.

These datasets are standard benchmarks for recommendation system research.

Key Insights and Ideas

  • Feature Importance Matters for Compression: The paper highlights that simply applying uniform quantization to all embedding features is suboptimal. Differentiating precision based on feature importance is key to achieving both high compression and accuracy.
  • Frequency as a Proxy for Importance: Using feature frequency as a heuristic for importance is a practical and effective way to group features, simplifying the complex precision optimization problem.
  • Probabilistic Approach to Precision Selection: Learning a probability distribution over bit-widths, rather than a hard assignment, allows for a more nuanced representation and better end-to-end optimization, especially when combined with expected value computation for quantized embeddings.
  • Retraining is Crucial: While the learned precision distribution is powerful, retraining the model with the sampled bit-widths is essential to fully recover accuracy and leverage the information learned during the search phase.

Key Results

  • Significant Compression: MPE achieves remarkable compression ratios, reaching up to 200x on the Criteo dataset without compromising prediction accuracy. On Avazu and KDD12, it achieves approximately 18x and 20x compression, respectively.
  • State-of-the-Art Performance: MPE consistently outperforms existing embedding compression methods (like QR-Trick, ALPT, LSQ+, PEP, OptFS) in terms of AUC and Logloss across all tested datasets and models.
  • Minimal Accuracy Loss: The method is designed to maintain prediction accuracy, and experimental results confirm this, showing negligible degradation even at high compression levels.
  • Transferability: The sampled bit-widths show good transferability across different model architectures, although some minor accuracy reduction can occur on certain datasets.
  • Inference Latency: While MPE reduces storage, the inference latency is comparable to other methods, with slight variations due to dequantization and sparse matrix handling.

Limitations and Future Work

  • Retraining Dependency: MPE currently requires a retraining step after the precision search phase. The authors suggest that exploring retraining-free mixed-precision embeddings is a direction for future work.
  • Feature Grouping Heuristic: While frequency-based grouping is effective, more sophisticated methods for feature grouping could potentially yield further improvements.
  • Transferability Nuances: While generally transferable, the slight accuracy drops observed when transferring sampled bit-widths across architectures on Avazu and KDD12 suggest that further research into architecture-aware precision assignment could be beneficial.

Summary updated

BibTeX
@misc{li2024mixed,
  author = {Shiwei Li and Zhuoqi Hu and Fuyuan Lyu and Xing Tang and Haozhao Wang and Shijie Xu and Weihong Luo and Yuhua Li and Xue Liu and Xiuqiang He and Ruixuan Li},
  title = {{Mixed-Precision Embeddings for Large-Scale Recommendation Models}},
  year = {2024},
  eprint = {2409.20305},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.20305},
}
Figure