知识卡片
采样分布与评分分布要区分
本章 rollout 经温度及 top-p 生成,训练 logprob 却来自未变换的模型分布。它们并非相同策略分布,严格策略梯度解释需要说明这种差异及是否校正;不能未经推导就称任意采样配置下都是无偏目标。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
probas = top_p_filter(probas, top_p) #C next_token = torch.multinomial( probas.cpu(), num_samples=1 ).to(device) if ( tokenizer.eos_token_id is not None and next_token.item() == tokenizer.eos_token_id ): break generated.append(next_token.item()) logits = model(next_token, cache=cache)[:, -1] full_token_ids = torch.cat( [input_ids, torch.tensor(generated, device=device, dtype=input_ids.dtype),] ) return full_token_ids, input_ids.numel(), tokenizer.decode(generated)
参考来源
- 位置:《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)
- 结论依据:摘录中关于采样分布与评分分布要区分的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:probas = top_p_filter(probas, top_p) #C next_token = torch.multinomial( probas.cpu(), num_samples=1 ).to(device) if ( tokenizer.eos_token_id is not None and next_token.item() == tokenizer.eos_token_id ): break generated.append(next_token.item()) logits = model(next_token, cache=cache)[:, -1] full_token_ids = torch.cat( [input_ids, torch.tensor(generated, device=device, dtype=input_ids.dtype),] ) return full_token_ids, input_ids.numel(), tokenizer.decode(generated)