KatInterview

Design a Multi-Tenant GPU Inference Engine

System DesignModel answer
HardModel answerSystem Designsystem-designmachine-learninggpu-inference

Last updated

Architect a scalable, low-latency API platform for serving multi-tenant deep learning workloads (including LLMs) across heterogeneous GPUs under strict latency SLOs.

Design a scalable, multi-tenant GPU inference engine capable of serving diverse deep learning models—ranging from small vision/text classifiers to massive autoregressive Large Language Models (LLMs)—to internal product services and external API consumers.

Your system must handle low-latency online inference with explicit Service Level Objectives (SLOs), scale gracefully from small pilot traffic to tens of thousands of requests per second across heterogeneous GPU hardware (e.g., NVIDIA H100, A100, L4), and manage multiple concurrent model versions and LoRA adapters.

Walk through the end-to-end architecture and address the following structural topics:

  1. API Design & Interface Protocol: Define the synchronous and asynchronous API surfaces. Specify request/response schemas, tenant authentication, versioning semantics (API path vs. model alias/pinning), protocol choices (gRPC vs. HTTP/2 + SSE), and job polling/webhook mechanisms.
  2. System Architecture & Request Lifecycle: Trace request flows through the API Gateway, CPU preprocessing tier, routing layer, continuous batching engine, GPU worker fleet, model registry, and async job queue.
  3. Decoupled Autoscaling: Explain how and why CPU frontend scaling signals differ from GPU pool scaling signals.
  4. Diagnostic Scenario: Outline a step-by-step diagnostic workflow for a situation where CPU usage is low but GPU nodes are fully saturated under rising tail latencies.
  5. SLO-Aware Scheduling & Batching: Compare micro-batching for static models against continuous batching (prefill vs. decode disaggregation) for LLMs. Explain fair-queueing mechanisms across tenants and backpressure handling.
  6. GPU Memory & KV-Cache Management: Describe memory allocation strategies (PagedAttention, prefix caching, quantization), tensor/pipeline parallelism, and per-tenant memory isolation.
  7. Multi-Model Hosting & Adapter Management: Explain colocation strategies (Multi-Instance GPU vs. MPS vs. time-slicing) and shared base-model execution for multi-tenant LoRA adapters.
  8. Deployment, Rollout & Fault Tolerance: Detail model versioning, shadow traffic, canary rollouts, artifact caching hierarchies (S3 → NVMe → Host RAM → VRAM), and multi-region failover routing.