arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2309.10447cs.CLcs.AI
收藏

通过正则表达式指令实现统一可控文本生成

Toward Unified Controllable Text Generation via Regular Expression Instruction

University of Chinese Academy of Sciences(中国科学院大学);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所)

Xin Zheng, Hongyu Lin, Xianpei Han, Le Sun

AI总结:

本文提出正则表达式指令(REI),通过指令机制统一建模词汇、位置、长度等可控文本生成约束及其组合,仅需微调中等模型或对大模型少样本学习,实验显示其成功率高且优于多数基线。

摘要:

可控文本生成是自然语言生成的一个基本方面,针对不同的约束类型已经提出了众多方法。然而,这些方法通常需要大量的架构或解码修改,这使得它们难以应用于额外的约束或解决不同的约束组合。为了解决这一问题,本文提出了正则表达式指令(REI),它利用基于指令的机制,充分发挥正则表达式的优势,以统一的方式建模多样化的约束。具体来说,我们的REI通过正则表达式风格的指令,支持所有主流的细粒度可控生成约束,即词汇、位置和长度约束,以及它们的复杂组合。我们的方法只需要在中等规模语言模型上进行微调,或在大语言模型上进行少样本的上下文学习,并且在应用于各种约束组合时无需进一步调整。实验表明,我们这种直接的方法在保持自动评估指标竞争力的同时,取得了较高的成功率和良好的约束适应性,并且优于大多数先前的基线方法。

英文摘要:

Controllable text generation is a fundamental aspect of natural language generation, with numerous methods proposed for different constraint types. However, these approaches often require significant architectural or decoding modifications, making them challenging to apply to additional constraints or resolve different constraint combinations. To address this, our paper introduces Regular Expression Instruction (REI), which utilizes an instruction-based mechanism to fully exploit regular expressions' advantages to uniformly model diverse constraints. Specifically, our REI supports all popular fine-grained controllable generation constraints, i.e., lexical, positional, and length, as well as their complex combinations, via regular expression-style instructions. Our method only requires fine-tuning on medium-scale language models or few-shot, in-context learning on large language models, and requires no further adjustment when applied to various constraint combinations. Experiments demonstrate that our straightforward approach yields high success rates and adaptability to various constraints while maintaining competitiveness in automatic metrics and outperforming most previous baselines.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑