Toward Unified Controllable Text Generation via Regular Expression Instruction

Xin Zheng, Hongyu Lin, Xianpei Han, Le Sun
9/19/2023
cs.CLcs.AI

No official code found. Best implementation: MrZhengXin/CTG-Regex-Instruction (5 stars, last commit 2023-11-22).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

Data and code of the paper Toward Unified Controllable Text Generation via Regular Expression Instruction

51Shell, PythonSep 8, 20232 years ago

Cite this paper

@article{zheng2023toward,
  title  = {Toward Unified Controllable Text Generation via Regular Expression Instruction},
  author = {Xin Zheng and Hongyu Lin and Xianpei Han and Le Sun},
  year   = {2023},
  eprint = {2309.10447},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2309.10447v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2309.10447.svg)](https://codeofpaper.com/paper/2309.10447)

Discussion