Abstract
Deep learning-based models are utilized to achieve state-of-the-art performance for recommendation systems. A key challenge for these models is to work with millions of categorical classes or tokens. The standard approach is to learn end-to-end, dense latent representations or embeddings for each token. The resulting embeddings require large amounts of memory that blow up with the number of tokens. Training and inference with these models create storage and memory bandwidth bottlenecks, leading to significant computing and energy consumption when deployed in practice. To this end, we present the problem of Memory Allocation under budget for embeddings and propose a novel formulation of memory shared embedding, where memory is shared in proportion to the overlap in semantic information. Our formulation admits a practical and efficient randomized solution with Locality sensitive hashing based Memory Allocation (LMA). We demonstrate a significant reduction in the memory footprint while maintaining performance. In particular, our LMA embeddings achieve the same performance compared to standard embeddings with a 16× reduction in memory footprint. Moreover, LMA achieves an average improvement of over 0.003 AUC across different memory regimes than standard DLRM models on Criteo and Avazu datasets.
Introduction
In modern recommendation systems, data is dominated by categorical features such as user IDs, product histories, or "liked" pages. To process these, models map each category to a dense vector called an embedding. The problem is scale: with millions of unique categories, these embedding tables can take up over 99.9% of a model's total memory, often reaching hundreds of gigabytes or even terabytes. This "embedding explosion" creates massive bottlenecks in storage, memory bandwidth, and overall efficiency. Standard hashing tricks, like those used in HashedNet, save space but treat all categories as independent, ignoring the fact that items like "Nike" and "Adidas" are semantically closer than "Nike" and "Jaguar."
Methods: Semantically Constrained Memory Allocation
The core proposal is Semantically Constrained Memory Allocation (SCMA). The central idea is that if two items are similar, their embeddings should share more physical memory addresses. This acts as a form of regularization and allows for knowledge transfer between related categories.
To implement this efficiently, the authors introduce the Locality Sensitive Hashing based Memory Allocation (LMA) algorithm. LMA uses Jaccard similarity as a proxy for semantic closeness, defined by how often categories co-occur in the data. Minwise hashing (MinHash) is then used to estimate this similarity from a small subsample of the data.
Instead of a dedicated row for every category, LMA uses $d$ independent LSH functions to map a category to $d$ locations in a shared, much smaller memory pool $\mathcal{M}$. Because LSH is designed to produce collisions for similar inputs, semantically related items naturally share many of the same memory slots in $\mathcal{M}$. The values in this shared pool are learned via standard backpropagation during training.
Key Insights
- Similarity as a Regularizer: Forcing similar items to share memory can improve performance by allowing the model to "transfer" knowledge between related categories, which explains why LMA sometimes outperforms full-sized embedding tables.
- Random Initialization: The authors prove mathematically that even if the shared memory is initialized randomly, the LSH-based mapping preserves the intended semantic similarities in the resulting embeddings.
- Dynamic Scalability: The LSH approach is "online." New products can be added by simply hashing them into the existing structure without recalculating the entire allocation.
- Data Efficiency: High-quality similarity estimates can be obtained from small subsamples (e.g., 125k samples out of 46M), making the preprocessing step highly efficient.
Experimental Results
The researchers evaluated LMA on industry-standard benchmarks: Criteo (46M samples, 33M unique categories) and Avazu (41M samples, 9.45M unique categories).
Key findings include:
- 16x Memory Reduction: On Criteo, LMA achieved the same performance as a full embedding model (540M parameters) using only 36M parameters.
- Accuracy Gains: LMA achieved an average improvement of 0.0032 AUC on Criteo and 0.0034 AUC on Avazu compared to standard DLRM baselines. In ad-tech, an AUC increase of 0.001 is considered a significant revenue driver.
- Baseline Comparison: LMA consistently outperformed HashedNet (random hashing) and QR Embeddings, proving that semantic awareness is the "secret sauce" for efficient embeddings.
Conclusion and Future Work
LMA offers a powerful solution to the memory bottleneck in recommendation systems by leveraging semantic similarity through LSH. While the method requires hyperparameter tuning for the number of hashes and expansion rates, its ability to maintain accuracy while slashing memory usage by 16x is a significant advancement. Future work may explore LMA's application in Natural Language Processing (NLP), where vocabulary sizes present similar scaling challenges.
Summary updated