{
  "schema_version": "1.0",
  "id": "T-d1015e678b2b",
  "url": "https://gpuatlas.top/articles/T-d1015e678b2b/",
  "title": "llama.cpp 模型加载快，但首个回答慢，怎么测原因？",
  "summary": "llama.cpp首答慢应拆开加载、首次执行、提示处理和客户端显示，缓存命中结果不能代表所有新请求。",
  "language": "zh-Hans",
  "category": {
    "id": "c-09",
    "name": "框架配置与故障",
    "url": "https://gpuatlas.top/categories/c-09/"
  },
  "topics": [
    {
      "id": "framework-5c58ce0020",
      "name": "llama.cpp",
      "kind": "framework",
      "description": "用 GGUF 在本机运行模型时，GPU layers 和 CPU 卸载怎么分配？先平衡显存占用与生成速度。",
      "url": "https://gpuatlas.top/topics/framework-5c58ce0020/"
    }
  ],
  "body_text": "llama.cpp模型加载快，首个回答仍慢，先把启动到可服务、请求到首字、后续生成分开。加载只说明权重准备阶段较快，首次执行还可能初始化状态或处理完整提示。\n\n固定短问题，在模型刚加载后与重复请求分别记录，再换长输入。只有第一次慢时先看预热和首次执行；长材料每次都慢时，看提示处理与实际token，不能把两种成本混成同一原因。\n\n检查服务收到的模板、系统说明和历史。界面只显示一句话，实际请求可能很长，先保存真实输入再分析硬件。重复前缀也可能命中缓存，需要注明匹配与保留条件，命中后的时间不能代表全新请求。\n\n客户端等待还需对齐服务端时间。服务端已有token、前端未显示时，检查网络、代理缓冲和流式解析；不能仅凭页面没字证明模型尚未生成。\n\n定位后，用未重复的日常问题和最长材料复查，分列冷启动、暖运行、首字与完整时间，CPU参与时另记主存。一次性的初始化慢，应与每次都慢的输入处理分开；服务端已出字而页面仍空白，则回到代理和流式显示。按这条路径调整，才不会为前端缓冲去换硬盘。",
  "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": "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"
    },
    {
      "id": "llamacpp-multigpu",
      "url": "https://raw.githubusercontent.com/ggml-org/llama.cpp/master/docs/multi-gpu.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+00:00"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-d1015e678b2b/",
    "json": "https://gpuatlas.top/data/articles/T-d1015e678b2b.json",
    "markdown": "https://gpuatlas.top/data/articles/T-d1015e678b2b.md"
  }
}
