{"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/learning-neural-templates-for-text-generation","title":"Learning Neural Templates for Text Generation","arxiv_id":"1808.10122","date":"2018-08-30","proceeding":"EMNLP 2018 10","authors":["Sam Wiseman","Stuart M. Shieber","Alexander M. Rush"],"abstract":"While neural, encoder-decoder models have had significant empirical success in text generation, there remain several unaddressed problems with this style of generation. Encoder-decoder models are largely (a) uninterpretable, and (b) difficult to control in terms of their phrasing or content. This work proposes a neural generation system using a hidden semi-markov model (HSMM) decoder, which learns latent, discrete templates jointly with learning to generate. We show that this model learns useful templates, and that these templates make generation both more interpretable and controllable. Furthermore, we show that this approach scales to real data sets and achieves strong performance nearing that of encoder-decoder text generation models.","url_abs":"https://arxiv.org/abs/1808.10122v3","url_pdf":"https://arxiv.org/pdf/1808.10122v3.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":"learning-neural-templates-for-text-generation","repo_url":"https://github.com/harvardnlp/neural-template-gen","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"learning-neural-templates-for-text-generation","repo_url":"https://github.com/TobeyYang/S2S_Temp","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1808.10122","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1808.10122"}},"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/harvardnlp/neural-template-gen","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/TobeyYang/S2S_Temp","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":12},"by_repo_kind":{"listed":{"samples":12,"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":"2b7644a99136563a","entry":"beam_search","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"generate.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/generate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2b7644a99136563a"}},{"code_sha256_prefix":"464279c212e57c11","entry":"extract_from_tagged_data","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"template_extraction.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/template_extraction.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"464279c212e57c11"}},{"code_sha256_prefix":"99bdea19216d009b","entry":"group_by_template","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"template_extraction.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/template_extraction.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"99bdea19216d009b"}},{"code_sha256_prefix":"12ad11fe4b8855eb","entry":"just_state2phrases","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"template_extraction.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/template_extraction.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"12ad11fe4b8855eb"}},{"code_sha256_prefix":"46e836256359dfaf","entry":"logsumexp0","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"46e836256359dfaf"}},{"code_sha256_prefix":"254795c0c53f7f18","entry":"logsumexp1","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"254795c0c53f7f18"}},{"code_sha256_prefix":"bd2a32a50de1f458","entry":"logsumexp2","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bd2a32a50de1f458"}},{"code_sha256_prefix":"cb8a408338d9f761","entry":"make_targs","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"chsmm_without_src.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/chsmm_without_src.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cb8a408338d9f761"}},{"code_sha256_prefix":"236f6cf621a3485a","entry":"recover_bps","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"infc.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/infc.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"236f6cf621a3485a"}},{"code_sha256_prefix":"40eb2e0e8d291cca","entry":"sort_hyps","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"generate.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/generate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"40eb2e0e8d291cca"}},{"code_sha256_prefix":"78be13a6d800db69","entry":"validation","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"gan.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/gan.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"78be13a6d800db69"}},{"code_sha256_prefix":"3ae4408089e66362","entry":"viterbi","repo":"TobeyYang/S2S_Temp","repo_kind":"listed","path":"infc.py","file_url":"https://github.com/TobeyYang/S2S_Temp/blob/HEAD/infc.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3ae4408089e66362"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}