{"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/generating-narrative-text-in-a-switching","title":"Generating Narrative Text in a Switching Dynamical System","arxiv_id":"2004.03762","date":"2020-04-08","proceeding":"CONLL 2020","authors":["Noah Weber","Leena Shekhar","Heeyoung Kwon","Niranjan Balasubramanian","Nathanael Chambers"],"abstract":"Early work on narrative modeling used explicit plans and goals to generate stories, but the language generation itself was restricted and inflexible. Modern methods use language models for more robust generation, but often lack an explicit representation of the scaffolding and dynamics that guide a coherent narrative. This paper introduces a new model that integrates explicit narrative structure with neural language models, formalizing narrative modeling as a Switching Linear Dynamical System (SLDS). A SLDS is a dynamical system in which the latent dynamics of the system (i.e. how the state vector transforms over time) is controlled by top-level discrete switching variables. The switching variables represent narrative structure (e.g., sentiment or discourse states), while the latent state vector encodes information on the current state of the narrative. This probabilistic formulation allows us to control generation, and can be learned in a semi-supervised fashion using both labeled and unlabeled data. Additionally, we derive a Gibbs sampler for our model that can fill in arbitrary parts of the narrative, guided by the switching variables. Our filled-in (English language) narratives outperform several baselines on both automatic and human evaluations.","url_abs":"https://arxiv.org/abs/2004.03762v1","url_pdf":"https://arxiv.org/pdf/2004.03762v1.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":"generating-narrative-text-in-a-switching","repo_url":"https://github.com/StonyBrookNLP/SLDS-Stories","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2004.03762","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2004.03762"}},"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/StonyBrookNLP/SLDS-Stories","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":11},"by_repo_kind":{"official":{"samples":11,"ran":0,"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":"6b72610a3dde3fa2","entry":"compute_loss_supervised","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"masked_cross_entropy.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/masked_cross_entropy.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":"6b72610a3dde3fa2"}},{"code_sha256_prefix":"bc810b7c58cfa2e5","entry":"compute_loss_unsupervised","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"masked_cross_entropy.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/masked_cross_entropy.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":"bc810b7c58cfa2e5"}},{"code_sha256_prefix":"4a83c296dd50e739","entry":"compute_loss_unsupervised_LM","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"masked_cross_entropy.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/masked_cross_entropy.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":"4a83c296dd50e739"}},{"code_sha256_prefix":"2f057e280e22d44b","entry":"fix_enc_hidden","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"EncDec.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/EncDec.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":"2f057e280e22d44b"}},{"code_sha256_prefix":"592535cda1dd181c","entry":"gather_last","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"EncDec.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/EncDec.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":"592535cda1dd181c"}},{"code_sha256_prefix":"509f852bce1cc974","entry":"gumbel_sample","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"utils.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/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":"509f852bce1cc974"}},{"code_sha256_prefix":"a127d4e3ccc2f275","entry":"load_vocab","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"data_utils.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/data_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":"a127d4e3ccc2f275"}},{"code_sha256_prefix":"2cf3bf1f6ea37ceb","entry":"normal_sample","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"utils.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/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":"2cf3bf1f6ea37ceb"}},{"code_sha256_prefix":"ebe372d67b34074e","entry":"normal_sample_deterministic","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"utils.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/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":"ebe372d67b34074e"}},{"code_sha256_prefix":"639a7a37520aaba6","entry":"sequence_mask","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"EncDec.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/EncDec.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":"639a7a37520aaba6"}},{"code_sha256_prefix":"92918efb0313ba75","entry":"transform","repo":"StonyBrookNLP/SLDS-Stories","repo_kind":"official","path":"data_utils.py","file_url":"https://github.com/StonyBrookNLP/SLDS-Stories/blob/HEAD/data_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":"92918efb0313ba75"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}