贪心解码与束搜索Greedy Decoding and Beam Search
Greedy Decoding and Beam Search
每步都选最可能词的解码方式,以及它为什么反而写出空洞重复的文本。Decoding that always picks the most likely token — and why it instead produces hollow, repetitive text.
贪心解码每步取概率最高的 token。束搜索同时保留几条最优路径。
Holtzman 等人指出这类解码的问题。
以最大化为主的解码会产出平淡、空洞、陷入重复循环的文本。
对策之一是 nucleus sampling(top-p)。每步从累计概率首次达到 p 的最小候选集里采样。
Greedy decoding takes the highest-probability token at each step; beam search keeps several best paths in parallel.
Holtzman et al. identified the problem with this class of decoding.
Maximization-based decoding yields text that is bland, incoherent, or stuck in repetitive loops.
One countermeasure is nucleus sampling (top-p): sample from the smallest candidate set whose cumulative probability first reaches p.
「选最可能的词」听起来最稳,实测却最容易写得干瘪复读。这解释了为什么聊天模型默认带随机性。'Pick the most likely word' sounds safest but in practice writes the dullest, most repetitive prose. This is why chat models ship with randomness by default.
回到名词地图看第4站的其他 35 个词 →Back to the map: the other 35 terms in station 4 →
- Holtzman 等《The Curious Case of Neural Text Degeneration》(ICLR 2020)Holtzman et al., The Curious Case of Neural Text Degeneration (ICLR 2020) ↗