知识卡片
目标词元用错位聚集提取
对 [T,V] log_softmax,用位置 0…T-2 的分数聚集 token IDs 1…T-1,再从 prompt_len-1 起保留回答对应项。gather 简化索引构造,但不能省掉错位与提示边界;还应检查实际采样是否包含结束标记。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
torch.gather to directly select the logprob corresponding to the generated tokens. Listing 6.11 shows a more compact, optimized version of the same computation that produces identical results while being easier to read and faster to execute.
参考来源
- 位置:《Build a Reasoning Model (From Scratch)》第06章《强化学习训练推理模型》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-6.html)
- 结论依据:摘录中关于目标词元用错位聚集提取的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:torch.gather to directly select the logprob corresponding to the generated tokens. Listing 6.11 shows a more compact, optimized version of the same computation that produces identical results while being easier to read and faster to execute.