user: text: Write a concise one-sentence TLDR summary of the scientific paper content below.

Title: Plug and Play Language Models: A Simple Approach to Controlled Text Generation

Paper content:
Large transformer-based language models (LMs) trained on huge text corpora have shown unparalleled generation capabilities.
However, controlling attributes of the generated language (e.g. switching topic or sentiment) is difficult without modifying the model architecture or fine-tuning on attribute-specific data and entailing the significant cost of retraining.
We propose a simple alternative: the Plug and Play Language Model (PPLM) for controllable language generation, which combines a pretrained LM with one or more simple attribute classifiers that guide text generation without any further training of the LM.
In the canonical scenario we present, the attribute models are simple classifiers consisting of a user-specified bag of words or a single learned layer with 100,000 times fewer parameters than the LM.
Sampling entails a forward and backward pass in which gradients from the attribute model push the LM's hidden activations and thus guide the generation.
Model samples demonstrate control over a range of topics and sentiment styles, and extensive automated and human annotated evaluations show attribute alignment and fluency.
PPLMs are flexible in that any combination of differentiable attribute models may be used to steer text generation, which will allow for diverse and creative applications beyond the examples given in this paper.
The Transformer architecture (Vaswani et al., 2017) has enabled large-scale language models (LMs) trained on a huge amount of data (Radford et al., 2019; Dai et al., 2019b; Radford et al., 2018b) to greatly improve the state-of-the-art on natural language processing tasks.
These models are used to extract contextualized word embeddings for transfer learning purposes (Devlin et al., 2019) and as natural language generators.
The latter can leverage large amounts of unannotated data and a simple log-likelihood training objective.
However, once such models are trained, controlling attributes of Table 1 : The PPLM employs a pre-trained language model (LM) without any changes to the model parameters and can generate text with controlled attributes such as topic and sentiment.
We demonstrate control with two tiny and easy to construct attribute models: a bag of words (BoW) related to a topic and a linear discriminator trained on top of LM latent representations to control sentiment.
The underlined prefix is what the LM is conditioned on to generate a passage of text (e.g. The potato
The potato The potato The potato The potato The potato The potato The potato The potato The potato The potato The potato The potato The potato The potato The potato The potato).
The controlled attributes are colored and bracketed (e.g. [Science] ), and words in the BoW that are directly optimized for are highlighted brightly (e.g. research).
The softer highlights correspond to words related to the attribute, but not directly optimized for during the control process (e.g. health).
[-] The potato
The The potato chip recipe you asked for!
We love making these, and I've been doing so for years.
I've always had a hard time keeping a recipe secret.
I think it's the way our kids love to eat them -so many little ones.
[Science] The potato
The To conclude, the most significant and lasting damage from the economic crisis in 2008 was that many governments, including those in the political center, lost power for the first time in modern history.
generated text becomes difficult without modifying the model architecture to allow for extra input attributes or fine-tuning with attribute-specific data (Keskar et al., 2019; Ziegler et al., 2019) .
Controllable generation entails modeling p(x|a), where a is some desired controllable attribute(s) and x the generated sample.
However, generative models only learn p(x).
In computer vision, Plug & Play Generative Networks (PPGN) from Nguyen et al. (2017) developed a mechanism for generating images with different attributes by plugging a discriminator (attribute model) p(a|x) together with a base generative model p(x) and sampling from the resulting p(x|a) ∝ p(a|x)p(x), effectively creating a conditional generative model on the fly from any supplied attribute model.
In a similar manner, we propose the Plug and Play Language Model (PPLM) for conditional language generation that combines one or more simple attribute models p(a|x)-either in the form of a bagof-words (BoW) or single layer classifiers-with a pre-trained, unconditional language model p(x).
We sample from the resulting combined model by following gradients in the latent representation space in a manner inspired by the approximate Metropolis-adjusted Langevin (MALA) (Roberts et al., 1996; Roberts & Rosenthal, 1998) sampler deployed in Nguyen et al. (2017) .
Optimization is performed ex post facto in the activation space, therefore no re-training or finetuning is needed.
Control is fine-grained, with a strength parameter determining how strong the attribute influence should be; a strength of 0 fully recovers the original model p(x).
This design allows vast flexibility: users can combine a state-of-the-art generative model, which may be large and difficult to train, with any number of attribute controllers.
Attribute models may be easier to train or untrained (in the case of BoW models), and multiple controllers may be combined flexibly during inference.
In this paper, we demonstrate the PPLM approach using a GPT-2 345M model (Radford et al., 2019) as the general-purpose LM p(x), but the method applies in any representation space from any transformer-based text generator and allows combination with any attribute model p(a|x).
We demonstrate controlled generation with a number of attribute controllers, assembled and combined during generation, each with a different strength, acting as a set of "control knobs" that tune generation towards the desired attribute (see examples in Table 1 ).
Code for the experiments is available at: https://github.com/uber-research/PPLM.
Our key contributions are:
• We introduce the Plug and Play LM for controlled language generation, discuss its relation to existing work, and how sampling from a PPLM works (Sections 2 and 3).
• We demonstrate controlling of text generation on a range of attributes, including 7 topics each defined using a bag of words, and 1 simple discriminator on sentiments.
We quantify effectiveness using both automated evaluation (separately trained perplexity and sentiment models) as well as human evaluation (for attribute relevance and fluency).
All evaluations point toward the ability of PPLMs to generate attribute controlled, fluent text (Section 4).
• We compare PPLM with strong LM baselines such as CTRL (Keskar et al., 2019) and GPT-2 finetuned for positivty (Ziegler et al., 2019) .
Our method, without any LM training, is on par and often outperforms the baselines on attribute relevance and fluency (Section 4.2, and Section 4.3).
• We show that the PPLM approach can be used to detoxify certain instances where generation of toxic content is likely by following the negative gradient of a model trained to detect toxicity (Section 4.4).
We also show how PPLM can be used for structurally constrained story writing (Section 4.5).
We present PPLM, a plug and play method for controlled language generation that allows flexible assembling of a large, pre-trained language model and a BoW or a small, easy-to-train discriminator, and achieves fine-grained control of attributes such as topics and sentiment.
Without retraining or fine-tuning the language model, the simple mechanism shows great capability of attribute control while retaining fluency.
We believe this method could serve as a simple baseline for the largely open-ended language generation tasks where controlling is challenging.
There has recently been a substantial discussion around the ethics of capable language models (Radford et al., 2019; Keskar et al., 2019) , both in their potential to recapitulate problematic social biases and for them to be directly abused for societal harm (e.g. to generate disinformation).
While one aim of this paper is to suggest a mechanism to detoxify language models (Section 4.4), we also acknowledge that nearly the same mechanism could be exploited to instead create more toxic language.
Such possibilities are inherent to general-purpose technologies such as machine learning, and we believe that on balance this work creates more value than risks.
Acknowledgements The authors gratefully thank Bryan McCann for providing samples for the CTRL baseline, Joel Lehman for discussion regarding the ethical implications for this work, Jiale Zhi for help with the computational framework, Colan Chen for creating associated artwork for the blog, Avishek Joey Bose for helpful discussions, Julien Chaumond, Lysandre Debut, Thomas Wolf, and the Hugging Face team for co-producing the PPLM demo and helping integrate the code into their transformers repository, all the annotators at Uber, HKUST and Caltech for their labeling, and members of the Deep Collective research group at Uber AI for helpful discussion, ideas, and feedback on experiments.Without retraining or fine-tuning the language model, the simple mechanism shows great capability of attribute control while retaining fluency.
We believe this method could serve as a simple baseline for the largely open-ended language generation tasks where controlling is challenging.
We consider three baselines: CTRL, GPT2-FT-RL, and WD.
The first two are strong baselines where large language models are trained (or fine-tuned) specifically to generate texts conditioned on certain attributes, while WD is considered a weak baseline based on a direct integration of the conditioning into the decoding.

assistant: text: We control the topic and sentiment of text generation (almost) without any training.