SysDesignAtlas

Model Deployment & Rollout

Shipping a 140 GB artifact — registries, weight distribution, warm-up, and why canarying a model needs quality gates that a service deployment never does.

HLDMedium11 min readaideploymentmlopsrollout
Confidence

#Why this isn't a normal deployment

A container image is a few hundred megabytes, starts in seconds, and is either correct or throws an exception. A model deployment breaks every one of those assumptions.

   SERVICE DEPLOY                 MODEL DEPLOY

   200 MB image                   70-500 GB of weights
   starts in seconds              minutes to load into HBM
   correctness is binary          quality is a distribution
   errors are visible             regressions are silent
   rollback is instant            rollback needs the old weights
                                    still resident somewhere
   canary on error rate           canary on... what, exactly?

"Quality is a distribution" means a new model isn't simply right or wrong: it might be better on most prompts, slightly worse on code, and much worse on one rare format, all at once. The last two rows are where teams get hurt. A model that is 4% worse at code generation throws no exceptions and fires no alerts. It just quietly makes your product worse until someone notices in a week.

#The registry

Weights alone are not deployable. A model version is a bundle:

   model: support-classifier
   version: 2026-08-03-a7f31c
   ├── weights/               sharded safetensors
   ├── tokenizer/             config + merges + vocab
   ├── config.json            architecture, dtype, context length
   ├── generation_config      default sampling parameters
   ├── chat_template          EXACTLY the training format
   └── metadata
       ├── base model + commit
       ├── training data snapshot ID
       ├── eval results at release
       ├── quantization recipe
       └── engine version compatibility range

Content-address everything. The version ID should be a hash of the weights plus config. Then "which model produced this output" is answerable exactly, and two deployments claiming the same version are provably identical.

#Distributing 140 GB

Rolling out to 200 replicas means moving 28 TB. Naively, that's 200 concurrent pulls from object storage.

MethodThroughputNotes
Direct from object storageLimited per-connection; throttled when hundreds of servers pull at onceFine at small scale
Parallel range requests5–10× a single streamThe easy first win
Regional cache / mirrorPay egress once per regionStandard for multi-region
P2P distribution (Dragonfly, Kraken)Scales with fleet sizeReplicas seed each other; best for large fleets
Pre-baked into the node imageInstantInflexible; a new model needs a new image
Shared network filesystemOne copyThe filesystem becomes a single point of failure and a bottleneck

Lazy loading is the technique worth knowing. You memory-map the weight file: the operating system treats the file as if it were already in memory, but only actually reads each piece from disk the first time something touches it. So layer 1's weights load when layer 1 first runs, and so on. The server starts accepting traffic almost immediately, and the first few requests are slow while the pieces load. safetensors is a weight format designed for exactly this: the bytes on disk are already laid out exactly as they'll sit in memory, so nothing has to be unpacked or converted (no deserialisation). Together they cut startup from minutes to seconds.

#Warm-up

A freshly loaded model is slow for reasons beyond loading the weights. The GPU library picks and tunes its fastest routines (kernel autotuning) the first time it sees each request shape. Many engines also capture CUDA graphs — a recording of the exact sequence of GPU operations for a given shape, so it can be replayed later without re-issuing each step. Memory pools have to be carved out, and the prefix cache is empty. All of that happens on whoever's request arrives first.

   NAIVE                          WITH WARM-UP

   pod ready → traffic            pod starts
     ↓                              ↓
   first 100 requests are         load weights
   3-10× slow                       ↓
     ↓                            run synthetic requests at
   p99 spike visible to users       representative shapes
                                    ↓
                                  pre-populate common prefixes
                                    ↓
                                  THEN mark ready → traffic

A readiness probe is the check an orchestrator uses to decide a new instance can receive traffic. It must not pass until warm-up completes — and this is a common misconfiguration: the process is listening, so Kubernetes declares it ready and sends users straight into the slow cold requests. The probe should test "warm", not "up".

Pre-populating the prefix cache with your system prompts is worth doing explicitly — otherwise the first N users of each replica pay a full prefill for content that should have been cached.

#Rollout strategy

  1. 1 Offline eval golden sets, must beat the incumbent
  2. 2 Shadow mirror real traffic, compare, serve nothing
  3. 3 Canary 1% real users; watch latency AND quality
  4. 4 Ramp 5% → 25% → 50%, holding at each
  5. 5 Full old version stays warm for fast rollback
Each gate can stop the rollout. Quality gates are the ones a service deploy doesn't have.

Shadow mode is disproportionately valuable here and underused. Send real production traffic to the new model, discard its output, and compare against the incumbent's. You get real distribution coverage — the full messy variety of what users actually send, not just the cases in your test set — with zero user risk. What you cannot get from it: anything requiring user feedback, since nobody sees the output.

Canary needs quality signals, not just error rates. A model regression shows up as:

SignalDetects
Output length distributionTruncation, runaway generation, format collapse
Refusal / safety-trigger rateOver-alignment (refusing harmless requests) or under-alignment (answering ones it shouldn't)
Tool-call validity rateStructured output degradation — very sensitive
Downstream conversion or task successThe thing you actually care about
Explicit user feedback (thumbs)Slow signal, high value
Retry and regeneration rateUsers silently telling you the answer was bad
LLM-judge score on a live sampleFast proxy; needs its own validation

Tool-call validity is the best early indicator in an agentic product. It's binary, high-volume, computable in real time, and extremely sensitive to model changes. A drop from 98% to 94% is unambiguous and shows up within minutes.

#A/B testing models

Beyond canarying, you often want to measure which model is better on live traffic.

  • Randomise by user, not by request. Users notice inconsistency within a session, and per-request randomisation contaminates conversation history with two different models' outputs.
  • Run long enough for slow metrics. Retention and task-completion signals take days to weeks; latency and validity take minutes.
  • Watch for interaction effects. A model that's better in isolation can be worse combined with your prompts, which were tuned for the old one.
  • Beware novelty. Users react to any change at first — curious about new behaviour, or annoyed that something feels different. That alone moves engagement metrics for a few days in either direction, so don't judge the winner from the first days' data.

#Multi-model serving

Most production systems serve several models. Two shapes:

Dedicated pools — one model per replica set. Simple, isolated, and you pay for idle capacity per model.

Shared base with adapters — one base model, many LoRA adapters loaded on demand. Enormously more efficient for many fine-tuned variants: 100 customer-specific models in the memory of one, with requests from different customers batching together.

The routing layer then needs to know which model each request wants, keep hot adapters resident, and evict cold ones by LRU — a small caching problem sitting on top of the serving stack.

#Check yourself

Why is a model deploy unlike a service deploy?Show answer
70–500 GB of weights take minutes to load, quality is a distribution rather than pass/fail, regressions are silent, and rollback needs the old weights somewhere fast.
What belongs in a model artifact?Show answer
Weights, tokenizer, config, generation defaults, the exact chat template and metadata (base model, data snapshot, eval results, quantization recipe, engine compatibility), content-addressed.
Why is the chat template the most common silent failure?Show answer
A model learned one exact format; serving with a drifted copy degrades quality with no error. Ship it in the artifact and smoke-test the rendered token IDs, not the string.
How do you distribute huge weights quickly?Show answer
Parallel range requests, regional mirrors, P2P distribution (replicas seed each other — minutes instead of ~23), and lazy mmap loading of safetensors so serving starts almost immediately.
Why warm up before marking a replica ready?Show answer
Kernel autotuning, memory pools and an empty prefix cache make first requests 3–10× slower. Run representative synthetic requests, pre-populate system prompts, and have the readiness probe test "warm", not "up".
What is shadow mode good for?Show answer
Mirroring real traffic to the new model and comparing outputs with zero user risk and real distribution coverage — though it can't measure user feedback.
Which canary signals catch model regressions?Show answer
Output length distribution, refusal rate, tool-call validity (the best fast indicator), task success, retries and regenerations, thumbs feedback and an LLM judge on a live sample.
How should rollback and A/B testing be set up?Show answer
Keep the old weights on local NVMe or warm replicas, with a written, automatable rollback trigger. Randomise A/B tests by user, not request, and run long enough for slow metrics.

#What to carry forward

  • A model version is weights plus tokenizer plus chat template plus metadata, content-addressed.
  • The chat template is the most common silent failure. Ship it with the artifact; assert on token IDs.
  • Distribution time is rollback time. P2P or local NVMe caching, decided in advance.
  • Warm up before marking ready — CUDA graphs, kernel autotuning, prefix cache.
  • Canary on quality signals, not error rates. Tool-call validity is the best fast indicator.
  • Shadow mode gives real distribution coverage at zero user risk.
  • Randomise A/B by user, not request.
00:00
/ 11m