{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/plug-and-blend-a-framework-for-controllable","title":"Plug-and-Blend: A Framework for Controllable Story Generation with Blended Control Codes","arxiv_id":"2104.04039","date":"2021-03-23","proceeding":"NAACL (NUSE) 2021 6","authors":["Zhiyu Lin","Mark Riedl"],"abstract":"Large pre-trained neural language models (LM) have very powerful text generation capabilities. However, in practice, they are hard to control for creative purposes. We describe a Plug-and-Play controllable language generation framework, Plug-and-Blend, that allows a human user to input multiple control codes (topics). In the context of automated story generation, this allows a human user loose or fine-grained control of the topics and transitions between them that will appear in the generated story, and can even allow for overlapping, blended topics. Automated evaluations show our framework, working with different generative LMs, controls the generation towards given continuous-weighted control codes while keeping the generated sentences fluent, demonstrating strong blending capability. A human participant evaluation shows that the generated stories are observably transitioning between two topics.","url_abs":"https://arxiv.org/abs/2104.04039v2","url_pdf":"https://arxiv.org/pdf/2104.04039v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"plug-and-blend-a-framework-for-controllable","repo_url":"https://github.com/xxbidiao/plug-and-blend","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"story-generation","task_name":"Story Generation"},{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2104.04039","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.04039"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/xxbidiao/plug-and-blend","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":2,"ran":1,"unverified":4},"by_repo_kind":{"official":{"samples":7,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"8d23fbe2b99b840b","entry":"gelu","repo":"xxbidiao/plug-and-blend","repo_kind":"official","path":"gedi_helpers/modeling_gpt2.py","file_url":"https://github.com/xxbidiao/plug-and-blend/blob/HEAD/gedi_helpers/modeling_gpt2.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8d23fbe2b99b840b"}},{"code_sha256_prefix":"d30d6c3098df2c42","entry":"prune_linear_layer","repo":"xxbidiao/plug-and-blend","repo_kind":"official","path":"gedi_helpers/modeling_utils.py","file_url":"https://github.com/xxbidiao/plug-and-blend/blob/HEAD/gedi_helpers/modeling_utils.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d30d6c3098df2c42"}},{"code_sha256_prefix":"49f3df5f44c69b6f","entry":"top_k_top_p_filtering","repo":"xxbidiao/plug-and-blend","repo_kind":"official","path":"gedi_helpers/modeling_utils.py","file_url":"https://github.com/xxbidiao/plug-and-blend/blob/HEAD/gedi_helpers/modeling_utils.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"49f3df5f44c69b6f"}},{"code_sha256_prefix":"464d483ca9073ea6","entry":"SharedDropout2","repo":"xxbidiao/plug-and-blend","repo_kind":"official","path":"gedi_helpers/modeling_gpt2.py","file_url":"https://github.com/xxbidiao/plug-and-blend/blob/HEAD/gedi_helpers/modeling_gpt2.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"464d483ca9073ea6"}},{"code_sha256_prefix":"35214bf3a3709500","entry":"calc_banned_ngram_tokens","repo":"xxbidiao/plug-and-blend","repo_kind":"official","path":"gedi_helpers/modeling_utils.py","file_url":"https://github.com/xxbidiao/plug-and-blend/blob/HEAD/gedi_helpers/modeling_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"35214bf3a3709500"}},{"code_sha256_prefix":"a4d7da98da6cd7ff","entry":"cut_into_sentences","repo":"xxbidiao/plug-and-blend","repo_kind":"official","path":"gedi_skill.py","file_url":"https://github.com/xxbidiao/plug-and-blend/blob/HEAD/gedi_skill.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a4d7da98da6cd7ff"}},{"code_sha256_prefix":"c4bac98236c1fc2c","entry":"load_tf_weights_in_gpt2","repo":"xxbidiao/plug-and-blend","repo_kind":"official","path":"gedi_helpers/modeling_gpt2.py","file_url":"https://github.com/xxbidiao/plug-and-blend/blob/HEAD/gedi_helpers/modeling_gpt2.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c4bac98236c1fc2c"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}