论文标题
语言模型的基于梯度的约束采样
Gradient-Based Constrained Sampling from Language Models
论文作者
论文摘要
大型审慎的语言模型会产生流利的文本,但众所周知,很难控制。在这项工作中,我们从此类语言模型中研究了受约束的采样:生成满足用户定义的约束的文本,同时保持流利度和模型在下游任务中的性能。我们提出粘液 - 将语言模型的对数可能性与单个能量函数的任意(可区分)约束相结合的采样过程,然后以非自动性收入方式生成样品。具体而言,它使用噪声来初始化整个输出序列,并使用能量函数的梯度遵循Langevin Dynamics定义的Markov链。我们通过软性和硬性约束评估文本生成的粘性,以及它们的组合对竞争性基准的抗毒性避免,情感控制和关键字引导的产生得到显着改善。
Large pretrained language models generate fluent text but are notoriously hard to controllably sample from. In this work, we study constrained sampling from such language models: generating text that satisfies user-defined constraints, while maintaining fluency and the model's performance in a downstream task. We propose MuCoLa -- a sampling procedure that combines the log-likelihood of the language model with arbitrary (differentiable) constraints in a single energy function, and then generates samples in a non-autoregressive manner. Specifically, it initializes the entire output sequence with noise and follows a Markov chain defined by Langevin Dynamics using the gradients of the energy function. We evaluate MuCoLa on text generation with soft and hard constraints as well as their combinations obtaining significant improvements over competitive baselines for toxicity avoidance, sentiment control, and keyword-guided generation.