{
  "schema_version": "1.0",
  "id": "T-88c47eed7c76",
  "url": "https://gpuatlas.top/articles/T-88c47eed7c76/",
  "title": "16G 显存跑本地模型，怎么给长上下文留空间？",
  "summary": "16G长文先测实际驻留余量，Qwen3 8B高精度权重算例提示应同时考虑兼容量化与缓存。",
  "language": "zh-Hans",
  "category": {
    "id": "c-11",
    "name": "按显存找方案",
    "url": "https://gpuatlas.top/categories/c-11/"
  },
  "topics": [],
  "body_text": "16G显存读长文，先看权重加载后的实际预算。桌面、其他程序和框架预留都可能占空间，不能直接用16减去文件大小，得到所谓可用缓存。\n\n以Qwen3 8B为条件例子，实际约8.2B参数，16bit原始数据约16.4GB，即约15.27GiB，运行开销还没加入。高精度方案余量已经很紧，可以先评估兼容量化，而不是只修改上下文上限。\n\n配置36层、8个KV头、头维128。常规单序列16bit KV在8192 token约1.125GiB、32768约4.5GiB，分页与缓冲未计，不能推广到混合注意力等不同结构。\n\n输入、历史、模板、思考和答案共同计入长度。固定量化和单请求逐档增加材料，分别记录输入处理与生成峰值；比较缓存精度或其他策略时，每次只改一项，权重位宽不自动决定缓存位宽。\n\n可在一份长材料的前、中、后各选已知事实，要求Qwen3 8B回答并指出依据，检查是否漏用中段内容或截断答案。保存通过时的文件、缓存类型、实际token与完整等待。若显存仍有余量但事实利用不稳定，先整理材料或检索，比继续增加长度更能针对当前问题。",
  "published_at": null,
  "modified_at": "2026-11-26T15:17:38.690397+00:00",
  "evidence": {
    "type": "documentation_and_conditional_estimates",
    "hardware_tested": false,
    "note": "资料解释与条件估算，非硬件实测。"
  },
  "sources": [
    {
      "id": "qwen3-8b",
      "url": "https://huggingface.co/Qwen/Qwen3-8B/raw/main/README.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+00:00"
    },
    {
      "id": "qwen3-8b-config",
      "url": "https://huggingface.co/Qwen/Qwen3-8B/resolve/main/config.json",
      "retrieved_at": "2026-11-25T10:34:57.629275+00:00"
    },
    {
      "id": "vllm-memory",
      "url": "https://raw.githubusercontent.com/vllm-project/vllm/main/docs/configuration/conserving_memory.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+00:00"
    },
    {
      "id": "llamacpp-server",
      "url": "https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/server/README.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+00:00"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-88c47eed7c76/",
    "json": "https://gpuatlas.top/data/articles/T-88c47eed7c76.json",
    "markdown": "https://gpuatlas.top/data/articles/T-88c47eed7c76.md"
  }
}
