用模板化方法解决大模型冷启动时的CUDA图加载慢问题。
Foundry: Template-Based CUDA Graph Context Materialization for Fast LLM Serving Cold Start
- 通过离线提取模板,实现运行时快速重建带上下文的CUDA图。
- 将Qwen3-235B模型冷启动时间从10分钟缩短至3.9秒。
- 支持多卡部署且无需重新捕获,适合动态扩缩容的LLM服务场景。
现代大模型服务依赖自动伸缩和并行配置调整应对波动负载,但冷启动延迟仍是主要瓶颈。尽管模型权重加载已缩短至秒级,CUDA图捕获仍需数十秒至数分钟,常成为启动主因。由于CUDA图与执行上下文(如设备地址、懒加载内核代码)强耦合,无法直接序列化。现有方法或依赖脆弱的内核特异性修补,或采用重型进程级快照恢复,难以适应动态并行切换。本文提出Foundry,一种基于模板的CUDA图上下文生成系统:在离线阶段持久化图拓扑与执行上下文,线上重建时开销极低。Foundry强制确定性内存布局,自动提取并重载捕获图所需内核二进制,通过拓扑模板降低重建成本。对于分布式服务,仅需单卡离线捕获即可生成多卡部署模板,仅需修补与秩相关的通信状态。在高达235B参数的密集模型与MoE模型上,冷启动延迟最高降低99%,将Qwen3-235B-A22B的初始化时间从10分钟降至3.9秒,同时保持CUDA图带来的吞吐优势。
原文摘要 · Abstract (English)
Modern LLM service providers increasingly rely on autoscaling and parallelism reconfiguration to respond to rapidly changing workloads, but cold-start latency remains a major bottleneck. While recent systems have reduced model weight loading to seconds, CUDA graph capture still takes tens of seconds to minutes and often dominates startup. Unfortunately, CUDA graphs cannot be naively serialized: beyond graph topology, they are tightly coupled to execution context, including device addresses embedded in kernel arguments and kernel code lazily loaded during warmup. Existing approaches either rely on brittle kernel-specific patching or heavyweight process-level checkpoint/restore that are inflexible to dynamic parallelism switching. We present Foundry, a template-based CUDA graph context materialization system that persists both graph topology and execution context during an offline processing stage, and reconstructs executable graphs online with negligible overhead. Foundry enforces deterministic memory layouts, automatically extracts and reloads kernel binaries required by captured graphs, and reduces online reconstruction costs through topology-based templating. For distributed serving, Foundry further enables a single-GPU offline capture to generate templates for multi-GPU deployments by patching only rank-dependent communication state. Across dense and MoE models up to 235B parameters, Foundry reduces cold-start latency by up to 99%, cutting the initialization time of Qwen3-235B-A22B from 10 minutes to 3.9 seconds while preserving the throughput gains of CUDA graphs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。