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

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

4 Dec 2019ICLR 2020 1arXiv:1912.02164archive 2025-07-28

Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, Rosanne Liu

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.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1912.02164")

Code

Syntology Ran 4 of 22 code samples harvested from 3 repositories linked to this paper; 18 have no recorded run. Of those that ran: 2 ran · fixture could not drive it; 2 ran with no contract checked.

By repository: official repository: 3 samples from 1 repository, 2 ran; community (archive-listed): 19 samples from 2 repositories, 2 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

uber-research/PPLM officialmentioned in papermentioned on GitHubpytorch report
AdarshKumar712/PPLM.jl mentioned on GitHubMIT report
ImadENSMN/pplm_gptneo mentioned on GitHubpytorch report
fsoft-ailab/poem-generator mentioned on GitHubpytorchMIT report
jefflai108/6.438-final mentioned on GitHubpytorchApache-2.0 report
qkaren/unsup_gen_for_cms_reasoning mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

22 samples harvested; 4 ran; 0 honoured the contract we drafted; 18 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · fixture could not drive it
2ran
18unverified

Licence: 0 of the 22 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

to_var uber-research/PPLM/run_pplm.py official repository ran · fixture could not drive it Apache-2.0 (permissive) · bbebd95a156061b0 · report
top_k_filter uber-research/PPLM/run_pplm.py official repository ran · fixture could not drive it fingerprinted Apache-2.0 (permissive) · ac71b1f4007ef1dd · report
perturb_past uber-research/PPLM/run_pplm.py official repository unverified Apache-2.0 (permissive) · 13fe54bb9dec7e8c · report
cached_collate_fn jefflai108/6.438-final/run_pplm_discrim_train.py community (archive-listed) ran Apache-2.0 (permissive) · 9f95f3541586ad5c · report
collate_fn jefflai108/6.438-final/run_pplm_discrim_train.py community (archive-listed) ran Apache-2.0 (permissive) · c5e400dbec9871ce · report
add_past jefflai108/6.438-final/ours/method3.py community (archive-listed) unverified Apache-2.0 (permissive) · da6a6099de169fa6 · report
build_bows_one_hot_vectors fsoft-ailab/poem-generator/ailamtho/utils/bow.py community (archive-listed) unverified MIT (permissive) · bb82e66218a5e42e · report
cat_past jefflai108/6.438-final/ours/method3.py community (archive-listed) unverified Apache-2.0 (permissive) · 200de6c5c7533d37 · report
cat_past jefflai108/6.438-final/ours/method4.py community (archive-listed) unverified Apache-2.0 (permissive) · 9b3442a1518d31ff · report
collate_fn jefflai108/6.438-final/paper_code/gpt2tunediscrim.py community (archive-listed) unverified Apache-2.0 (permissive) · 895ee1e721fbbb88 · report
conditioning jefflai108/6.438-final/ours/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 41cffde6e7f145a7 · report
evaluate_performance jefflai108/6.438-final/run_pplm_discrim_train.py community (archive-listed) unverified Apache-2.0 (permissive) · 368c3700824b81fb · report
generate_text_pplm fsoft-ailab/poem-generator/ailamtho/generate/generate_topic.py community (archive-listed) unverified MIT (permissive) · 73250b2a460d9cd9 · report
get_bag_of_words_indices fsoft-ailab/poem-generator/ailamtho/utils/bow.py community (archive-listed) unverified MIT (permissive) · 2bc0b122982a024e · report
is_stanza fsoft-ailab/poem-generator/ailamtho/utils/check_rule.py community (archive-listed) unverified MIT (permissive) · 85766c79fe9b99bb · report
load_data fsoft-ailab/poem-generator/ailamtho/utils/check_rule.py community (archive-listed) unverified MIT (permissive) · 217f0089cb193f97 · report
perturb_past fsoft-ailab/poem-generator/ailamtho/generate/generate_topic.py community (archive-listed) unverified MIT (permissive) · 3176b47b94387f2a · report
post_process fsoft-ailab/poem-generator/ailamtho/utils/process.py community (archive-listed) unverified MIT (permissive) · 49e475b822b30d82 · report
repeat_past jefflai108/6.438-final/ours/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 1dcfab77356ba4f5 · report
split_word fsoft-ailab/poem-generator/ailamtho/utils/check_rule.py community (archive-listed) unverified MIT (permissive) · 10c0ed80ad796bd1 · report
top_k_filtering jefflai108/6.438-final/ours/method3.py community (archive-listed) unverified Apache-2.0 (permissive) · b975947f493d596d · report
top_k_filtering jefflai108/6.438-final/ours/utils.py community (archive-listed) unverified Apache-2.0 (permissive) · a6e350b1e7b2bef3 · report

Tasks

AttributeLanguage ModellingText Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections