跳到主要内容Skip to main content

GPU 层卸载-ngl / Offload

-ngl / Offload

  • 硬件与部署Hardware & deployment
  • 第五站 · 跑起来Station 5 · Running It
解决什么问题What problem it solves

把模型一部分交给 GPU、一部分留在 CPU,显存不够时的妥协手段。Give part of the model to the GPU and keep the rest on the CPU — the compromise when VRAM falls short.

这是什么What it is

按层分配计算位置:显存够的部分放 GPU,剩下的放 CPU 由内存承担。

llama.cpp 里通常用 `-ngl` 参数控制。

Assigning layers across devices: whatever fits in VRAM goes to the GPU, the rest runs on the CPU backed by system memory.

In llama.cpp this is usually controlled with the `-ngl` flag.

为什么需要知道Why it matters

它让「显存差一点」的模型也能跑起来,代价是速度下降明显。这是权衡,不是免费午餐。It lets models that "almost" fit run at all, at a clear cost in speed. A trade-off, not a free lunch.

出处Sources
  • 按显存倒推选档位(千问 3.8)Choosing by VRAM, backwards (Qwen3.8) ↗