vllm 缓存对模型启动时间的影响
你的观察基本符合 vLLM 的实际启动流程。几个缓存影响的阶段不同所以影响启动时间差异很大。先区分一下缓存主要内容影响阶段对 vLLM 启动时间影响/tmp/torchinductor_root/PyTorch Inductor 编译缓存模型运行时图优化、kernel fusion通常较小~/.triton/cache/Triton kernel 编译缓存Triton 自定义 kernel 编译通常较小~/.cache/vllm/vLLM 自身缓存含部分编译产物vLLM backend 初始化中等flashinfer/FlashInfer kernel autotune / JIT 编译缓存attention、MoE、量化 kernel非常大为什么 FlashInfer 缓存影响最大你的模型unsloth/Qwen3.6-27B-NVFP4启动参数--moe-backend flashinfer_b12x这类模型启动时会大量依赖 FlashInfer。启动流程大概vLLM serve | |-- load model weights | |-- initialize attention backend | |-- initialize MoE backend | |-- FlashInfer kernel selection | |-- 查找已有 kernel cache | |-- 没有: 编译 CUDA kernel autotune 保存 cache | |-- engine ready第一次启动没有 flashinfer cache | v nvcc / nvrtc 编译大量 kernel | v 几十秒甚至几分钟第二次读取 ~/.cache/vllm/flashinfer | v 直接加载 | v 快速启动为什么 Triton cache 不明显因为现在 vLLM 的核心路径不一定大量依赖 Triton。例如以前vLLM | |-- Triton attention |-- Triton fused kernel现在很多情况vLLM | |-- FlashAttention | |-- FlashInfer | |-- CUTLASS | |-- CUDA kernel尤其 BlackwellRTX5090 SM120 NVFP4大量走FlashInfer CUTLASS Tensor Core kernel不是 Triton。所以~/.triton/cache可能只有少量 kernel。/tmp/torchinductor_root为什么影响小PyTorch Inductor主要影响torch.compilegraph captureoperator fusion例如torch.compile(model) | v Inductor | v 生成优化后的 kernel但是 vLLM 推理不是传统PyTorch eager torch.compile更多是CUDA Graph custom kernel FlashInfer所以 Inductor 贡献有限。你可以验证第一次启动rm -rf ~/.cache/vllm/flashinfer time vllm serve ...观察Compiling ... Generating kernels... Autotuning...第二次time vllm serve ...通常会明显减少。你的环境建议持久化你之前设置export HF_HOME/hyperai/input/input0/hub export VLLM_CACHE_ROOT/local_nvme/vllm_cache export FLASHINFER_CACHE_DIR/local_nvme/flashinfer_cache export TORCHINDUCTOR_CACHE_DIR/local_nvme/torch_cache export TRITON_CACHE_DIR/local_nvme/triton_cache其中最关键第一优先级FLASHINFER_CACHE_DIR一定要持久化。第二优先级VLLM_CACHE_ROOT保存 vLLM 相关编译结果。第三TRITON_CACHE_DIR TORCHINDUCTOR_CACHE_DIR保存也没坏处但收益明显低。对你的 RTX5090 NVFP4 环境还有一个特殊点Blackwell 的 NVFP4 kernel 比传统 FP16 kernel 更依赖CUTLASS FlashInfer architecture specific compilation例如sm_120 sm_121这些 kernel 不是通用二进制。所以同一个 cacheRTX5090(sm120)换到B200(sm100)通常不能复用。甚至RTX5090 A机器 RTX5090 B机器如果 CUDA / driver / flashinfer 版本不同也可能重新编译。所以你的实验结果可以总结为启动耗时主要 模型权重加载 FlashInfer kernel 编译/autotune 不是 PyTorch Inductor Triton cache对于你现在这个Qwen3.6-27B-NVFP4 RTX5090 vLLM FlashInfer MoE backend场景flashinfer cache是最值得持久化的。