Lexically constrained sentence generation allows the incorporation of prior knowledge such as lexical constraints into the output. This technique has been applied to machine translation, and dialog response generation. Previous work usually used Markov Chain Monte Carlo (MCMC) sampling to generate lexically constrained sentences, but they randomly determined the position to be edited and the action to be taken, resulting in many invalid refinements. To overcome this challenge, we used a classifier to instruct the MCMC-based models where and how to refine the candidate sentences. First, we developed two methods to create synthetic data on which the pre-trained model is fine-tuned to obtain a reliable classifier. Next, we proposed a two-step approach, "Predict and Revise", for constrained sentence generation. During the predict step, we leveraged the classifier to compute the learned prior for the candidate sentence. During the revise step, we resorted to MCMC sampling to revise the candidate sentence by conducting a sampled action at a sampled position drawn from the learned prior. We compared our proposed models with many strong baselines on two tasks, generating sentences with lexical constraints and text infilling. Experimental results have demonstrated that our proposed model performs much better than the previous work in terms of sentence fluency and diversity. Our code and pre-trained models are available at https://github.com/NLPCode/MCMCXLNet.
翻译:严格限制的刑期生成允许将先前的知识,如词汇限制等,纳入产出。这一技术已经应用于机器翻译和对话响应生成。先前的工作通常使用Markov 链链蒙特卡洛(MCMCC)取样来生成有限制的刑期,但是他们随机地决定了要编辑的位置和要采取的行动,导致许多无效的改进。为了克服这一挑战,我们使用一个分类器来指示以MCMCMC为基础的模型,在哪些地方和如何改进候选判决。首先,我们开发了两种方法来创建合成数据,根据这些方法,预先训练的模型将进行微调,以获得可靠的分类器。接下来,我们提出了一种两步方法,即“准备和修改”办法,以生成有限制的刑期。在预测步骤期间,我们利用了分类器来计算在候选判决之前所学到的位置。在修订过程中,我们利用了MCMC的取样方法来对候选判决进行抽样分析。我们提出的模型与许多强的基线进行了比较,在两项任务上生成了有法律限制和文字填充文。实验结果显示,我们在前的模型/ML模型中,我们现有的多样化比以前改进了我们现有的模型。