{
  "schema_version": "1.0",
  "id": "T-d52f0454fdf4",
  "url": "https://gpuatlas.top/articles/T-d52f0454fdf4/",
  "title": "同一个模型，短问题很快，长文档为什么特别慢？",
  "summary": "长文慢需拆应用解析检索与模型预填充生成，按真实材料和证据保留比较优化，不能直接归GPU弱。",
  "language": "zh-Hans",
  "category": {
    "id": "c-02",
    "name": "推理与上下文",
    "url": "https://gpuatlas.top/categories/c-02/"
  },
  "topics": [],
  "body_text": "同模型短题快、长文慢，先看应用真正做了多少工作。文档解析、OCR、切分和检索可能在模型前发生，不能全部记成GPU推理，界面短问题也可能附带长历史。\n\n保存实际送入的token与片段，分列预处理、排队、输入处理和生成。长输入增加预填充，生成也可能读更长状态，滑窗和前缀复用会改变增长，不能简单按文档长度推总时间倍数。\n\n固定问题、模板和输出，用同资料的短中长版本对照，预热与缓存命中条件一致。若仅应用解析慢，换更大显卡未必改善；模型输入占主导再检查实现、必要长度与实际后端。\n\n重复同文档可评估稳定前缀，独立材料不能假定都命中。资源方面记录输入与生成峰值，CPU混合、主存和搬运也需说明，不把短题驻留余量直接推长文范围。\n\n查找文档中的一项信息时，可尝试只送入检索到的相关片段；全文摘要或跨章比较则需要保留更广的证据。检查答案有没有漏掉原文前、中、后的关键事实，引用能否回到对应段落。保存原文版本和实际送入的内容，才能分清这次提速来自输入缩短，还是同一文档处理得更快。",
  "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": "transformers-kv-cache",
      "url": "https://raw.githubusercontent.com/huggingface/transformers/main/docs/source/en/kv_cache.md",
      "retrieved_at": "2026-11-25T10:07:29.175278+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-d52f0454fdf4/",
    "json": "https://gpuatlas.top/data/articles/T-d52f0454fdf4.json",
    "markdown": "https://gpuatlas.top/data/articles/T-d52f0454fdf4.md"
  }
}
