Skip to main content
QUICK REVIEW

[论文解读] Plug and Play Language Models: A Simple Approach to Controlled Text Generation

Sumanth Dathathri, Andrea Madotto|arXiv (Cornell University)|Dec 4, 2019
Speech and dialogue systems被引用 407
一句话总结

PPLM 将一个预训练语言模型与轻量级属性模型相结合,在不重新训练的情况下引导生成,利用在潜在空间的梯度更新来控制主题和情感,同时保持流畅性。

ABSTRACT

Large transformer-based language models (LMs) trained on huge text corpora have shown unparalleled generation capabilities. However, controlling attributes of the generated language (e.g. switching topic or sentiment) is difficult without modifying the model architecture or fine-tuning on attribute-specific data and entailing the significant cost of retraining. We propose a simple alternative: the Plug and Play Language Model (PPLM) for controllable language generation, which combines a pretrained LM with one or more simple attribute classifiers that guide text generation without any further training of the LM. In the canonical scenario we present, the attribute models are simple classifiers consisting of a user-specified bag of words or a single learned layer with 100,000 times fewer parameters than the LM. Sampling entails a forward and backward pass in which gradients from the attribute model push the LM's hidden activations and thus guide the generation. Model samples demonstrate control over a range of topics and sentiment styles, and extensive automated and human annotated evaluations show attribute alignment and fluency. PPLMs are flexible in that any combination of differentiable attribute models may be used to steer text generation, which will allow for diverse and creative applications beyond the examples given in this paper.

研究动机与目标

  • 阐明在不重新训练大型语言模型的情况下实现可控文本生成的必要性。
  • 提出一个灵活的框架,在推理阶段将基础语言模型与简单的属性模型结合起来。
  • 演示主题和情感的控制,并评估属性对齐与流畅性。
  • 将 PPLM 与现有基线进行比较,并展示其在去毒化和受限叙事方面的潜力。

提出的方法

  • 在不修改参数的情况下使用一个预训练的基于变换器的语言模型 p(x)(例如 GPT-2 345M)。
  • 附加一个或多个可微分的属性模型 p(a|x)(例如词袋模型或一个单层判别器)。
  • 在语言模型潜在空间 Ht 进行基于梯度的更新,以最大化 log p(a|x),同时通过 KL 散度和后归一化融合约束保持 log p(x)。
  • 更新潜在表示 ΔHt,并从更新后的分布重新采样以生成标记,具有可控强度调节。
  • 结合多个属性模型,并对原始 LM 分布进行事后融合以保持流畅性。
  • 使用自动化指标(困惑度、Dist-1/2/3)和对流畅性及属性相关性的人工评估进行评估。

实验结果

研究问题

  • RQ1PPLM 是否能够在不重新训练 LM 的情况下将文本生成引导至预定属性(主题或情感)?
  • RQ2潜在空间操作与输出分布加权在属性控制方面的比较如何?
  • RQ3将 KL 正则化与后归一融合结合起来在强化属性对齐的同时是否能保持流畅性?
  • RQ4PPLM 在不同属性模型(BoW、判别器)和领域中是否有效?

主要发现

  • PPLM 在主题和情感上实现了属性控制,同时保持与基线 LM 相当的流畅性。
  • 潜在空间操作(BC/BCR)在主题控制方面显著高于仅使用重排序或加权方法。
  • PPLM-Discrim 结合潜在更新以及排序(BCR)在情感控制方面取得强大表现,流畅性具有竞争力,优于若干基线。
  • 与 CTRL 及为积极性微调的 GPT-2 相比,PPLM 常常达到或超过作者对属性相关性与流畅性的判断。
  • PPLM 可通过跟随毒性检测器的梯度实现去毒化,并支持结构化故事创作。
  • 已发布实验代码,展示出实际可访问性和可重复性。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

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