MSD0070 LLM Serving Platform

Design an LLM serving platform that hosts dozens of fine-tuned model variants (7B to 70B parameters) behind one API for internal product teams. Think of an internal version of the OpenAI API, where one endpoint fronts base models, fine-tunes, and a discounted batch path. Different callers have different needs: a chat product needs interactive streaming at low concurrency, a data pipeline submits million-request batch jobs overnight, and a research team runs evals at unpredictable times.

Models are fine-tuned weekly, so the platform must roll out new weights without downtime, and every request must be logged for offline eval. GPU capacity is fixed and expensive: the platform decides how many replicas of which model to keep warm.

How would you design this system? Cover the multi-tenant serving architecture (shared base model + adapter loading vs dedicated replicas), the interactive-vs-batch traffic split and how batch jobs scavenge spare capacity, the weight-rollout design (canary, version pinning, rollback), the autoscaling signal (queue depth? TTFT? tokens/sec?), and the observability needed to attribute cost per tenant and catch quality regressions before the product team does.

Line-art scene: three callers (a chat product, a data pipeline with million-request batch jobs, and research evals) send requests into one API endpoint that also writes a request log; a stack of dozens of fine-tuned variants and a weekly calendar wait above a fixed rack of GPUs, with a question mark asking which models stay warm

The Problem: three callers with opposite latency needs, dozens of variants that change every week, and a GPU pool that cannot grow, all behind one endpoint that must log every call.

Answer

The platform is a shared-base, multi-adapter fleet behind one gateway. Each base model (8B and 70B) runs as a pool of continuous-batching replicas that load LoRA adapters per request, and only high-traffic variants or full-weight fine-tunes earn replicas of their own. A priority scheduler serves interactive streams first, evals second, and batch last, so overnight batch jobs scavenge idle GPUs and are preempted within seconds when chat traffic rises. New weights reach traffic through version pins, shadow traffic, and a canary, with the previous version kept warm for instant rollback. Autoscaling keys on queued tokens and KV-cache pressure rather than GPU utilization, and every request is logged with tenant, version, and token counts for cost and quality attribution.

(1) Shared Base + Adapters: LoRA variants share one resident base per size class; adapters (about 84 MB at rank 16 on the 8B base) page between host RAM and GPU and batch together in one forward pass.
(2) Promote Hot Variants: a variant whose steady load exceeds about 1.3 replicas, or any full-weight fine-tune, gets dedicated merged replicas; everything else stays shared.
(3) Three Priority Classes: interactive, eval, and batch queues per pool; batch runs only on spare KV-cache capacity and is preempted, then resumed, when interactive demand rises.
(4) Versioned Rollout: immutable weight versions, caller-side pins, shadow plus a 5% canary on unpinned traffic, and the previous version warm for rollback.
(5) Leading-Signal Autoscaling: scale each pool on queued prefill tokens and KV-cache occupancy with TTFT as the SLO alarm, because a cold 70B replica takes about two minutes to load.
(6) Attributed Logging: every request records tenant, model version, adapter, and token counts, feeding per-tenant cost and offline quality evals.

Serving platform architecture: callers enter an API gateway that tags tenant and version pin, a priority scheduler dispatches to a shared 8B base pool with hot-swapped LoRAs, a shared 70B base pool with hot-swapped LoRAs, or dedicated replicas for hot or full-weight fine-tunes, which stream results back; a model registry feeds weights, the gateway writes a request log that feeds cost and eval dashboards, and an autoscaler reads queued tokens and KV-cache usage to scale the pools

Figure 1: One gateway, one priority scheduler, and shared base pools with hot-swapped LoRAs; dedicated replicas only for hot or full-weight fine-tunes, while the request log feeds cost and eval dashboards and the autoscaler sizes the pools from queued tokens and KV usage.

Clarify Before Designing:
(1) Variant Mix: how many variants are LoRA adapters versus full-weight fine-tunes, and on how many distinct bases? Adapters can only share the base they were trained on.
(2) Interactive SLOs: what time-to-first-token and per-token latency does chat need, at p95 or p99? This caps the batch size each replica may run.
(3) Batch Deadlines: must overnight jobs finish by morning, or is a 24-hour completion window acceptable? A looser deadline lets batch absorb all the slack.
(4) Pool and Hardware: how many GPUs of which type, and does a 70B model fit with tensor parallelism inside one NVLink node?
(5) Version Contract: do product teams want “latest” automatically, or must they pin exact versions for reproducible evals?
(6) Cost Model: do tenants get dollar chargeback, token quotas, or both?


Login to view more content
Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *