Controlled Text Generation for Large Language Model with Dynamic Attribute Graphs

Xun Liang,Hanyu Wang,Shichao Song,Mengting Hu,Xunzhi Wang,Zhiyu Li,Feiyu Xiong,Bo Tang
2024-05-24
Abstract:Controlled Text Generation (CTG) aims to produce texts that exhibit specific desired attributes. In this study, we introduce a pluggable CTG framework for Large Language Models (LLMs) named Dynamic Attribute Graphs-based controlled text generation (DATG). This framework utilizes an attribute scorer to evaluate the attributes of sentences generated by LLMs and constructs dynamic attribute graphs. DATG modulates the occurrence of key attribute words and key anti-attribute words, achieving effective attribute control without compromising the original capabilities of the model. We conduct experiments across four datasets in two tasks: toxicity mitigation and sentiment transformation, employing five LLMs as foundational models. Our findings highlight a remarkable enhancement in control accuracy, achieving a peak improvement of 19.29% over baseline methods in the most favorable task across four datasets. Additionally, we observe a significant decrease in perplexity, markedly improving text fluency.
Computation and Language
What problem does this paper attempt to address?
The paper attempts to address the problem of achieving precise control over the attributes of generated text in Controlled Text Generation (CTG) without sacrificing the generation quality and diversity of large language models (LLMs). Specifically, the researchers propose a pluggable framework called Dynamic Attribute Graphs (DATG) to guide the text towards the desired attribute direction by adjusting key vocabulary without significantly altering the overall content. The research focuses on two main tasks: 1. **Toxicity Mitigation Task**: Reducing toxic content in the generated text. 2. **Sentiment Transformation Task**: Changing the sentiment of the text from negative to positive, or vice versa. By conducting experiments on multiple datasets and comparing with various benchmark methods, the study demonstrates a significant improvement in control precision using the DATG method, particularly achieving a maximum improvement of 19.29% in the toxicity mitigation task, and significantly enhancing text fluency. Additionally, the research explores the performance differences of various strategies (such as Logits-Boost and Prefix-Prompt) in different tasks and their adaptability across different base models.