更新于 2026/05/21 21:52
llama.cpp b9274 修复 MTP 投机解码 VRAM 泄漏
llama.cpp 发布 b9274 版本,修复 server 在 sleep/resume 循环中因未释放投机解码器资源导致的 VRAM 泄漏。
问题根源在于 server_context_impl::destroy() 只清理了主模型和主上下文,却遗漏了 speculative decoder (spec)、draft 上下文 (ctx_dft) 和 draft 模型 (model_dft)。MTP 模型的 ctx_dft 持有 GPU KV cache 和计算缓冲区,每次 sleep 后旧资源未被释放,新资源持续分配,最终 OOM 崩溃。
修复方案是在 destroy() 中按正确顺序显式重置 spec、ctx_dft、model_dft,避免 use-after-free。该补丁由 llama.cpp 本地 pi 模型辅助生成。
速读
llama.cpp b9274 修复 MTP 投机解码的 VRAM 泄漏
相关源 (1)
- llama.cpp Releases · 2026/5/21 21:52:18https://github.com/ggml-org/llama.cpp/releases/tag/b9274