Track 10 · System Design
10.1 ML System Design
48 topics in 6 parts. Use it as a checklist before an interview, or as a map of what to learn next.
- CCritical
- HHigh
- MMedium
- NNew 2026
01The 6-Step Design Framework9 topics
- Step 1: Clarify requirements (3-5 min) — functional + non-functionalC
- Step 2: Estimate scale — QPS, storage, cost back-of-envelopeC
- Step 3: High-level architecture — data + model + serving layersC
- Step 4: Deep dive — zoom into hardest component (critical path)C
- Critical path identification: latency-sensitive chain that determines p99H
- Step 5: Tradeoffs — verbalize every design decision's trade-offC
- Step 6: Monitoring + failures — always mention proactivelyC
- Design walkthroughs: RAG chatbot, voice agent, coding assistantC
- Back-of-envelope: 1M DAU × 10 queries = 12 QPS avg, 120 QPS peakH
02Latency Optimization8 topics
- Streaming via SSE — TTFB metric, perceived latency improvementC
- Semantic caching: Redis + vector search, threshold 0.92, 20-40% hit rateH
- Model routing: cheap model for simple queries, 30-40% cost reductionH
- Async parallel retrieval with asyncio.gatherH
- Prompt caching (Anthropic/OpenAI): 90% discount on stable prefixesH
- Prompt compression (LLMLingua): 60% token reduction at 2-5% quality lossH
- Prefill-decode disaggregation: 2-6.4× throughput gainN
- SGLang RadixAttention: 20-40% better throughput vs vLLMN
03Cost Optimization6 topics
- Monthly LLM cost formula: queries × tokens × $/1M tokensH
- Model routing saves 30-40% (Haiku vs Sonnet: 12× price diff)H
- Semantic cache hit rate: 20-40% reduction for FAQ botsH
- Quantization for self-hosted: 70B BF16=140GB, INT4=35GBH
- Combined: routing + caching + compression = 67% cost reductionH
- vLLM continuous batching: 24× throughput vs naive servingH
04Reliability & Observability7 topics
- Fallback chains: primary → backup → cached/degraded modeH
- Circuit breaker: CLOSED → OPEN → HALF_OPEN, failure thresholdH
- Rate limiting: per-user token bucket, per-tenant quotas in RedisH
- LLM tracing: LangSmith, Arize Phoenix, Langfuse — every call loggedH
- Input/output guardrails: PII, injection, toxicity, length limitsH
- Metrics to alert on: TTFB p95, error rate, daily cost, faithfulness driftH
- LLMOps vs MLOps: prompt versioning, hallucination monitoringN
05Serving Framework Decisions7 topics
- vLLM: default choice, broadest model support, continuous batchingC
- SGLang: highest throughput via RadixAttention, prefix KV treeN
- TensorRT-LLM: lowest latency on H100/H200 nativeH
- Ollama: local dev, GGUF, developer convenienceH
- FIM (Fill-in-the-Middle): code completion training objectiveN
- Coding assistant design: on-device + edge + central 3-tier routingH
- Coding assistant latency tricks: debounce (300ms) + prefix caching + speculative decodingH
06💰 Cost Estimation for AI Systems11 topics
- Token cost math: price per 1M tokens × daily volume = daily spend — name a real numberC
- Example: 1M req/day × 500 tokens × $15/1M (GPT-4o) = $7,500/day — always compute thisC
- Semantic caching: cache 30% of queries → 30% cost reduction — quantify itH
- Model routing: GPT-4o for complex (20%) + GPT-4o-mini for simple (80%) → 60-70% savingsC
- GPU compute: A100 $3/hr, H100 $5/hr, your RTX 4090 at $0.05/hr (electricity)H
- Prompt caching: stable prefix tokens at 90% discount — architect prompts around thisH
- Storage cost: 1M embeddings × 1536 dims × 4 bytes = 6GB → Pinecone/Qdrant pricingH
- Vector DB cost vs pgvector: managed ($70/mo Pinecone starter) vs self-hosted (~$20/mo VPS)M
- Total cost of ownership: LLM API + vector DB + compute + monitoring — roll up to $/user/monthC
- Break-even analysis: if you charge $10/user/month, your infra must cost under $3/userH
- Interviewers grade: candidates who give real cost numbers beat those who only discuss architectureC
Practise it
Knowing it is half.
Saying it is the rest.
Run a realistic voice interview with an AI panel in the Interview Room, then read a scored report on every answer.