Many applications of text generation require incorporating different constraints to control the semantics or style of generated text. These constraints can be hard (e.g., ensuring certain keywords are included in the output) and soft (e.g., contextualizing the output with the left- or right-hand context). In this paper, we present Energy-based Constrained Decoding with Langevin Dynamics (COLD), a decoding framework which unifies constrained generation as specifying constraints through an energy function, then performing efficient differentiable reasoning over the constraints through gradient-based sampling. COLD decoding is a flexible framework that can be applied directly to off-the-shelf left-to-right language models without the need for any task-specific fine-tuning, as demonstrated through three challenging text generation applications: lexically-constrained generation, abductive reasoning, and counterfactual reasoning. Our experiments on these constrained generation tasks point to the effectiveness of our approach, both in terms of automatic and human evaluation.
翻译:生成文本的许多应用都要求包含不同的限制,以控制生成文本的语义或风格。这些限制可能是困难的(例如,确保某些关键词包含在输出中)和软的(例如,将产出背景与左手或右手背景相联系)。在本文中,我们介绍了基于能源的束缚与Langevin Directives(COLD)的解码框架,这是一个解码框架,它通过一种能源功能将有限的生成统一起来,从而通过基于梯度的取样对制约进行高效的、不同的推理。 COLD解码是一个灵活的框架,可以直接适用于现成的左手对右语言模型,而不需要任何特定任务的微调,这通过三种具有挑战性的文本生成应用即具有法律约束的生成、绑架性推理和反事实推理来证明。我们在这些受限制的生成任务上的实验表明,无论是在自动还是人性评估方面,我们的方法都是有效的。