Learning to Transfer Prompts for Text Generation (2022)

Abstract: Pretrained language models (PLMs) have made remarkable progress in text generation tasks via fine-tuning. While, it is challenging to fine-tune PLMs in a data-scarce situation. Therefore, it is non-trivial to develop a general and lightweight model that can adapt to various text generation tasks based on PLMs. To fulfill this purpose, the recent prompt-based learning offers a potential solution. In this paper, we improve this technique and propose a novel prompt-based method (PTG) for text generation in a transferable setting. First, PTG learns a set of source prompts for various source generation tasks and then transfers these prompts as target prompts to perform target generation tasks. To consider both task- and instance-level information, we design an adaptive attention mechanism to derive the target prompts. For each data instance, PTG learns a specific target prompt by attending to highly relevant source prompts. In extensive experiments, PTG yields competitive or better results than fine-tuning methods. We release our source prompts as an open resource, where users can add or reuse them to improve new text generation tasks for future research. Code and data can be available at https://github.com/RUCAIBox/Transfer-Prompts-for-Text-Generation .

## introduction in natural language processing (nlp), text generation is an important research topic that aims to automatically produce understandable text in human language from input data @xcite . in recent decades, various approaches have been widely applied to a variety of text generation tasks @xcite @xcite , especially the emergence of pretrained language models (plms) @xcite . by involving large-scale parameters pretrained on massive general corpora, * corresponding author plms such as @xcite have achieved substantial progress in text generation. through the fine-tuning paradigm, plms can adapt to various text generation tasks by directly adjusting the model parameters with labelled datasets. however, in real-world scenarios, we are inevitably confronted with tasks having only limited labelled data (e.g., new domains). it is often difficult to fine-tune text generation models in a datascarce situation @xcite . although the input and output formats are different for various text generation tasks, these tasks essentially adopt similar learning and generation mechanism (e.g., seq2seq @xcite ). furthermore, the success of plms sheds light on the possibility of developing general or transferable text generation models. for example, @xcite framed generation tasks as language modeling by predicting the next token given previous tokens. based on these studies, we aim to devise a general and lightweight text generation approach that can effectively adapt to various new tasks and datasets, based on plms. to fulfill this purpose, the recently proposed prompt-based learning offers a potential technical solution @xcite . in this paradigm, a text generation task can be solved with the help of a prompt containing task-specific information. for example, t5 @xcite framed summarization and question answering into a text-to-text format by utilizing prompts "summarize:" and "answer the question:". based on learned or manually designed prompts, plms can be leveraged to perform existing or new generation tasks without being tuned @xcite , which provides a unified approach to utilizing plms for various generation tasks. furthermore, to quickly adapt plms to new nlu tasks, several works directly used a soft prompt learned from source nlu tasks to initialize the prompt for a target nlu task @xcite . inspired by these studies, we aim to apply promptbased methods to data-scarce text generation tasks in a transferable setting. despite promising, there are still two major challenges for transferring prompts in text generation. firstly, it has been found that prompts are highly task-specific @xcite , and it is difficult to effectively transfer or reuse existing prompts for new tasks. second, for a single task, even a welllearned prompt may not be suitable for all the data instances from a large population (scao and rush, 2021), and hence it is non-trivial to design effective transferring strategy considering both task-and instance-level characteristics. to address the above issues, we propose ptg: prompt transfer for text generation, a novel prompt-based transfer learning approach for text generation. ptg is built upon a transfer learning setting. specifically, we learn source prompts from a number of representative source generation tasks and then transfer these prompts as target prompts to perform target generation tasks. the core idea is that these learned source prompts serve as representation bases (i.e., value vectors in self-attention mechanism). for each data instance from a new task, we learn a specific target prompt by attending to highly relevant source prompts. to support such an approach, we construct a multi-key memory network storing both source prompts and prompt clusters for key-value prompt finding, and then design an adaptive attention mechanism considering both task-and instance-level information to derive the target prompt. instead of using a fixed prompt for a new task, our approach is able to effectively learn the most suitable prompt representation from source prompts for a specific data instance. such an adaptive mechanism considers the specific instancelevel features, making our approach more flexible to transfer to new text generation tasks. to the best of our knowledge, we are the first to introduce the idea of prompting in transfer learning to address text generation tasks. for evaluation, we test ptg on 14 datasets from three sets of text generation tasks: i) compression to express salient information in concise text such as summarization; ii) transduction to transform text while preserving content precisely such as style transfer; and iii) creation to produce new content from input context such as story generation. in both fully-supervised and few-shot experiments, ptg yields competitive or better results than fine-tuning plms. besides performance benefits, more importantly, we release our source prompts to serve as an opensource prompt library. researchers can train new task prompts added to our library and reuse these learned prompts to improve unseen text generation tasks. our library can further act as an analysis tool, such as analyzing what factors influence prompts' transferability across generation tasks and interpreting the task similarity by measuring the corresponding prompt similarity. ## approach our proposed method, prompt transfer for text generation (ptg), is depicted in figure 1 . our approach first learns a number of source prompts for various representative source generation tasks, and then derive the prompt for the target generation task with a novel adaptive attention mechanism. next we will describe each part in detail. ## experiments in this section, we first set up the experiments, and then report the results and analysis. ## conclusion this paper presented a prompt-based transfer learning approach for text generation. we learn a set of prompts from a number of representative source generation tasks and then transfer these prompts as target prompts to perform the target generation tasks. in our model, we design an adaptive attention mechanism considering both task-and instancelevel information to construct the target prompts. experiments in fully-supervised and few-shot settings demonstrate the effectiveness of our promptbased transfer learning model. in future work, we will consider incorporating more kinds of text generation tasks.