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

Mirac Suzgun, Luke Melas-Kyriazi, Dan Jurafsky
5/23/2022
cs.CL

Official code: suzgunmirac/prompt-and-rerank (36 stars, Python, MIT, last commit 2022-10-02).

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 mathematical formulation of the TST task, decomposing it into three constituent components: textual similarity, target style strength, and fluency.

Show full abstract

Specifically, our method first uses zero-shot or few-shot prompting to obtain a set of candidate generations in the target style, and then re-ranks these candidates according to a combination of the three components above. Empirically, our method enables small pre-trained language models to perform on par with state-of-the-art large-scale models while consuming two orders of magnitude less compute and memory. Finally, we conduct a systematic investigation of 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.

View on arXivView PDF

Code Implementations(1)

MIT

Prompt-and-Rerank: A Method for Zero-Shot and Few-Shot Textual Style Transfer

360PythonMay 23, 20224 years agoMIT

Similar Papers

Cite this paper

@article{suzgun2022promptandrerank,
  title  = {Prompt-and-Rerank: A Method for Zero-Shot and Few-Shot Arbitrary Textual Style Transfer with Small Language Models},
  author = {Mirac Suzgun and Luke Melas-Kyriazi and Dan Jurafsky},
  year   = {2022},
  eprint = {2205.11503},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.11503}
}

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/2205.11503.svg)](https://codeofpaper.com/paper/2205.11503)

Discussion