{"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-to-infer-generative-template","title":"Learning to Infer Generative Template Programs for Visual Concepts","arxiv_id":"2403.15476","date":"2024-03-20","proceeding":null,"authors":["R. Kenny Jones","Siddhartha Chaudhuri","Daniel Ritchie"],"abstract":"People grasp flexible visual concepts from a few examples. We explore a neurosymbolic system that learns how to infer programs that capture visual concepts in a domain-general fashion. We introduce Template Programs: programmatic expressions from a domain-specific language that specify structural and parametric patterns common to an input concept. Our framework supports multiple concept-related tasks, including few-shot generation and co-segmentation through parsing. We develop a learning paradigm that allows us to train networks that infer Template Programs directly from visual datasets that contain concept groupings. We run experiments across multiple visual domains: 2D layouts, Omniglot characters, and 3D shapes. We find that our method outperforms task-specific alternatives, and performs competitively against domain-specific approaches for the limited domains where they exist.","url_abs":"https://arxiv.org/abs/2403.15476v2","url_pdf":"https://arxiv.org/pdf/2403.15476v2.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-to-infer-generative-template","repo_url":"https://github.com/rkjones4/templateprograms","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2403.15476","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.15476"}},"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":"deterministic:regex_extraction","url":"https://github.com/rkjones4/TemplatePrograms","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rkjones4/templateprograms","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran":9,"unverified":6},"by_repo_kind":{"official":{"samples":15,"ran":9,"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":15,"samples":[{"code_sha256_prefix":"174ec7955fff1196","entry":"AttPoint","repo":"rkjones4/templateprograms","repo_kind":"official","path":"executors/shape/ShapeAssembly.py","file_url":"https://github.com/rkjones4/templateprograms/blob/HEAD/executors/shape/ShapeAssembly.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"174ec7955fff1196"}},{"code_sha256_prefix":"5866659603842f67","entry":"Cuboid","repo":"rkjones4/templateprograms","repo_kind":"official","path":"executors/shape/ShapeAssembly.py","file_url":"https://github.com/rkjones4/templateprograms/blob/HEAD/executors/shape/ShapeAssembly.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"5866659603842f67"}},{"code_sha256_prefix":"879b6b71f9fc4afd","entry":"Program","repo":"rkjones4/templateprograms","repo_kind":"official","path":"executors/shape/ShapeAssembly.py","file_url":"https://github.com/rkjones4/templateprograms/blob/HEAD/executors/shape/ShapeAssembly.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"879b6b71f9fc4afd"}},{"code_sha256_prefix":"07891967dc9f6006","entry":"convert_info_to_data","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"train_magg_net.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/train_magg_net.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"07891967dc9f6006"}},{"code_sha256_prefix":"cdd558f65a47c91b","entry":"getArgs","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cdd558f65a47c91b"}},{"code_sha256_prefix":"913e68e9df66fc06","entry":"load_omni_vis_encoder","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"models/model_utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/models/model_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"913e68e9df66fc06"}},{"code_sha256_prefix":"9979e9c2c11eb61b","entry":"magg_load_itns","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"train_magg_net.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/train_magg_net.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"9979e9c2c11eb61b"}},{"code_sha256_prefix":"2356aa163d6b705f","entry":"mergeArgs","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2356aa163d6b705f"}},{"code_sha256_prefix":"6a1dbc6db4557ba6","entry":"model_train_batch","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"train_utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/train_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6a1dbc6db4557ba6"}},{"code_sha256_prefix":"e755fd1cbe96a45e","entry":"calc_coseg_metrics","repo":"rkjones4/templateprograms","repo_kind":"official","path":"coseg_task.py","file_url":"https://github.com/rkjones4/templateprograms/blob/HEAD/coseg_task.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"e755fd1cbe96a45e"}},{"code_sha256_prefix":"e7c36e55049852b3","entry":"load_inf_net","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"models/model_utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/models/model_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"e7c36e55049852b3"}},{"code_sha256_prefix":"f5eee525732a6a1d","entry":"load_vis_encoder","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"models/model_utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/models/model_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"f5eee525732a6a1d"}},{"code_sha256_prefix":"98de6760a6f01028","entry":"model_train","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"train_utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/blob/HEAD/train_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"98de6760a6f01028"}},{"code_sha256_prefix":"dadb0e359d5183c4","entry":"print_results","repo":"rkjones4/TemplatePrograms","repo_kind":"official","path":"utils.py","file_url":"https://github.com/rkjones4/TemplatePrograms/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":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"dadb0e359d5183c4"}},{"code_sha256_prefix":"0fe5d921c79907f6","entry":"writeObj","repo":"rkjones4/templateprograms","repo_kind":"official","path":"executors/shape/ShapeAssembly.py","file_url":"https://github.com/rkjones4/templateprograms/blob/HEAD/executors/shape/ShapeAssembly.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"0fe5d921c79907f6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}