KatInterview

Design a Globally Scalable, High-Availability Generative AI Serving Platform

Machine LearningModel answer
HardModel answerMachine Learningml system designgenaillm serving

Last updated

Design a production-grade infrastructure for real-time generative AI inference that supports streaming, low-latency SLOs, multi-region failover, and efficient GPU utilization.

Design an enterprise-grade inference platform for hosting large language models (LLMs) at global scale. The system must support real-time token streaming, meet strict latency service-level objectives (SLOs), and maintain high availability even during regional infrastructure outages or sudden traffic spikes.

Operational Requirements & Goals

  1. API & Functionality: Provide a low-latency streaming endpoint (POST /v1/chat/completions) supporting multiple model sizes (e.g., 8B and 70B parameter models), configurable decoding parameters, context prefix reuse, and multi-tenant rate limiting.
  2. Performance Constraints:
    • Time to First Token (TTFT): $p_{99} < 1.0\text{ s}$
    • Time Per Output Token (TPOT): $p_{99} < 50\text{ ms}$
    • Availability Target: 99.95% uptime globally.
    • Target Throughput: 2,000 requests/second globally at peak (average 1,000 prompt tokens and 300 output tokens per request).
  3. Core Architectural Areas to Address:
    • High-level platform architecture and request flow.
    • Inference execution strategies (batching, KV cache management, prefill vs. decode disaggregation).
    • Smart request routing (prefix-aware hashing, load-based load balancing).
    • Autoscaling metrics, GPU topology-aware scheduling, and cold-start mitigation.
    • Multi-region disaster recovery and active-active failover handling.
    • Release management (canary deployments, shadow traffic, immutable artifacts).

Hints

Hint 1

Quantify KV cache memory footprints alongside compute bounds; memory bandwidth and capacity are almost always the primary bottlenecks in LLM generation.

Hint 2

Contrast static batching with continuous/in-flight batching and explain why prefill and decode phases benefit from compute/memory disaggregation.

Hint 3

Differentiate standard CPU/memory autoscaling metrics from LLM-specific signals like KV-cache block usage and pending queue wait time.