知识卡片
贪心只优化当前词元选择
贪心每步选当前概率最高token,再在新前缀下继续。它不保证整段序列概率最大,也不保证事实正确;重复风险是可能失效形态,不代表所有长文本或所有确定性任务都不能使用贪心。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 按任务适配模型
原书出处 · 1 处
- · 查看原书依据
Greedy Decoding The simplest form of decoding is to just generate the token that has the highest probability. The drawback of this approach is that it causes repetitiveness in the output. Here is an example: input = tokenizer('The keyboard suddenly came to life. It ventured up the', return_tensors='pt').to(torch_device) output = model.generate(**inputs, max_new_tokens=50) print(tokenizer.decode(output[0], skip_special_tokens=True)) You can see that the output starts getting repetitive. Therefore, greedy
参考来源
- 位置:《Designing Large Language Model Applications》第05章《按任务适配模型》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Designing Large Language Model Applications/_epub-src/OEBPS/ch05.html)
- 结论依据:摘录中关于贪心只优化当前词元选择的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Greedy Decoding The simplest form of decoding is to just generate the token that has the highest probability. The drawback of this approach is that it causes repetitiveness in the output. Here is an example: input = tokenizer('The keyboard suddenly came to life. It ventured up the', return_tensors='pt').to(torch_device) output = model.generate(**inputs, max_new_tokens=50) print(tokenizer.decode(output[0], skip_special_tokens=True)) You can see that the output starts getting repetitive. Therefore, greedy