What does the first forward pass set up that the second one doesn't pay for?
Production serving stacks run a warm-up forward pass at the expected shapes before the pod accepts traffic. Explain what concretely happens during that first pass that the second and subsequent passes get for free, and why skipping warm-up shows up as a multi-second TTFT spike on the very first real request.
The first forward pass runs cuBLAS/cuDNN heuristic search, CUDA-graph capture, and any JIT or TensorRT engine build, all cached after.
Imagine a chef arriving at a new kitchen for the first time. Before they can cook the first dish quickly, they have to learn where every pot lives, sharpen the knives to the right edge for this style of food, and pre-heat each burner to the temperature this menu wants. Once they have done all that, every dish after the first comes out fast. If you make a paying customer the first order of the night, that customer waits while the chef learns the kitchen. A warm-up is sending a fake order before opening so the chef can do all that learning, then the first real customer gets the fast experience.
Detailed answer & concept explanation~7 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: name the four caches that fill on first pass (cuBLAS heuristic, CUDA graphs, JIT engine, allocator pools), quantify the total cost, explain shape-keyed caching, and connect to the readiness-probe placement.
| Phase | What happens | Typical cost | Cache-key |
|---|---|---|---|
| Weight load | Read parameters from disk to HBM | 1-30 s depending on size | Per pod |
| cuBLAS / cuDNN autotune | Benchmark or heuristic-pick best GEMM algorithm | 10-200 ms per shape | Per (shape, dtype, GPU) |
| CUDA graph capture | Record kernel launch sequence | 10-100 ms per graph | Per (shape, batch, seq_len) |
| JIT / TensorRT compile | Build fused-kernel engine | 1-300 s on first ever build | Per (model, ops, shapes) |
| Allocator priming | Carve permanent memory pools | Tens of ms | Per pod |
| GPU clock ramp | DVFS reaches boost clocks | Sub-second | Per workload start |
Real products, models, and research that use this idea.
- vLLM ships a warmup_steps parameter that walks the configured decode batch sizes during engine init, before the API server starts accepting requests.
- TensorRT-LLM builds an engine ahead of time, but its runtime still needs a warm-up forward pass on the GPU to materialize plans and prime allocators after loading the engine.
- PyTorch 2.x's torch.compile mode does a noticeable first-call compile, which is why production stacks using compile mode set readiness probes to wait several minutes after pod start.
- Kubernetes deployments routinely use a separate startup probe (long timeout, allows several minutes) followed by a readiness probe (short timeout) precisely to give the warm-up enough room.
- Spot instance fleets that churn often hide this problem behind autoscalers but show it on the user side as P99 latency spikes correlated with new pod creation.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy must warm-up cover all production shapes, not just one?
QWhat is the interaction between warm-up and dynamic batching in continuous-batching servers?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating cold start as a model-load problem. The weight load is part of it, but the bigger surprise is the per-shape autotune, graph capture, and JIT compile that fire only on the first forward pass at each shape.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.