fix(ch2): 修正图 2-10 KV Cache 前缀复用机制图的语义与排版问题 - #1029
Merged
Merged
Conversation
Owner
|
谢谢 @xhhhz 的认真阅读和细致修复! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
读 2.3.2 节的时候发现图 2-10 有个问题,会让读者得出跟正文相反的结论,并且修了同一张图的几处排版。
1. 请求 3 把反面例子画成了正确做法
原图请求 3 是
System + Tools + "Time: 10:30:45",时间戳在末尾。按正文说的“缓存只能保留到首个不同 token 之前”,时间戳放最后,前面那 1200 token 的 System Prompt + Tools 其实是完整命中缓存的——而这是工程上推荐的写法:动态内容后置,把稳定前缀留给缓存。这张图想演示“系统提示词塞了动态内容 → 缓存失效”这个坑,画出来的却是这个坑的解法。
改成时间戳前置:
"Time: 10:30:45" + System Prompt + Tools。2. 一并要改的三处
→ 生成回答(输出),请求 3 却是→ 后缀重算 ✗(成本),同一列混了两种语义。三行统一成→ 生成回答,缓存状态挪进前缀框,和请求 2 的(缓存命中 ✓)对称,写成(缓存失效 ✗),框下补一句「变动点在最前 → 其后全部重算」。3. TTFT 加了个脚注
~0.5 秒和3-5 秒是绝对值,没说是什么模型、什么硬件、怎么部署的,而正文给的是“实测可达数倍”这种相对量级。加了一行“* TTFT 为示意值,随模型、硬件与部署方式而变,此处仅用于说明相对量级差异”。4. 排版
<marker>都缺markerUnits,默认按strokeWidth缩放,stroke-width="2"下箭头实际渲染成 24×16——跟 fix(fig1-5): 修复缺失箭头、marker 尺寸、RL 曲线穿框等五处问题 #943 修的是同一个问题。补上markerUnits="userSpaceOnUse",尺寸定为 10×7。另外ah这个 marker 全文没被引用过,一并删了。1200 tokens→1200 token,跟正文「2000 个 token」的写法一致。<title>/<desc>,参照 fix(fig1-5): 统一原生工具命名(web_search / code_interpreter),并把 #945 的闭环重排同步到 13 个语言版本 #947 的做法。验证
26 处文本逐个按字宽算过,没有溢出和重叠,最紧的一处单边还剩 14.8px。新增的字符只有
*,、,都是常用字,PDF 构建不会缺字。画布从 820×440 变成 820×443,宽高比基本没动,也在preamble.tex里0.38\textheight的封顶线(451px)以内,还剩 8px。tests/下搜过,没有引用这张图的文本锚点。两点没处理
译版没同步。13 个语言版本此前按各语种收过字号(es/vi 的 fig2-10 是 14px),需要的话我可以另开一个 PR 跟进。
另外图里 System Prompt + Tools 标的是 1200 token,性能对比却按 3000 token 总上下文算,差的 1800 token(对话历史)图上没体现,这个也暂时没改。