Skip to main content
QUICK REVIEW

[论文解读] Mirostat: A Neural Text Decoding Algorithm that Directly Controls Perplexity

Sourya Basu, Govardana Sachitanandam Ramachandran|arXiv (Cornell University)|Jul 29, 2020
Topic Modeling参考文献 34被引用 13
一句话总结

Mirostat 是一种基于反馈的神经文本解码算法,通过自适应调整 top-k 采样参数,直接控制生成文本的困惑度。该方法无需超参数调优即可维持目标困惑度水平,避免了重复(无聊陷阱)和不连贯(混乱陷阱),人类评估结果证实其在多种语言模型上均提升了文本的流畅性、连贯性和质量。

ABSTRACT

Neural text decoding is important for generating high-quality texts using language models. To generate high-quality text, popular decoding algorithms like top-k, top-p (nucleus), and temperature-based sampling truncate or distort the unreliable low probability tail of the language model. Though these methods generate high-quality text after parameter tuning, they are ad hoc. Not much is known about the control they provide over the statistics of the output, which is important since recent reports show text quality is highest for a specific range of likelihoods. Here, first we provide a theoretical analysis of perplexity in top-k, top-p, and temperature sampling, finding that cross-entropy behaves approximately linearly as a function of p in top-p sampling whereas it is a nonlinear function of k in top-k sampling, under Zipfian statistics. We use this analysis to design a feedback-based adaptive top-k text decoding algorithm called mirostat that generates text (of any length) with a predetermined value of perplexity, and thereby high-quality text without any tuning. Experiments show that for low values of k and p in top-k and top-p sampling, perplexity drops significantly with generated text length, which is also correlated with excessive repetitions in the text (the boredom trap). On the other hand, for large values of k and p, we find that perplexity increases with generated text length, which is correlated with incoherence in the text (confusion trap). Mirostat avoids both traps: experiments show that cross-entropy has a near-linear relation with repetition in generated text. This relation is almost independent of the sampling method but slightly dependent on the model used. Hence, for a given language model, control over perplexity also gives control over repetitions. Experiments with human raters for fluency, coherence, and quality further verify our findings.

研究动机与目标

  • 解决现有解码方法(如 top-k、top-p 和温度采样)中缺乏对困惑度直接控制的问题。
  • 通过实现目标困惑度水平的自动维持,消除对临时超参数调优的需求。
  • 缓解因固定或选择不当的采样参数所导致的“无聊陷阱”(过度重复)和“混乱陷阱”(不连贯)问题。
  • 建立困惑度与文本质量(包括重复率与连贯性)之间直接且经实证验证的关联。
  • 提供一种通用的解码算法,在不同文本长度和语言模型下均能保持一致的输出质量。

提出的方法

  • 提出 mirostat 采样,一种基于反馈的自适应 top-k 算法,通过动态调整 k 以维持目标困惑度。
  • 使用最近生成词的意外度(负对数概率)作为反馈信号,以更新截断阈值 μ。
  • 采用学习率 η,通过迭代方式校正观测到的交叉熵与目标交叉熵 τ 之间的误差。
  • 提出两种变体:mirostat(算法 1)使用基于词的意外度,mirostat 2(算法 2)使用对高意外度词的阈值截断。
  • 在齐夫分布统计下进行理论分析,以建模困惑度随 top-k 和 top-p 采样中 k 和 p 变化的演化规律。
  • 通过在 GPT-2 和 CTRL 等多种语言模型上进行人类评估,验证了其在流畅性、连贯性和整体质量方面的性能。

实验结果

研究问题

  • RQ1在齐夫词频分布下,top-k 和 top-p 采样中,随着 k 或 p 增加,困惑度如何演变?
  • RQ2生成文本中的重复程度在多大程度上与输出的交叉熵(对数困惑度)相关?
  • RQ3基于反馈的自适应采样方法是否能在无需手动调优的情况下维持目标困惑度水平?
  • RQ4通过 mirostat 控制困惑度是否能有效减少不同文本长度和语言模型下的重复与不连贯现象?
  • RQ5在人类对流畅性、连贯性和整体质量的评估中,mirostat 与基线采样方法相比表现如何?

主要发现

  • 在 top-k 和 top-p 采样中,困惑度随文本长度变化显著,取决于 k 或 p 的取值,可能导致重复或不连贯。
  • 交叉熵(对数困惑度)与重复率之间存在近似线性关系,证实低困惑度可减少重复。
  • mirostat 能够在长文本生成中成功维持目标困惑度,避免了无聊陷阱和混乱陷阱。
  • 人类评估者一致认为,mirostat 生成的文本在流畅性、连贯性和整体质量方面优于 top-k、top-p 或温度采样。
  • mirostat 2(算法 2)与 mirostat(算法 1)性能相当,而 mirostat average(算法 3)因平滑平均意外度导致反馈延迟,未能有效控制困惑度。
  • 该算法在不同语言模型(GPT-2、CTRL)上均表现出鲁棒性,无论模型特定词汇表或训练数据如何,性能均保持一致。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。