知识卡片
空输入要显式定义评分结果
本章答案评分函数依赖非空提示和非空答案:空提示使开始索引为负,空答案可能对空张量求均值。实际接口应定义拒绝、缺失或特定评分语义,并处理非有限结果;不能让 NaN 静默参与候选排序。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
start = len(prompt_ids) - 1 #C end = full_ids.shape[0] - 1 #C #D t_idx = torch.arange(start, end, device=device) next_tokens = full_ids[start + 1 : end + 1] next_token_logps = logprobs[t_idx, next_tokens] #E return torch.mean(next_token_logps).item() #A Encode prompt and answer tokens separately to get the prompt length later #B Same as in calc_next_token_logprobas before #C Index range for positions corresponding to answer tokens #D Same as
参考来源
- 位置:《Build a Reasoning Model (From Scratch)》第05章《自我修正与推理时扩展》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-5.html)
- 结论依据:摘录中关于空输入要显式定义评分结果的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:start = len(prompt_ids) - 1 #C end = full_ids.shape[0] - 1 #C #D t_idx = torch.arange(start, end, device=device) next_tokens = full_ids[start + 1 : end + 1] next_token_logps = logprobs[t_idx, next_tokens] #E return torch.mean(next_token_logps).item() #A Encode prompt and answer tokens separately to get the prompt length later #B Same as in calc_next_token_logprobas before #C Index range for positions corresponding to answer tokens #D Same as