{"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/recursive-visual-programming","title":"Recursive Visual Programming","arxiv_id":"2312.02249","date":"2023-12-04","proceeding":null,"authors":["Jiaxin Ge","Sanjay Subramanian","Baifeng Shi","Roei Herzig","Trevor Darrell"],"abstract":"Visual Programming (VP) has emerged as a powerful framework for Visual Question Answering (VQA). By generating and executing bespoke code for each question, these methods demonstrate impressive compositional and reasoning capabilities, especially in few-shot and zero-shot scenarios. However, existing VP methods generate all code in a single function, resulting in code that is suboptimal in terms of both accuracy and interpretability. Inspired by human coding practices, we propose Recursive Visual Programming (RVP), which simplifies generated routines, provides more efficient problem solving, and can manage more complex data structures. RVP is inspired by human coding practices and approaches VQA tasks with an iterative recursive code generation approach, allowing decomposition of complicated problems into smaller parts. Notably, RVP is capable of dynamic type assignment, i.e., as the system recursively generates a new piece of code, it autonomously determines the appropriate return type and crafts the requisite code to generate that output. We show RVP's efficacy through extensive experiments on benchmarks including VSR, COVR, GQA, and NextQA, underscoring the value of adopting human-like recursive and modular programming techniques for solving VQA tasks through coding.","url_abs":"https://arxiv.org/abs/2312.02249v2","url_pdf":"https://arxiv.org/pdf/2312.02249v2.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":"recursive-visual-programming","repo_url":"https://github.com/para-lost/rvp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}}],"tasks":[{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"visual-question-answering-1","task_name":"Visual Question Answering"},{"task_slug":"visual-question-answering","task_name":"Visual Question Answering (VQA)"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2312.02249","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.02249"}},"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/para-lost/rvp","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran_draft_wrong":3,"ran":8,"unverified":2},"by_repo_kind":{"official":{"samples":13,"ran":11,"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":13,"samples":[{"code_sha256_prefix":"cf9ffa02a42184af","entry":"whitespace_tokenize","repo":"para-lost/rvp","repo_kind":"official","path":"base_models/tcl/tcl_tokenization_bert.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/base_models/tcl/tcl_tokenization_bert.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cf9ffa02a42184af"}},{"code_sha256_prefix":"38e334384d86aaa1","entry":"bool_to_yesno","repo":"para-lost/rvp","repo_kind":"official","path":"image_patch.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/image_patch.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":"38e334384d86aaa1"}},{"code_sha256_prefix":"b54134f48b26b8b8","entry":"collate","repo":"para-lost/rvp","repo_kind":"official","path":"vision_processes.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/vision_processes.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":"b54134f48b26b8b8"}},{"code_sha256_prefix":"191a0905a11888a1","entry":"denormalize","repo":"para-lost/rvp","repo_kind":"official","path":"utils.py","file_url":"https://github.com/para-lost/rvp/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":"191a0905a11888a1"}},{"code_sha256_prefix":"44efca8c80c8d48f","entry":"draw_bounding_boxes","repo":"para-lost/rvp","repo_kind":"official","path":"utils.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/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":"44efca8c80c8d48f"}},{"code_sha256_prefix":"7cc4a60389346b00","entry":"extract_start_index","repo":"para-lost/rvp","repo_kind":"official","path":"main_batch.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/main_batch.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"7cc4a60389346b00"}},{"code_sha256_prefix":"ef08d7159362c3db","entry":"get_index_from_sample_id","repo":"para-lost/rvp","repo_kind":"official","path":"utils.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/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":"ef08d7159362c3db"}},{"code_sha256_prefix":"bc2728b9cedba3e5","entry":"get_transform","repo":"para-lost/rvp","repo_kind":"official","path":"base_models/inspyrenet/saliency_transforms.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/base_models/inspyrenet/saliency_transforms.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":"bc2728b9cedba3e5"}},{"code_sha256_prefix":"4262ed39e3ce5c97","entry":"interpolate_pos_embed","repo":"para-lost/rvp","repo_kind":"official","path":"base_models/tcl/tcl_vit.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/base_models/tcl/tcl_vit.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":"4262ed39e3ce5c97"}},{"code_sha256_prefix":"e7fbc7a74a3457c7","entry":"load_vocab","repo":"para-lost/rvp","repo_kind":"official","path":"base_models/tcl/tcl_tokenization_bert.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/base_models/tcl/tcl_tokenization_bert.py","link_basis":"harvester_set","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":"e7fbc7a74a3457c7"}},{"code_sha256_prefix":"18839b05574cb883","entry":"my_collate","repo":"para-lost/rvp","repo_kind":"official","path":"main_batch.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/main_batch.py","link_basis":"plan_row","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":"18839b05574cb883"}},{"code_sha256_prefix":"73cecca9f3575f09","entry":"concat_all_gather","repo":"para-lost/rvp","repo_kind":"official","path":"base_models/tcl/tcl_model_pretrain.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/base_models/tcl/tcl_model_pretrain.py","link_basis":"harvester_set","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":"73cecca9f3575f09"}},{"code_sha256_prefix":"26be70dca3249c0b","entry":"load_tf_weights_in_bert","repo":"para-lost/rvp","repo_kind":"official","path":"base_models/tcl/tcl_xbert.py","file_url":"https://github.com/para-lost/rvp/blob/HEAD/base_models/tcl/tcl_xbert.py","link_basis":"harvester_set","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":"26be70dca3249c0b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}