知识卡片
键值缓存复用既有前缀计算
自回归解码可保存各层已处理token的K/V,下步只计算新增位置并关注缓存。缓存避免重复投影和历史位置计算,却不消除新增查询对历史键值的读取与注意力;长上下文仍可能受内存和带宽限制。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 推理优化
原书出处 · 1 处
- · 查看原书依据
K-V Caching As seen in Chapter 1, LLMs do not have session memory; at every turn in an LLM conversation, the previous conversation history is added to the input. This means that every request to an LLM could potentially contain a lot of repetitive content in the prompt. For the repetitive parts of the prompt, the same computation is performed during the inference step again
参考来源
- 位置:《Designing Large Language Model Applications》第09章《推理优化》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Designing Large Language Model Applications/_epub-src/OEBPS/ch09.html)
- 结论依据:摘录中关于键值缓存复用既有前缀计算的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:K-V Caching As seen in Chapter 1, LLMs do not have session memory; at every turn in an LLM conversation, the previous conversation history is added to the input. This means that every request to an LLM could potentially contain a lot of repetitive content in the prompt. For the repetitive parts of the prompt, the same computation is performed during the inference step again