通过后验推断实现语言模型的句法控制
Syntactic Control of Language Models by Posterior Inference
AI总结:
本文提出结合序贯蒙特卡洛后验采样与句法标注器,在 GPT2-large 和 Llama3-8B 上将目标成分结构 F1 提升至约 93 且保持流畅性。
摘要:
控制语言模型生成文本的句法结构,对于要求清晰性、风格一致性或可解释性的应用很有价值,但这仍是一项具有挑战性的任务。本文认为,基于后验推断的采样算法能够在生成过程中有效施加目标成分结构。我们的方法将 sequential Monte Carlo(序贯蒙特卡洛)与句法标注器相结合:前者通过从提议分布中采样来估计后验分布,后者则确保每个生成的 token 都与期望的句法结构对齐。我们使用 GPT2 和 Llama3-8B 模型进行的实验表明,在合适的提议分布下,可以提升句法准确率,将 F1 分数从 GPT2-large 的 12.31 和 Llama3-8B 的 35.33 均提高到约 93,同时不会损害语言模型的流畅性。这些结果凸显了句法控制的复杂性以及采样算法的有效性,为需要精确控制句法的应用提供了一种有前景的方法。
英文摘要:
Controlling the syntactic structure of text generated by language models is valuable for applications requiring clarity, stylistic consistency, or interpretability, yet it remains a challenging task. In this paper, we argue that sampling algorithms based on the posterior inference can effectively enforce a target constituency structure during generation. Our approach combines sequential Monte Carlo, which estimates the posterior distribution by sampling from a proposal distribution, with a syntactic tagger that ensures that each generated token aligns with the desired syntactic structure. Our experiments with GPT2 and Llama3-8B models show that with an appropriate proposal distribution, we can improve syntactic accuracy, increasing the F1 score from $12.31$ (GPT2-large) and $35.33$ (Llama3-8B) to about $93$ in both cases without compromising the language model's fluency. These results underscore both the complexity of syntactic control and the effectiveness of sampling algorithms, offering a promising approach for applications where precise control over syntax is essential.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。