{"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/grammar-variational-autoencoder","title":"Grammar Variational Autoencoder","arxiv_id":"1703.01925","date":"2017-03-06","proceeding":"ICML 2017 8","authors":["Matt J. Kusner","Brooks Paige","José Miguel Hernández-Lobato"],"abstract":"Deep generative models have been wildly successful at learning coherent\nlatent representations for continuous data such as video and audio. However,\ngenerative modeling of discrete data such as arithmetic expressions and\nmolecular structures still poses significant challenges. Crucially,\nstate-of-the-art methods often produce outputs that are not valid. We make the\nkey observation that frequently, discrete data can be represented as a parse\ntree from a context-free grammar. We propose a variational autoencoder which\nencodes and decodes directly to and from these parse trees, ensuring the\ngenerated outputs are always valid. Surprisingly, we show that not only does\nour model more often generate valid outputs, it also learns a more coherent\nlatent space in which nearby points decode to similar discrete outputs. We\ndemonstrate the effectiveness of our learned models by showing their improved\nperformance in Bayesian optimization for symbolic regression and molecular\nsynthesis.","url_abs":"http://arxiv.org/abs/1703.01925v1","url_pdf":"http://arxiv.org/pdf/1703.01925v1.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":"grammar-variational-autoencoder","repo_url":"https://github.com/ZmeiGorynych/generative_playground","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"grammar-variational-autoencoder","repo_url":"https://github.com/dbkgroup/GVAE4Smiles","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"grammar-variational-autoencoder","repo_url":"https://github.com/mkusner/grammarVAE","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":null},{"paper_slug":"grammar-variational-autoencoder","repo_url":"https://github.com/omerronen/scales","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"bayesian-optimization","task_name":"Bayesian Optimization"},{"task_slug":"symbolic-regression","task_name":"Symbolic Regression"},{"task_slug":null,"task_name":"valid"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1703.01925","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1703.01925"}},"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/mkusner/grammarVAE","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dbkgroup/GVAE4Smiles","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/omerronen/scales","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ZmeiGorynych/generative_playground","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":3,"ran_violates":1,"unverified":15},"by_repo_kind":{"listed":{"samples":19,"ran":4,"repositories":3}},"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":3,"samples":[{"code_sha256_prefix":"316ca309f1ba9cdf","entry":"getFileList","repo":"dbkgroup/GVAE4Smiles","repo_kind":"listed","path":"doGVAE_genHPO.py","file_url":"https://github.com/dbkgroup/GVAE4Smiles/blob/HEAD/doGVAE_genHPO.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"316ca309f1ba9cdf"}},{"code_sha256_prefix":"8ac1771f54eb5485","entry":"jac","repo":"dbkgroup/GVAE4Smiles","repo_kind":"listed","path":"GVAE.py","file_url":"https://github.com/dbkgroup/GVAE4Smiles/blob/HEAD/GVAE.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8ac1771f54eb5485"}},{"code_sha256_prefix":"16eaf789c4a4401d","entry":"pop_or_nothing","repo":"mkusner/grammarVAE","repo_kind":"listed","path":"molecule_vae.py","file_url":"https://github.com/mkusner/grammarVAE/blob/HEAD/molecule_vae.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"16eaf789c4a4401d"}},{"code_sha256_prefix":"0bf41e0b28d9835c","entry":"prods_to_eq","repo":"mkusner/grammarVAE","repo_kind":"listed","path":"molecule_vae.py","file_url":"https://github.com/mkusner/grammarVAE/blob/HEAD/molecule_vae.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0bf41e0b28d9835c"}},{"code_sha256_prefix":"3faecaf57e145016","entry":"apply_rule","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/____mask_gen_new.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/____mask_gen_new.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":"3faecaf57e145016"}},{"code_sha256_prefix":"bc3ae4805ca43d87","entry":"binarize","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/cyk.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/cyk.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":"bc3ae4805ca43d87"}},{"code_sha256_prefix":"1e29ad9a8377becb","entry":"bond_to_properties","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/hypergraph.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/hypergraph.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":"1e29ad9a8377becb"}},{"code_sha256_prefix":"20bd268acd9f9e89","entry":"cyk_parser","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/cyk.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/cyk.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":"20bd268acd9f9e89"}},{"code_sha256_prefix":"9ac868c2c5da2396","entry":"eq_tokenizer","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/grammar_codec.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/grammar_codec.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":"9ac868c2c5da2396"}},{"code_sha256_prefix":"c872f1c087b0e4e9","entry":"get_terminals_nonterminals","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/cyk.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/cyk.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":"c872f1c087b0e4e9"}},{"code_sha256_prefix":"bd5df031b64e57d3","entry":"get_zinc_tokenizer","repo":"mkusner/grammarVAE","repo_kind":"listed","path":"molecule_vae.py","file_url":"https://github.com/mkusner/grammarVAE/blob/HEAD/molecule_vae.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bd5df031b64e57d3"}},{"code_sha256_prefix":"840377e5c6d40a66","entry":"get_zinc_tokenizer","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/grammar_codec.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/grammar_codec.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":"840377e5c6d40a66"}},{"code_sha256_prefix":"d6375326f73fec04","entry":"graph_tree_to_rules_list","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/hypergraph.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/hypergraph.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":"d6375326f73fec04"}},{"code_sha256_prefix":"d442fe47e76ee11d","entry":"normalize_frequencies","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/hypergraph_grammar.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/hypergraph_grammar.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":"d442fe47e76ee11d"}},{"code_sha256_prefix":"8b8b890289f16b07","entry":"pop_or_nothing","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/grammar_mask_gen.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/grammar_mask_gen.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":"8b8b890289f16b07"}},{"code_sha256_prefix":"be8874e2b946911f","entry":"prods_to_eq","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/grammar_codec.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/grammar_codec.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":"be8874e2b946911f"}},{"code_sha256_prefix":"f158928111217e25","entry":"properties_to_bond","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/hypergraph.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/hypergraph.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":"f158928111217e25"}},{"code_sha256_prefix":"6a2f91d9a7114208","entry":"rule_d_term_dist","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/____mask_gen_new.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/____mask_gen_new.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":"6a2f91d9a7114208"}},{"code_sha256_prefix":"b2a256f2bda78c93","entry":"terminal_distance","repo":"ZmeiGorynych/generative_playground","repo_kind":"listed","path":"src/generative_playground/codec/____mask_gen_new.py","file_url":"https://github.com/ZmeiGorynych/generative_playground/blob/HEAD/src/generative_playground/codec/____mask_gen_new.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":"b2a256f2bda78c93"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}