Prompt-and-Rerank: A Method for Zero-Shot and Few-Shot Arbitrary Textual Style Transfer with Small Language Models

31399

Authors

nan

Abstract

AbstractWe propose a method for arbitrary textual style transfer (TST)—the task of transforming a text into any given style—utilizing general-purpose pre-trained language models. Our method, Prompt-and-Rerank, is based on a mathematical formulation of the TST task, decomposing it into three constituent components: textual similarity, target style strength, and fluency. Our method uses zero-shot or few-shot prompting to obtain a set of candidate generations in the target style, and then re-ranks them according to the three components. Our method enables small pre-trained language models to perform on par with state-of-the-art large-scale models while using two orders of magnitude less compute and memory. We also investigate the effect of model size and prompt design (e.g., prompt paraphrasing and delimiter-pair choice) on style transfer quality across seven diverse textual style transfer datasets, finding, among other things, that delimiter-pair choice has a large impact on performance, and that models have biases on the direction of style transfer.

Keywords

nan

Full Content

Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 2195 - 2222 December 7-11, 2022 ©2022 Association for Computational Linguistics Prompt-and-Rerank: A Method for Zero-Shot and Few-Shot Arbitrary Textual Style Transfer with Small Language Models Mirac Suzgun* Stanford University msuzgun@cs.stanford.edu Luke Melas-Kyriazi* Oxford University lukemk@robots.ox.ac.uk Dan Jurafsky Stanford University jurafsky@cs.stanford.edu Abstract We propose a method for arbitrary textual style transfer (TST)—the task of transforming a text into any given style—utilizing general-purpose pre-trained language models. Our method, Prompt-and-Rerank, is based on a mathemati- cal formulation of the TST task, decomposing it into three constituent components: textual sim- ilarity, target style strength, and fluency. Our method uses zero-shot or few-shot prompting to obtain a set of candidate generations in the target style, and then re-ranks them according to the three components. Our method enables small pre-trained language models to perform on par with state-of-the-art large-scale mod- els while using two orders of magnitude less compute and memory. We also investigate the effect of model size and prompt design (e.g., prompt paraphrasing and delimiter-pair choice) on style transfer quality across seven diverse textual style transfer datasets, finding, among other things, that delimiter-pair choice has a large impact on performance, and that models have biases on the direction of style transfer.1 1 Introduction Textual style transfer (TST) refers to the task of transferring one stylistic aspect of a piece of text (e.g., sentiment polarity, formality, politeness, etc.) without changing its main semantic content, struc- ture, or other attributes. Traditionally, the natu- ral language generation (NLG) community has ap- proached each instantiation of style transfer as a distinct task, designing and training specialized models on style-specific training corpora. For ex- ample, sentiment transfer has been studied exten- sively (Li et al. (2018); Sudhakar et al. (2019); Luo et al. (2019a), inter alia). This paradigm has restricted TST research to a limited, simple set of style choices with parallel corpora, which can often be solved adequately by word replacement (e.g., re- 1Our code, data, and results are available at https:// github.com/suzgunmirac/prompt-and-rerank Sentiment Transfer Input the food was low quality and thrown together quickly with little flavor. GPT-J-6B the food was delicious and prepared with a lot of care! Input the staff is awesome and location is right in the heart of old town! GPT-J-6B the staff is terrible and location is in the middle of nowhere! Elizabethan → Modern English Translation Input thou hast quar rell’d with a man for coughing in the street, because he hath wakened thy dog that hath lain asleep in the sun. GPT-J-6B you have cursed a man because he’s coughed in the street, because he has woken your dog, which has been sleeping in the sun. Input if thou art fickle, what dost thou with him that is renown’d for faith? GPT-J-6B if you are fickle, then what are you doing with that person who is known for being reliable? Fluency and Grammar Correction Input Forexample, My cousin is 12years old. GPT-J-6B For example, My cousin …

Content truncated to 500 words

Labeled Text

AbstractWe propose a method for arbitrary textual style transfer (TST)—the task of transforming a text into any given style—utilizing general-purpose pre-trained language models. Our method, Prompt-and-Rerank, is based on a mathematical formulation of the TST task, decomposing it into three constituent components: textual similarity, target style strength, and fluency. Our method uses zero-shot or few-shot prompting to obtain a set of candidate generations in the target style, and then re-ranks them according to the three components. Our method enables small pre-trained language models to perform on par with state-of-the-art large-scale models while using two orders of magnitude less compute and memory. We also investigate the effect of model size and prompt design (e.g., prompt paraphrasing and delimiter-pair choice) on style transfer quality across seven diverse textual style transfer datasets, finding, among other things, that delimiter-pair choice has a large impact on performance, and that models have biases on the direction of style transfer.

Publication Details

Paper ID:
31399
Year:
2022
Publication:
TIPSTER
Publication Type:
conf
DOI:
nan