Measure the anatomy of a GPU cold start
Colab T4 · freeexperiment120 minrequiredGoal · A measured budget of a cold start on a free T4 for a 1-3B parameter model, split into CUDA context init, weights load, and first-token warmup, plus one optimization applied and re-measured.
- 1Time a cold CUDA context init (first CUDA op in a fresh process) separately from torch import time.
- 2Time loading a 1-3B model from local disk with safetensors versus a simulated object-storage download (copy over a throttled loopback or timed file copy).
- 3Time first-token latency for the first request after load versus the second request, isolating warmup (kernel autotune, allocator growth).
- 4Apply one optimization, safetensors mmap, warm CUDA context reuse, or pre-captured graphs, and re-measure each affected stage.
- 5Tabulate the budget and state which stage dominates and what the next optimization would be.
- Deliverable
- A notebook with the per-stage timing table, before and after the optimization, and one plot of first versus second request latency.
- Check
- The three stages are measured separately with at least 5 repetitions each; the optimization shows a measurable improvement in at least one stage with the number reported.
- Fallback
- Do the exercise with a 125M model on CPU, timing process start, weights load and first forward pass; the stage anatomy and method are the lesson, the absolute numbers differ.