M9-032M9: Senior ML & AI System DesignLLM Serving, RAG & Agent SysDesignHard
⚡Flashcard Drill➔Mastery:
Design a Multi-Tenant Distributed LoRA Adapter Hot-Swapping Serving Engine
🎯 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
Serve thousands of fine-tuned adapters concurrently on shared frozen base weights using SGMV heterogeneous batching kernels, pinned host-RAM adapter caching, and affinity routing.
📌 Key Takeaways
- •L1 Multi-Tenancy Economics: serving 1000 isolated 70B replicas is prohibitive; sharing one frozen base with ~100MB rank-16 LoRAs cuts GPU footprint 100x
- •L2 Heterogeneous Batching: batch base
W_0 xacross all requests into one dense GEMM, then dispatch per-requestB_k A_k xvia Punica SGMV kernels - •L2 Tiered Adapter Cache: Unified Paging across GPU HBM (hot), pinned Host RAM (warm), and NVMe/S3 with async CUDA-stream prefetching
- •L3 Adapter-Affinity Routing: route requests via bounded-load consistent hashing on
adapter_idto maximize HBM adapter hit rates
📐 Mathematical Derivations
Active VRAM equals ; Unified Paging allocates LoRA weights and KV blocks from one paged pool.
🏭 Production Trade-offs
1) Unmerged SGMV adds ~4% kernel latency vs merged weights but unlocks mixed-tenant batching; 2) Cap distinct adapters per batch to prevent PCIe thrashing.
⚠️ Common Interview Pitfalls
- ✕Fetching cold LoRA adapters synchronously inside the decode loop, stalling co-batched tenants
- ✕Allowing arbitrary high-rank adapters or resized vocabularies that break uniform paging assumptions
🎯 Interviewer Follow-up Inquiries
- ?How does bounded-load consistent hashing spill over cleanly when one hot LoRA saturates a single replica?
- ?How do you handle adapter hot-reloads in-flight without corrupting ongoing multi-turn decode streams?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚