{"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/motcoder-elevating-large-language-models-with","title":"MoTCoder: Elevating Large Language Models with Modular of Thought for Challenging Programming Tasks","arxiv_id":"2312.15960","date":"2023-12-26","proceeding":null,"authors":["Jingyao Li","Pengguang Chen","Bin Xia","Hong Xu","Jiaya Jia"],"abstract":"Large Language Models (LLMs) have showcased impressive capabilities in handling straightforward programming tasks. However, their performance tends to falter when confronted with more challenging programming problems. We observe that conventional models often generate solutions as monolithic code blocks, restricting their effectiveness in tackling intricate questions. To overcome this limitation, we present Module-of-Thought Coder (MoTCoder). We introduce a framework for MoT instruction tuning, designed to promote the decomposition of tasks into logical sub-tasks and sub-modules. Our investigations reveal that, through the cultivation and utilization of sub-modules, MoTCoder significantly improves both the modularity and correctness of the generated solutions, leading to substantial pass@1 improvements of 5.9% on APPS and 5.8% on CodeContests. MoTCoder also achieved significant improvements in self-correction capabilities, surpassing the current SOTA by 3.3%. Additionally, we provide an analysis of between problem complexity and optimal module decomposition and evaluate the maintainability index, confirming that the code generated by MoTCoder is easier to understand and modify, which can be beneficial for long-term code maintenance and evolution. Our codes are available at https://github.com/dvlab-research/MoTCoder.","url_abs":"https://arxiv.org/abs/2312.15960v5","url_pdf":"https://arxiv.org/pdf/2312.15960v5.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":"motcoder-elevating-large-language-models-with","repo_url":"https://github.com/dvlab-research/motcoder","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"code-generation","task_name":"Code Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/code-generation-on-apps","task":"Code Generation","dataset":"APPS","model":"MoTCoder-32B-V1.5","rank_in_archive_order":2,"of":18,"metrics":{"Competition Pass@1":"27.84","Interview Pass@1":"44.49","Introductory Pass@1":"68.44"},"uses_additional_data":false},{"leaderboard":"/sota/code-generation-on-apps","task":"Code Generation","dataset":"APPS","model":"MoTCoder-7B-V1.5","rank_in_archive_order":3,"of":18,"metrics":{"Competition Pass@1":"21.18","Interview Pass@1":"32.63","Introductory Pass@1":"54.26"},"uses_additional_data":false},{"leaderboard":"/sota/code-generation-on-codecontests","task":"Code Generation","dataset":"CodeContests","model":"MoTCoder-15B","rank_in_archive_order":5,"of":8,"metrics":{"Test Set pass@1":"26.34","Val Set pass@1":"20.35"},"uses_additional_data":false},{"leaderboard":"/sota/code-generation-on-codecontests","task":"Code Generation","dataset":"CodeContests","model":"MoTCoder-7B-v1.5","rank_in_archive_order":6,"of":8,"metrics":{"Test Set pass@1":"20.77","Val Set pass@1":"16.72"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2312.15960","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.15960"}},"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/dvlab-research/motcoder","reach":{"status":"ok"}}],"summary":{"ran":4,"unverified":4},"by_repo_kind":{"official":{"samples":8,"ran":4,"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":8,"samples":[{"code_sha256_prefix":"5b8f5baa0fc73ca1","entry":"cc2apps","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/dataset/data.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/dataset/data.py","link_basis":"first_harvest_node","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":"5b8f5baa0fc73ca1"}},{"code_sha256_prefix":"cc054f0a84bb15b0","entry":"custom_compare_","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/testing_util.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/testing_util.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":"cc054f0a84bb15b0"}},{"code_sha256_prefix":"3d0fafc764fb7aec","entry":"extract_code_blocks","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3d0fafc764fb7aec"}},{"code_sha256_prefix":"79fec3b223bb4bac","entry":"stripped_string_compare","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/testing_util.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/testing_util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"79fec3b223bb4bac"}},{"code_sha256_prefix":"bca9e14ac3aef757","entry":"load_data","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/dataset/data.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/dataset/data.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":"bca9e14ac3aef757"}},{"code_sha256_prefix":"8fde5367be8c1218","entry":"process_batch","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/vllm_fix.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/vllm_fix.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":"8fde5367be8c1218"}},{"code_sha256_prefix":"258657af338c1b25","entry":"process_item","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/vllm_fix.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/vllm_fix.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":"258657af338c1b25"}},{"code_sha256_prefix":"d1021aa710d40741","entry":"reflection_prompt","repo":"dvlab-research/motcoder","repo_kind":"official","path":"eval/vllm_fix.py","file_url":"https://github.com/dvlab-research/motcoder/blob/HEAD/eval/vllm_fix.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":"d1021aa710d40741"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}