KatInterview

Design a Real-Time and Batch AI Model Serving Platform

Machine LearningModel answer
HardModel answerMachine Learningml-system-designinferencekubernetes

Last updated

Design a cloud inference platform that serves ML models at scale, covering hardware selection, autoscaling, multi-tenancy, cost controls, and safe deployment strategies.

Scenario

You are a senior ML infrastructure engineer at a company that offers model inference as a service. Engineering leadership has asked you to design the platform from scratch. It must handle two distinct workload types: low-latency real-time inference (chat completions, embeddings, vision) and high-throughput batch scoring (offline ranking, bulk generation).

What to Design

Walk through the full system. You are expected to make reasonable assumptions and state them clearly. Cover:

  • Model packaging and versioning — how models are stored, tracked, and promoted to production
  • Hardware selection — when to use CPUs vs. different GPU tiers, and why
  • Autoscaling — what signals to scale on, and how to handle cold starts for large models
  • Request routing — how traffic is dispatched to replicas, including weighted splits for rollouts
  • Multi-tenant isolation — security boundaries and performance fairness across tenants
  • SLOs and observability — what latency/throughput targets you would set and how you would measure them
  • Cost controls — right-sizing, spot instances, utilization targets
  • Failure handling and safe rollouts — canary deployments, shadow testing, fallback behavior
  • Kubernetes integration — how the serving infrastructure maps onto Kubernetes primitives
  • Comparison to existing offerings — where your design aligns with or diverges from platforms like SageMaker, Vertex AI, or Azure ML

What Is Expected

This is an open-ended design question. A strong answer:

  • Starts with scoped assumptions and a back-of-envelope estimate to ground the design
  • Identifies the two or three hardest problems early and addresses them with depth
  • Makes explicit trade-offs rather than listing features
  • Includes concrete numbers (latency targets, GPU memory, token throughput) where useful
  • Discusses failure modes and how the system degrades gracefully

Hints

Hint 1

Start by nailing down your assumptions: number of tenants, RPS, model sizes, and SLO targets. These drive every hardware and scaling decision that follows — a design without them is just a list of buzzwords.

Hint 2

GPU utilization vs. tail latency is the central tension in LLM serving. Think about what signal you actually scale on (queue depth, KV-cache fill, p95 TTFT) and why CPU% is the wrong metric here.

Hint 3

Cold starts for large models are a genuine hard problem — a 70B model can take several minutes to load. Think through the full chain: node provisioning, image pull, weight loading, and which of those you can parallelize or pre-warm.