{"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/paraphrase-generation-with-latent-bag-of-1","title":"Paraphrase Generation with Latent Bag of Words","arxiv_id":"2001.01941","date":"2020-01-07","proceeding":"NeurIPS 2019 12","authors":["Yao Fu","Yansong Feng","John P. Cunningham"],"abstract":"Paraphrase generation is a longstanding important problem in natural language processing. In addition, recent progress in deep generative models has shown promising results on discrete latent variables for text generation. Inspired by variational autoencoders with discrete latent structures, in this work, we propose a latent bag of words (BOW) model for paraphrase generation. We ground the semantics of a discrete latent variable by the BOW from the target sentences. We use this latent variable to build a fully differentiable content planning and surface realization model. Specifically, we use source words to predict their neighbors and model the target BOW with a mixture of softmax. We use Gumbel top-k reparameterization to perform differentiable subset sampling from the predicted BOW distribution. We retrieve the sampled word embeddings and use them to augment the decoder and guide its generation search space. Our latent BOW model not only enhances the decoder, but also exhibits clear interpretability. We show the model interpretability with regard to \\emph{(i)} unsupervised learning of word neighbors \\emph{(ii)} the step-by-step generation procedure. Extensive experiments demonstrate the transparent and effective generation process of this model.\\footnote{Our code can be found at \\url{https://github.com/FranxYao/dgm_latent_bow}}","url_abs":"https://arxiv.org/abs/2001.01941v1","url_pdf":"https://arxiv.org/pdf/2001.01941v1.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":"paraphrase-generation-with-latent-bag-of-1","repo_url":"https://github.com/FranxYao/Deep-Generative-Models-for-Natural-Language-Processing","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"paraphrase-generation-with-latent-bag-of-1","repo_url":"https://github.com/FranxYao/dgm_latent_bow","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"paraphrase-generation","task_name":"Paraphrase Generation"},{"task_slug":"text-generation","task_name":"Text Generation"},{"task_slug":"word-embeddings","task_name":"Word Embeddings"}],"methods":[{"method_slug":"interpretability","method_name":"Interpretability"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2001.01941","atlas_url":"https://app.syntology.ai/?focus=2001.01941","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2001.01941"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/FranxYao/dgm_latent_bow","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/FranxYao/Deep-Generative-Models-for-Natural-Language-Processing","reach":{"status":"ok"}}],"summary":{"ran":3,"unverified":9},"by_repo_kind":{"official":{"samples":12,"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":"b3fdc49d516e7dda","entry":"bow_gumbel_topk_sampling","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/latent_bow.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/latent_bow.py","link_basis":"first_harvest_node","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":"b3fdc49d516e7dda"}},{"code_sha256_prefix":"85ee561c589cb9a2","entry":"bow_train_monitor","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/bow_seq2seq.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/bow_seq2seq.py","link_basis":"first_harvest_node","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":"85ee561c589cb9a2"}},{"code_sha256_prefix":"e42494b8d6d09a29","entry":"build_batch_seq2seq_bow2seq","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/data_utils.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/data_utils.py","link_basis":"first_harvest_node","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":"e42494b8d6d09a29"}},{"code_sha256_prefix":"2754ede201877c8e","entry":"attention","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/decoder.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/decoder.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":"2754ede201877c8e"}},{"code_sha256_prefix":"0ca9c17bf3f15cbd","entry":"decoding_infer","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/decoder.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/decoder.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":"0ca9c17bf3f15cbd"}},{"code_sha256_prefix":"f6d2f2fefbd4ee2b","entry":"enc_loss_fn","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/bow_seq2seq.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/bow_seq2seq.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":"f6d2f2fefbd4ee2b"}},{"code_sha256_prefix":"b6b052efd0a759e4","entry":"get_vocab","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/nlp_pipeline.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/nlp_pipeline.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":"b6b052efd0a759e4"}},{"code_sha256_prefix":"73a470177e69f9cc","entry":"mscoco_read_json","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/data_utils.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/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":"73a470177e69f9cc"}},{"code_sha256_prefix":"623afac14847f448","entry":"multi_source_attention","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/decoder.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/decoder.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":"623afac14847f448"}},{"code_sha256_prefix":"9a8e1721a125fdd2","entry":"nll_loss","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/bow_seq2seq.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/bow_seq2seq.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":"9a8e1721a125fdd2"}},{"code_sha256_prefix":"c00c6e76fd620389","entry":"normalize","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/nlp_pipeline.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/nlp_pipeline.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":"c00c6e76fd620389"}},{"code_sha256_prefix":"00693a7aa1f73c16","entry":"quora_read","repo":"FranxYao/dgm_latent_bow","repo_kind":"official","path":"src/data_utils.py","file_url":"https://github.com/FranxYao/dgm_latent_bow/blob/HEAD/src/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":"00693a7aa1f73c16"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}