How we achieved truly serverless GPUs
Modal cuts GPU inference replica cold starts from roughly 2,000 seconds to about 50 seconds, a 40x speedup, by attacking each stage of spin-up. A solver-managed buffer of idle, health-checked GPUs, allocated with Google's GLOP linear program, takes instance provisioning out of the hot path. ImageFS, a libfuse filesystem, serves container images lazily from a tiered content-addressed cache, and CPU and CUDA checkpoint/restore skip host- and device-side initialization. The motivation is GPU Allocation Utilization: spiky inference demand leaves fixed allocations at 10-20% use, and fast autoscaling raises utilization and quality of service together.
Related posts
- Memory snapshots: Checkpoint/restore for sub-second startup
Modal mediumAdept
Modal cuts serverless container cold starts roughly 2.5x by checkpointing a gVisor container's full process tree and filesystem mutations just before it accepts a request, then restoring it instead of re-running Python's syscall-heavy import path (import torch alone makes 26,000 syscalls through OverlayFS and a FUSE lazy-loading server). Restore speed depends mostly on getting the main process's memory pages into the page cache. gVisor loads pages in the background, prioritizing faulting pages, while the FUSE layer aggressively preloads the pages file. Snapshots are created on demand per worker because of CPU feature, NVIDIA driver and runtime compatibility. GPU state can't be saved, so models are loaded into CPU RAM before the snapshot and moved to the GPU after restore via snap=True/snap=False lifecycle hooks.
- GPU Memory Snapshots: Supercharging sub-second startup
Modal mediumAdept
Modal's GPU memory snapshots extend its gVisor-based checkpoint/restore to capture GPU state, using NVIDIA's new CUDA checkpoint API (driver branches 570/575) to lock CUDA processes, copy device memory, kernels, streams, contexts and memory mappings to host memory, then snapshot CPU and GPU state together. Restoring skips expensive warm-up such as torch.compile, CUDA graph capture and moving weights from CPU to GPU, which removes the earlier split between pre- and post-restore setup methods. Reported cold starts drop by up to 10x, for example Parakeet from about 20s to 2s, vLLM with Qwen2.5-0.5B from 45s to 5s, and a compiled ViT from 8.5s to 2.25s. The feature is in alpha and is enabled with an experimental flag.
- The future of AI needs more flexible GPU capacity
Modal easyNovice
Inference and many other GPU workloads are highly volatile: Poisson noise, daily and weekly cycles, viral spikes and bursty batch jobs, which pushes fixed-reservation GPU clusters below 50% utilization. A service at 1 req/s with 10s requests needs 12-15 GPUs rather than 10 just to absorb noise. Utilization improves through demand pooling across tenants (provision for the peak of the sum, not the sum of peaks), supply pooling across regions, GPU types and clouds, fast container and model startup, and shifting latency-insensitive work to off-peak hours. GPU spend is expected to skew toward inference served from on-demand, serverless capacity, with long-term reservations no longer the default.
- Keeping 20,000 GPUs healthy
Modal mediumAdept
Modal keeps a multi-cloud fleet of over 20,000 concurrent GPUs reliable through instance-type benchmarking, continuously tested machine images, light boot checks, and passive plus active lifetime healthchecks. Anonymized cloud comparisons reveal large differences: PCIe H100s deliver about 40% fewer matmul FLOP/s than SXM, one provider ran H100s above 90°C and lost roughly half of peak performance, and one provider's L4s flake at CUDA init 0.1% of the time. Boot checks stay shallow (systemctl, nvidia-smi, a GPU read/write) to avoid slowing autoscaling. Passive monitoring uses dcgmi and dmesg Xid errors, weekly active checks run DCGM diag level 2, GPU burn and NCCL all-reduce, and unhealthy hosts are drained and replaced rather than repaired.
- Host overhead is killing your inference efficiency
Modal mediumAdept
GPU idle time while the CPU prepares work (host overhead) shows up as low GPU kernel utilization and directly multiplies inference cost; 50% overhead means GPU spend is 2x what it could be. Gaps in CUDA streams visible in PyTorch Profiler or Nsight Systems traces reveal it. Fixes include avoiding synchronous CPU-GPU transfers by constructing tensors where they are needed (e.g. decode-time position embeddings, unit-size KV page lengths), fusing kernels with the Torch compiler (cutting ~20 launches to 3, saving ~30µs and 20% mean latency), and using CUDA Graphs to amortize remaining launch costs, as SGLang and vLLM already do.