GPU Memory Snapshots: Supercharging sub-second startup
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.
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.
- How we achieved truly serverless GPUs
Modal mediumAdept
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.
- Augment Your LiveKit Agent with Modal GPUs
Modal mediumAdept
LiveKit agents can offload custom or open-weights models to Modal serverless GPUs, demonstrated with a BitHuman Expression video avatar voiced by Qwen3-TTS. The BitHuman container's /launch endpoint returns as soon as the avatar joins the room, which conflicts with Modal Servers scaling on in-flight requests. Modal's Sticky Sessions solve this by letting the agent open a session before calling /launch and close it when the call ends, holding the container slot for the session's duration. GPU snapshots hide cold starts that would otherwise require reloading gigabytes of model weights.
- 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.
- Run FLUX.1-dev three times faster
Modal mediumAdept
FLUX.1-dev image generation on Modal drops from ~6.75s to under three seconds per 1024x1024 image. About 1.5x comes from standard optimizations: torch.compile with max-autotune, fused QKV projections and channels-last memory layout. Another 2x comes from First Block Caching (via ParaAttention, based on TEACache), which skips denoising steps whose early-block residual change falls below a threshold. A threshold of 0.12 gave a good quality/speed tradeoff. The tens of minutes of compile time added to cold starts were cut roughly 30x by persisting Inductor, Triton and CUDA caches on a volume and using Modal memory snapshots.