Handling High-Cardinality User and Video IDs in CTR Models
Last updated: November 29, 2026
Quick Overview
A click-through model for TikTok ads has billions of user IDs and hundreds of millions of ad and video IDs. How would you represent these categorical features?
TikTok
November 29, 20260
0
0 solved
A click-through model for TikTok ads has billions of user IDs and hundreds of millions of ad and video IDs. How would you represent these categorical features?
Large sparse embedding tables are central to TikTok's recommendation and ads models. Interviewers check whether you understand one-hot limits, embeddings, hashing collisions and how to deal with new and rare IDs.
What the Interviewer Expects
- Explain why one-hot encoding fails at this scale
- Propose learned embeddings for IDs
- Discuss the hashing trick and collisions
- Handle rare and new IDs with frequency thresholds and fallback features
- Mention embedding table size, sharding and eviction
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 large should embedding dimensions be?
- What happens to accuracy as hash collisions increase?
- How would you handle IDs that appear for the first time at serving?
- How do you keep embedding tables from growing forever?
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
Ask about the model family (deep CTR model with embeddings), training mode (online streaming updates are common for ads), memory budget for parameters and serving latency....
Approach
One-hot vectors with billions of dimensions are impossible to store densely and give no generalization between IDs. Instead, map each ID to a learned dense embedding. To bound memory, either hash IDs ...