llm-cold-start-benchmark / cross_model_report.md
ArchCoder's picture
Add cold-start benchmark results
4bba228 verified
|
Raw
History Blame Contribute Delete
12.6 kB

LLM Container Cold-Start: Cross-Model Report

1. Coverage

  • Models benchmarked: 25
  • Observations: 141
  • Weights moved: 100.9 GiB
  • Architecture families: 17 (bloom, deepseek, deepseek-r1, falcon3, gpt2, granite, phi, pythia...)
  • Hardware: Tesla T4
  • Experiments: checkpoint_format (70), engine_init (23), storage_tier (48)

Coverage gaps (3 models incomplete). Stated up front because a missing cell is a silent hole in every table below:

  • granite-3.1-2b: missing storage_tier
  • qwen2.5-7b-awq: missing engine_init
  • qwen2.5-7b-gptq-int4: missing engine_init

2. How does load time scale with checkpoint size?

Three fits per condition, because the first one alone is misleading. ms/GiB is the familiar linear slope. exponent b comes from a log-log fit of ms = a x GiB^b: b~1 means constant throughput, b>1 means throughput degrades as checkpoints grow. fixed cost is the linear model's intercept -- a checkpoint of size zero cannot take negative time, so a large negative value is proof the linear model is the wrong shape.

Condition ms per GiB exponent b linear R2 fixed cost (ms) n
safetensors-nommap 2187 1.58 0.676 -4237 :warning: 25
safetensors 3271 1.79 0.663 -7001 :warning: 25
pytorch_bin 6225 2.10 0.846 -12263 :warning: 20

2.1 The headline finding: cold start is superlinear

Every condition has b > 1 (up to b = 2.10 for pytorch_bin). Doubling the checkpoint more than doubles the load time, so there is no single MiB/s that describes this system -- effective throughput is a function of model size, not a constant of the hardware.

Every linear fixed cost above is sharply negative, which is not a small numerical artefact: it is the linear model bending to chase a curve. Quoting those slopes as throughput, or extrapolating from them, would be quoting an artefact.

2.2 Where throughput collapses

Taking the median throughput of the smallest checkpoints as a healthy baseline and walking upward until it falls below 75% of that:

Condition healthy MiB/s collapses above degraded MiB/s drop
pytorch_bin 1171 1.40 GiB 886 1.3x
safetensors 1535 5.18 GiB 758 2.0x
safetensors-nommap 1562 5.18 GiB 841 1.9x

The most likely cause is host memory, not the storage device. These runs used a Colab T4 instance with roughly 12-13 GiB of usable system RAM. The mmap path depends on the OS page cache holding the checkpoint while tensors are materialised; once a checkpoint plus its in-flight copies approaches that budget, pages are evicted and re-read and the effective rate falls off. The collapse point sitting near 5 GiB -- comfortably under total RAM, but not under RAM minus the working copy -- is consistent with that reading.

This is a testable claim rather than a conclusion, and the test is cheap: re-run the same models on a high-RAM instance. If the boundary moves with available memory it is memory pressure; if it stays at 5 GiB it is something in the loader.

Why it matters for a serving platform: a cold-start budget extrapolated from small models will be optimistic for large ones, and the gap widens with size. It also means the first question about any deployment is which regime it sits in -- below the boundary, storage bandwidth is the lever; above it, no amount of storage bandwidth helps because the bottleneck has moved to memory.

3. Checkpoint format: safetensors vs legacy pickle

Model GiB safetensors (ms) .bin (ms) speedup
bloom-1b7 3.208 2017.4 3475.4 1.72x
bloomz-560m 1.042 695.2 902.5 1.3x
deepseek-coder-1.3b 2.508 1715.6 2193.0 1.28x
deepseek-r1-distill-qwen-1.5b 3.31 2872.8 3407.9 1.19x
falcon3-1b 3.11 2086.5 3594.2 1.72x
gpt2-large 3.024 2128.8 3598.9 1.69x
gpt2-medium 1.416 890.6 1166.8 1.31x
granite-3.1-2b 4.719 4069.4 21260.6 5.22x
phi-2 5.178 4854.0 23573.9 4.86x
pythia-1.4b 2.729 1723.5 3503.2 2.03x
pythia-2.8b 5.294 6273.7 23810.8 3.8x
qwen2.5-1.5b 2.875 1807.3 2783.4 1.54x
qwen2.5-coder-1.5b 2.875 2423.9 2740.7 1.13x
qwen3-0.6b 1.4 949.5 1850.1 1.95x
qwen3-1.7b 3.784 2394.4 4360.8 1.82x
smollm2-1.7b 3.188 1980.5 3392.7 1.71x
smollm3-3b 5.728 7371.8 25872.5 3.51x
stablelm-2-1-6b 6.126 8701.5 27647.7 3.18x
stablelm-zephyr-3b 5.207 20583.5 21731.0 1.06x
tinyllama-1.1b-v1.0 2.049 1315.0 1988.3 1.51x

Median speedup 1.71x across 20 models (range 1.06-5.22x). Same tensors, same bytes on the wire: the difference is that safetensors memory-maps a flat buffer while the pickle path reconstructs every tensor through the Python interpreter. This is the cheapest available win -- a format migration costs no model quality and no hardware.

4. Quantization: what 4-bit buys at load time

Run a quantized/fp16 pair (e.g. qwen2.5-7b and qwen2.5-7b-awq) to populate this section.

5. Per-shard overhead

Checkpoint layout ms per GiB fixed cost (ms) R2 n
single shard 2971.4 -5267.0 0.5201 15
multi shard 6688.9 -28010.1 0.8451 10

Extra fixed cost attributable to sharding: -22743.1 ms. On a local filesystem this is just extra open()s and header parses. On network-attached or object storage each shard is a separate request with its own round-trip, so this term grows with latency and is worth re-measuring against the real backing store.

6. Storage tiers

Tier median MiB/s min max models
local-nvme 1332.6 241.3 1638.9 24
remote-emulated-200MiBs 172.5 109.5 178.3 24

Tiers whose name contains emulated are bandwidth-capped in software rather than measured against real remote storage; the harness only ever slows a read down, never speeds it up, so these are a floor on the real penalty.

7. Engine bring-up

Model GiB backend p50 (ms) p95 (ms)
bloomz-560m 1.042 transformers 2870.1 3227.8
qwen3-0.6b 1.4 transformers 3109.5 7340.8
gpt2-medium 1.416 transformers 1285.0 5730.4
tinyllama-1.1b-v1.0 2.049 transformers 3825.7 6858.9
deepseek-coder-1.3b 2.508 transformers 1947.2 7655.4
pythia-1.4b 2.729 transformers 1334.5 3878.4
qwen2.5-1.5b 2.875 transformers 2262.2 5195.4
qwen2.5-coder-1.5b 2.875 transformers 4862.0 10771.0
gpt2-large 3.024 transformers 4213.0 10072.8
falcon3-1b 3.11 transformers 3882.9 12556.5
smollm2-1.7b 3.188 transformers 1520.0 7757.8
bloom-1b7 3.208 transformers 10647.4 10798.6
deepseek-r1-distill-qwen-1.5b 3.31 transformers 3525.1 13968.9
qwen3-1.7b 3.784 transformers 8692.3 18968.1
granite-3.1-2b 4.719 transformers 12946.3 19295.6
phi-2 5.178 transformers 17282.6 19939.7
stablelm-zephyr-3b 5.207 transformers 19660.7 20809.7
pythia-2.8b 5.294 transformers 19414.5 21810.3
smollm3-3b 5.728 transformers 22397.2 23205.7
stablelm-2-1-6b 6.126 transformers 19685.1 21764.4
phi-3.5-mini 7.117 transformers 25219.9 30470.2
phi-3-mini-4k 7.117 transformers 15268.9 22811.1
qwen3-4b 7.492 transformers 32412.5 32641.3

Weight transfer is only one term. Engine bring-up adds CUDA context creation, kernel/JIT warm-up, graph capture and KV-cache allocation. Where this term is large relative to weight loading, snapshot/restore techniques pay off; where weight transfer dominates, they do not -- which is exactly the distinction this table is here to make.

8. Projection to production scale

Projecting from the stable regime only (1354 MiB/s, R2=0.868, n=16, checkpoints below 5.18 GiB), fitted through the origin so a checkpoint of size zero costs zero time.

The degraded regime is deliberately excluded: past the boundary the slope describes this instance running out of host memory, and a production node has a different amount of memory. Projecting the collapse would be projecting a property of a free Colab VM onto a server.

Model GiB params predicted weight load
phi-3-medium-4k 26.003 14.0B 20 s
phi-4 27.305 14.7B 21 s
qwen3-14b 27.508 14.8B 21 s
qwen2.5-14b 27.511 14.8B 21 s
qwen3-30b-a3b 56.873 30.5B 43 s
qwen3-32b 61.024 32.8B 46 s
qwen2.5-32b 61.028 32.5B 46 s
qwen2.5-72b 135.426 72.7B 102 s

These are a lower bound, and both directions of error are known:

  • Optimistic, because it assumes throughput stays healthy at sizes far beyond anything measured here. Whether it does depends on the target having enough memory headroom -- exactly the question section 2.2 raises.
  • Pessimistic, because production serving shards a large checkpoint across several GPUs and pulls the shards in parallel, while every number here is a single-device sequential load.
  • It covers weight transfer only. Section 7 shows engine bring-up is a comparable cost at these sizes; a real cold start is the sum.

For a 27-32B class model the arithmetic gives roughly 46 s of sequential weight transfer at this throughput. That is a sanity check on an order of magnitude, not a prediction for any particular deployment.

9. How much to trust these numbers

  • Median relative standard deviation: 15.4%
  • 90th percentile RSD: 82.9%
  • Worst case RSD: 215.4%
  • Conditions measured: 141

An effect smaller than the run-to-run spread is not a finding. Read every speedup above against this table: differences of a few percent are noise, and only the large multiples are safe to act on. Cold reads were forced between trials (page-cache eviction, or posix_fadvise where unprivileged), and warm-up runs discarded.

9.1 Measurements to discount (41 of 141, 29%)

These conditions have a relative standard deviation of 30% or more. They are reported rather than silently dropped, but no conclusion above rests on them, and they are the first candidates for a re-run with more repeats.

Model Experiment Condition p50 (ms) RSD
smollm2-1.7b engine_init transformers 1520.0 215%
gpt2-medium engine_init transformers 1285.0 187%
deepseek-coder-1.3b engine_init transformers 1947.2 161%
deepseek-r1-distill-qwen-1.5b engine_init transformers 3525.1 160%
falcon3-1b engine_init transformers 3882.9 128%
bloom-1b7 checkpoint_format safetensors 2017.4 118%
phi-2 checkpoint_format safetensors 4854.0 112%
deepseek-coder-1.3b checkpoint_format safetensors 1715.6 109%
pythia-1.4b engine_init transformers 1334.5 101%
qwen2.5-7b-awq storage_tier local-nvme 5635.8 94%
gpt2-large engine_init transformers 4213.0 89%
deepseek-r1-distill-qwen-1.5b checkpoint_format safetensors 2872.8 88%
qwen3-1.7b storage_tier local-nvme 2967.4 88%
qwen2.5-7b-gptq-int4 checkpoint_format safetensors 5751.2 86%
qwen3-1.7b engine_init transformers 8692.3 83%
... and 26 more

The dominant source is almost certainly the shared, contended I/O of a free-tier VM: neighbouring tenants on the same host move the storage numbers far more than anything in the harness does. This is the strongest argument for treating the ratios here as the result and the absolute milliseconds as context.

10. Limitations

  • Free-tier hardware: a single consumer GPU with shared, contended host I/O. Absolute numbers are not production numbers; the ratios and the scaling behaviour are what transfer.
  • Driver-level checkpoint/restore (proprietary GPU memory snapshotting) cannot be reproduced here. Where a technique was out of reach, the closest honest proxy was measured and labelled.
  • Emulated storage tiers are software bandwidth caps, not real network storage.
  • Projections assume linear scaling in bytes; see section 8.