Skip to content
vLLM 推理显存不足

vLLM KV 缓存不足 (No available memory for the cache blocks)

模型权重与 CUDA Graph 加载完成后,剩余空闲显存不足以分配指定最大长度 `max_model_len` 所需的 KV 缓存块。

典型日志特征

ValueError: No available memory for the cache blocks. Try increasing gpu_memory_utilization when initializing the engine.

根本原因与次生级联症状辨析

部署设定的上下文上限超出剩余 HBM、单卡并行数不足,或当前显卡正被遗留服务占用了一部分内存。

重启节点前先收集的取证命令

nvidia-smi --query-gpu=index,memory.used,memory.free,memory.total --format=csv
python3 -m vllm.entrypoints.openai.api_server --model <MODEL> --tensor-parallel-size 4 --gpu-memory-utilization 0.92 --max-model-len 16384 --kv-cache-dtype fp8

安全排查与恢复步骤

  1. 首先运行 `nvidia-smi` 排查是否有残留或并发占卡进程。
  2. 使用 `/zh/vram-calculator` 核对当前模型权重加上下文的真实显存占用。
  3. 适当提高 `--tensor-parallel-size`、缩短 `--max-model-len`、开启 `--kv-cache-dtype fp8` 或调高 `--gpu-memory-utilization` 至 0.92。
Live diagnosis, no signup

粘贴你的 GPU 日志,立即排查首发故障

提交前会在当前浏览器本地自动遮罩 IP、密钥和私有路径,安全分离根因。

Before uploading, review cloud data handling and local options.

training_logs.txt
No log to hand? Try one:

Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.

3 free cloud diagnoses per day

常见问题

权重只有显卡一半容量为什么还会报 KV 缓存空间不足?

除了权重外,vLLM 还要预留 CUDA Graph 图空间、激活缓冲区以及至少容纳一条完整最大长度请求的 KV 块。

开启 `--enforce-eager` 为什么有时能启动成功?

因为禁用了 CUDA Graph 预占显存,适合排查显存边界,但生产并发吞吐可能有所下降。

相关简体中文 GPU 排障条目

英文完整百科档案:查看完整英文参考 (English)

免费试用 Denpex 30 天。完全免费。

无需信用卡,无自动续费。使用团队已复盘的故障日志亲自验证诊断效果。

开启 30 天免费 Team 团队评估

30 天内每日最多 50 次诊断。验证企业工作邮箱即可激活试用,回放已解决的历史故障并将根因证据与团队确认结论对比。

请使用公司域名邮箱,例如 alex@yourcompany.com。

适用条件说明

通过邮箱与企业域名校验即可激活 30 天 Team 评估(每日最多 50 次诊断)。若域名未能自动通过,可联系 support@denpex.com 人工审核。编辑器扩展的纯本地离线诊断无需任何账号。

正在使用个人邮箱(Gmail、QQ、163、Outlook)或个人主机?创建 $0 免费账号(无需工作邮箱) 以保存 7 天诊断记录并解锁 AI 推理,或发送集群故障日志预约演示。