知识卡片
跨请求缓存必须匹配前缀
重复指令或手册放在稳定前缀,可为跨请求复用提供机会。但缓存有效性还依赖模型、token序列、位置及运行配置;文本语义相同不等于缓存相同,改变前部内容可能影响后续整段状态。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 推理优化
原书出处 · 1 处
- · 查看原书依据
Organize your prompt to place the cacheable components at the beginning of the prompt, i.e., the prompt prefix. Ultimately, caching can be very valuable in reducing inference time, especially in settings where instructions are repeated for a large number of calls, or the context window contains data like API documentation or RAG output that needs to persist across multiple calls. Next, we’ll explore the early
参考来源
- 位置:《Designing Large Language Model Applications》第09章《推理优化》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Designing Large Language Model Applications/_epub-src/OEBPS/ch09.html)
- 结论依据:摘录中关于跨请求缓存必须匹配前缀的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Organize your prompt to place the cacheable components at the beginning of the prompt, i.e., the prompt prefix. Ultimately, caching can be very valuable in reducing inference time, especially in settings where instructions are repeated for a large number of calls, or the context window contains data like API documentation or RAG output that needs to persist across multiple calls. Next, we’ll explore the early