20.4.5 Adapters and elastic capacity
This part of Serving, Capacity & Load Testing: Math to Code develops the mechanisms below. Work the numerical examples or trace the code before checking the answer.
Concepts from other sections (7)
This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.
- cold start: the time from scheduling a replica to serving its first request, dominated by fetching and reading weight bytes and then by engine initialization. Read more: 20.3.4 Portability and load triage
- BF16: a 16-bit float with float32’s sign and exponent and 7 mantissa bits; the top half of a rounded float32. Read more: 6.7 Safetensors for every dtype, atomic checkpoints, and the token stream
- KV cache: the stored keys and values of all processed tokens, per layer, that let each new token attend without recomputation. Read more: Chapter 20: Inference Engines and GPU Deployment
- Service Level Objective (SLO): a target for a defined measure of service behavior over a specified window. Read more: Chapter 13: Engineering Acronyms in Software Engineering
- LoRA: a frozen Linear plus a trainable low-rank update . Read more: 12.6 LoRA: low-rank adaptation with PiSSA initialization and merging
- TTFT (time to first token): time from a request’s arrival to its first generated token. Read more: 23.4 Chunked prefill (mixed prefill + decode batches)
- lead time: the delay from an autoscaling decision to a replica serving traffic, including node provisioning and cold start. Read more: 20.7.5 Adapter fleets and operations
Learning objectives
- Account for cold starts and adapter working sets when planning replicas.
Multi-LoRA, serverless versus dedicated, cold start, and autoscaling
Section titled “Multi-LoRA, serverless versus dedicated, cold start, and autoscaling”The remaining decisions are about the fleet rather than one engine: how many models share a GPU, who pays for idle time, and how replicas come and go.
Multi-LoRA serving runs one base model with many adapters of rank . An adapter’s size is . For Llama-3.1-8B with on all 7 projections, that is about 42M parameters, 84 MB at BF16, versus 16 GB for a full fine-tune. Punica introduced SGMV, a kernel that batches requests for different adapters in one launch, and S-LoRA pages adapters between host and GPU in a unified pool with the KV cache. The cost is extra FLOPs proportional to and a throughput hit that grows with the number of distinct adapters per batch (--max-loras or --max-loras-per-batch).
Serverless deployments with shared, per-token pricing can multiplex customers on a device. Available model choices, batch controls, cold-start behavior, and isolation depend on the service contract. Dedicated capacity priced per GPU-hour can offer more control, while charging for idle time as well as useful work. Compare the complete service and quality contract before using a price-only break-even model.
For an illustrative dedicated cost of USD 2.50/hour and shared price of USD 0.20 per million output tokens, the price-only break-even is output tokens/hour, about 3,470 tokens/sec. This assumes matched output quality and excludes input-token charges and other service costs. Dedicated capacity must actually sustain that rate under the required SLO; below it, the shared service is cheaper under these assumptions.
Cold start is , where init covers profiling, CUDA graphs, and torch.compile. 140 GB of 70B BF16 weights at 1 GB/s from object storage takes 140 s; at 7 GB/s from local NVMe, 20 s. The mitigations are weights cached on node NVMe, streaming loaders (vLLM --load-format runai_streamer), precompiled graph caches, warm pools, and LoRA instead of full fine-tunes so the base model stays resident. Model Loading: Hub to GPU works through these terms in detail.
Autoscaling should key on queue depth (vllm:num_requests_waiting, sglang:num_queue_reqs), KV utilization (vllm:kv_cache_usage_perc, sglang:token_usage), and TTFT p99 against the SLO.
Warning: Do not autoscale on CPU or GPU utilization. GPU utilization reads near 100% at batch 1 and at batch 200 alike.
Scale-to-zero saves money only if cold start is inside the customer’s tolerance. Pair it with a minimum of one replica during business hours, and scale on queue depth with a lead time larger than the cold start.
Summary
Section titled “Summary”Account for cold starts and adapter working sets when planning replicas. State the assumptions before applying the result to a different workload.
Review questions
Section titled “Review questions”-
Why does an idle replica sometimes remain useful?
Answer
It can provide warm capacity before a new replica loads weights and becomes ready; compare that benefit with idle cost.
Chapter contents · Next: Load tests and the deployment runbook