GRACE : Gradient-guided Controllable Retrieval for Augmenting Attribute-based Text Generation (2023)

Abstract: Attribute-based generation methods are of growing significance in controlling the generation of large pre-trained language models (PLMs). Existing studies control the generation by (1) finetuning the model with attributes or (2) guiding the inference processing toward control signals while freezing the PLM. However, finetuning approaches infuse domain bias into generation, making it hard to generate out-of-domain texts. Besides, many methods guide the inference in its word-by-word generation, pushing the word probability to the target attributes, resulting in less fluent sentences. We argue that distilling controlling information from natural texts can produce fluent sentences while maintaining high controllability. In this paper, we propose GRA dient-guided C ontrollable r E trieval (GRACE), a retrieval-augmented generation framework to facilitate the generation of fluent sentences with high attribute relevance. GRACE memorizes the semantic and attribute information from unlabeled corpora and applies a controllable retrieval to obtain desired information. For the generation, we design techniques to eliminate the domain bias from the retrieval results and integrate it into the generation model. Additionally, we propose a gradient-guided generation scheme that iteratively steers generation toward higher attribute relevance. Experimental results and quantities of examples verify the effectiveness of our method.

## introduction controlling the text generation model toward a specific direction remains an active research area, covering many tasks, including storytelling, text debiasing, and attribute-based generation @xcite @xcite . attribute-based text generation requires generating text that satisfies the given attribute, which is a control code for a specific topic, sentiment, or attribute discriminator ## method our framework consists of three parts (see fig. 2 ): the above modules collaborate to conduct attribute-based generation. we design a gradientguided retrieval-generation framework that steers generation toward the target attribute at each step and polishes the retrieved text guided by the gradient, where the gradient respects the target attribute (mentioned in sec 3.4). ## conclusion we propose grace, an attribute-based generation framework that controls the generation through controllable retrieval. we train a discriminator to distinguish attributes and build a retrieval repository with unlabeled corpora. we design strategies to remove the domain bias from the retrieval information. moreover, we propose a gradient-guided generation scheme that iteratively updates the retrieval toward higher attribute relevance. experimental results on two attribute-based generation tasks show that grace outperforms strong baselines in generation quality and attribute relevance. given the current subsequence x i and the target attribute c, p (c|x i ) is determined by the discriminator. therefore, we obtain: