Size and Shard Billion-Row Embedding Tables in a DLRM Model
Last updated: November 29, 2026
Quick Overview
Meta's recommendation models consume huge categorical features such as user IDs, page IDs, and ad IDs. Explain how embedding tables work in a DLRM-style model and how you would handle vocabularies with billions of values.
Meta
November 29, 20260
0
0 solved
Meta's recommendation models consume huge categorical features such as user IDs, page IDs, and ad IDs. Explain how embedding tables work in a DLRM-style model and how you would handle vocabularies with billions of values.
Meta published DLRM, and most of its ranking compute and memory goes into embedding tables. Interviewers for ranking infra and modeling teams test whether you understand the memory math, hashing collisions, and how sparse features interact with dense ones.
What the Interviewer Expects
- Describe the DLRM structure: embeddings for sparse, MLP for dense, pairwise interaction layer, top MLP
- Estimate embedding memory and explain why it dominates model size
- Explain the hashing trick and the cost of collisions
- Offer compression options such as frequency-based sizing, QR or compositional embeddings, quantization
- Explain sharding embedding tables across GPUs
- Mention sparse optimizers like row-wise Adagrad
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- How do you pick embedding dimension per feature?
- How does sum pooling vs attention pooling change things for multi-valued features like recently liked pages?
- How do collisions affect a rare but valuable ID, such as a new large advertiser?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Sparse features are categorical IDs (user, page, ad, creator) and multi-hot lists (pages liked recently). Dense features are counts and ratios. The question is mainly about memory and quality trade-of...
Approach
Walk through the architecture, then do the memory math, then reduce memory without losing the long tail where possible, then cover how the tables are distributed for training and serving....