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 View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 22 code samples harvested from 3 repositories linked to this paper: 17 ran (of which 0 constructed an object rather than computing a result; 13 with no instrument failure: 0 honoured, 0 violated, 13 with no contract checked; 4 where Syntology's instrument failed) · 5 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; 2 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 3 samples from 1 repository, 2 ran (0 with no instrument failure; 2 where Syntology's instrument failed); community (archive-listed): 19 samples from 2 repositories, 15 ran (13 with no instrument failure; 2 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 2 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

uber-research/PPLM officialmentioned in papermentioned on GitHubpytorchSyntology: 3 samples, 2 ran (2 instrument-failed) · 1 unverified report
AdarshKumar712/PPLM.jl mentioned on GitHubMITSyntology: not harvested report
ImadENSMN/pplm_gptneo mentioned on GitHubpytorchSyntology: not harvested report
fsoft-ailab/poem-generator mentioned on GitHubpytorchMITSyntology: 8 samples, 5 ran (0 instrument-failed) · 3 unverified report
jefflai108/6.438-final mentioned on GitHubpytorchApache-2.0Syntology: 11 samples, 10 ran (2 instrument-failed) · 1 unverified report
qkaren/unsup_gen_for_cms_reasoning mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Back to the Future: Unsupervised Backprop-based Decoding for Counterfactual and... (arXiv:2010.05906; that paper's own run record: 5 ran (of which 0 constructed an object rather than computing a result; 0 with no instrument failure: 0 honoured, 0 violated, 0 with no contract checked; 5 where Syntology's instrument failed) · 3 unverified); nothing checks that they implement this paper's method. report
huggingface/transformers pytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Attention Is All You Need (arXiv:1706.03762; that paper's own run record: 610 ran (of which 293 constructed an object rather than computing a result; 529 with no instrument failure: 45 honoured, 15 violated, 469 with no contract checked; 81 where Syntology's instrument failed) · 336 unverified), HuggingFace's Transformers: State-of-the-art Natural Language Processing (arXiv:1910.03771; that paper's own run record: 3 ran (of which 0 constructed an object rather than computing a result; 0 with no instrument failure: 0 honoured, 0 violated, 0 with no contract checked; 3 where Syntology's instrument failed) · 0 unverified), DeBERTa: Decoding-enhanced BERT with Disentangled Attention (arXiv:2006.03654; that paper's own run record: 4 ran (of which 0 constructed an object rather than computing a result; 3 with no instrument failure: 2 honoured, 1 violated, 0 with no contract checked; 1 where Syntology's instrument failed) · 9 unverified) and 1 more (every one in this page's JSON twin); nothing checks that they implement this paper's method. 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.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

22 samples harvested: 17 ran (of which 0 constructed an object rather than computing a result; 13 with no instrument failure: 0 honoured, 0 violated, 13 with no contract checked; 4 where Syntology's instrument failed) · 5 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

2ran · our draft was wrong
2ran; the contract check could not run
13ran
5unverified

Licence: 2 of the 22 samples are pointer only, meaning Syntology does not serve that copy's text. For 2 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. 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; the list below is grouped by repository, each group headed by its name and what it is to the paper. “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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

uber-research/PPLM official repository 3 samples, 2 ran (2 instrument-failed) · 1 unverified
to_var in 51 papers
census: 12 implementations from 21 papers, 1 distinct output on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32
run_pplm.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant Apache-2.0 (permissive) · bbebd95a156061b0 · report fixture: signature x:Tensor/2/float, requires_grad:bool/0/bool, volatile:bool/0/bool, device:str/0/str · returned Tensor · level recorded 2026-09-22
top_k_filter in 9 papers run_pplm.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · ac71b1f4007ef1dd · report fixture: signature logits:Tensor/2/float, k:int/0/int, probs:bool/0/bool · returned Tensor · level recorded 2026-09-22
perturb_past run_pplm.py unverified Apache-2.0 (permissive) · 13fe54bb9dec7e8c · report
fsoft-ailab/poem-generator community (archive-listed) 8 samples, 5 ran (0 instrument-failed) · 3 unverified
build_bows_one_hot_vectors ailamtho/utils/bow.py ran MIT (permissive) · bb82e66218a5e42e · report fixture: signature bow_indices:list/1/list, tokenizer:MockTokenizer/0/?, device:str/0/str · returned list · level recorded 2026-09-24
get_bag_of_words_indices ailamtho/utils/bow.py ran MIT (permissive) · 2bc0b122982a024e · report fixture: signature file_path_bow:str/0/str, tokenizer:MockTokenizer/0/? · returned list · level recorded 2026-09-24
is_stanza ailamtho/utils/check_rule.py ran MIT (permissive) · 85766c79fe9b99bb · report fixture: signature sentences:str/0/str · returned bool · level recorded 2026-09-24
post_process in 56 papers ailamtho/utils/process.py ran fingerprinted MIT (permissive) · 49e475b822b30d82 · report fixture: signature text:str/0/str, n_stanzas:int/0/int · returned str · level recorded 2026-09-24
split_word ailamtho/utils/check_rule.py ran MIT (permissive) · 10c0ed80ad796bd1 · report fixture: signature word:str/0/str · returned str · level recorded 2026-09-24
generate_text_pplm ailamtho/generate/generate_topic.py unverified MIT (permissive) · 73250b2a460d9cd9 · report
load_data in 700 papers ailamtho/utils/check_rule.py unverified MIT (permissive) · 217f0089cb193f97 · report
perturb_past ailamtho/generate/generate_topic.py unverified MIT (permissive) · 3176b47b94387f2a · report
jefflai108/6.438-final community (archive-listed) 11 samples, 10 ran (2 instrument-failed) · 1 unverified
cached_collate_fn run_pplm_discrim_train.py ran · our draft was wrong Apache-2.0 (permissive) here; the stored copy is pointer only · 9f95f3541586ad5c · report fixture: signature data:list/1/dict · returned tuple · level recorded 2026-09-24
cat_past ours/method3.py ran Apache-2.0 (permissive) · 200de6c5c7533d37 · report fixture: signature past:list/1/Tensor, cur_past:list/1/Tensor, last:bool/0/bool · returned tuple · level recorded 2026-09-24
cat_past ours/method4.py ran Apache-2.0 (permissive) · 9b3442a1518d31ff · report fixture: signature past:tuple/1/Tensor, cur_past:tuple/1/Tensor, last:bool/0/bool · returned tuple · level recorded 2026-09-24
collate_fn in 500 papers run_pplm_discrim_train.py ran · our draft was wrong Apache-2.0 (permissive) here; the stored copy is pointer only · c5e400dbec9871ce · report fixture: signature data:list/1/dict · returned tuple · level recorded 2026-09-24
collate_fn in 500 papers paper_code/gpt2tunediscrim.py ran Apache-2.0 (permissive) · 895ee1e721fbbb88 · report fixture: signature data:list/1/dict · returned tuple · level recorded 2026-09-24
conditioning ours/utils.py ran Apache-2.0 (permissive) · 41cffde6e7f145a7 · report fixture: signature tokenizer:MinimalTokenizer/0/?, logprobs:Tensor/2/float, cond_ids:Tensor/1/int, model:callable/0/?, past:NoneType/0/?, ids_to_retain:Tensor/2/int, weights:Tensor/1/float, cnt:int/0/int · returned Tensor · level recorded 2026-09-24
evaluate_performance in 9 papers run_pplm_discrim_train.py ran Apache-2.0 (permissive) · 368c3700824b81fb · report fixture: signature data_loader:DataLoader/0/?, discriminator:callable/0/?, device:str/0/str · returned tuple · level recorded 2026-09-24
repeat_past ours/utils.py ran Apache-2.0 (permissive) · 1dcfab77356ba4f5 · report fixture: signature past:tuple/1/Tensor, top_k:int/0/int · returned tuple · level recorded 2026-09-24
top_k_filtering ours/method3.py ran Apache-2.0 (permissive) · b975947f493d596d · report fixture: signature logits:Tensor/2/float, top_k:int/0/int, filter_value:float/0/float, min_tokens_to_keep:int/0/int · returned tuple · level recorded 2026-09-24
top_k_filtering ours/utils.py ran Apache-2.0 (permissive) · a6e350b1e7b2bef3 · report fixture: signature logits:Tensor/2/float, top_k:int/0/int, filter_value:float/0/float, min_tokens_to_keep:int/0/int · returned tuple · level recorded 2026-09-24
add_past ours/method3.py unverified Apache-2.0 (permissive) · da6a6099de169fa6 · 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