M9-026M9: Senior ML & AI System DesignRecSys, Ads & Search ArchitectureHard
⚡Flashcard Drill➔Mastery:
Design a 100K-QPS Two-Tower + DLRM High-Concurrency RecSys Cascade
🎯 Active Recall Self-Check (Draft First, Verify After)
Login-free practice tracker: recall core answer, audit pitfalls, and log review status.
Step 1 · Draft your concise answer & assumptions
Step 2 · Check Pitfalls & Follow-up Inquiries
📐 Mathematical Definition
⚡ One-Sentence Core Answer
Combine logQ-debiased Two-Tower ANN recall with TorchRec-sharded DLRM interaction ranking, decoupling user-tower compute per request to hit sub-50ms P99 at 100K QPS.
📌 Key Takeaways
- •L1 Latency Budget: 100K QPS within 50ms P99 (User Tower 8ms + ANN 10ms + Feature Hydration 10ms + DLRM 18ms)
- •L2 LogQ Debiasing: subtract sampling log-probability ln Q(v) during in-batch softmax so popular items don't monopolize recall
- •L2 Decoupled DLRM Execution: evaluate user-side MLP once per request and broadcast across 500 candidate item embeddings before dot-interaction
- •L3 Hybrid Embedding Placement: shard TorchRec tables across GPU HBM (hot IDs), pinned Host DRAM, and SSD/Redis using INT8/FP16 mixed precision
📐 Mathematical Derivations
In-batch sampled softmax requires logQ correction to recover unbiased logits; DLRM compresses pairwise dot-interactions upper triangle into top MLP.
🏭 Production Trade-offs
1) IVF-PQ with rescoring saves 8x RAM over raw HNSW at 100M+ items; 2) Explicit pairwise dot-interactions in DLRM bound latency tightly vs deep transformer stacks.
⚠️ Common Interview Pitfalls
- ✕Mismatching L2 normalization between Two-Tower training and ANN cosine/IP index serving
- ✕Recomputing user-side sequence features 500 times per request instead of broadcasting once
- ✕Unbounded sparse ID tables without frequency-threshold eviction causing silent OOM
🎯 Interviewer Follow-up Inquiries
- ?How do you stream 100k new item embeddings/min into ANN shards without stalling query threads?
- ?How do you isolate straggler nodes during TorchRec All-to-All embedding lookups?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚