MoT: Modularization-of-Thought Prompting for Effective Code Generation
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Large Language Models are transforming software development by automatically generating code. Current prompting techniques such as Chain-of-Thought (CoT) suggest tasks step by step and the reasoning process follows a linear structure, which hampers the understanding of complex programming problems, particularly those requiring hierarchical solutions. Inspired by the principle of modularization in software development, in this work, we propose a novel prompting technique called MoT (Modularization of Thought), to enhance the code generation performance of LLMs. First, MoT exploits modularization principles to decompose complex programming problems into smaller, independent reasoning steps, enabling a more structured and interpretable problem-solving process. This hierarchical structure improves the LLMs' ability to comprehend complex programming problems. Then, it structures the reasoning process using an MLR Graph (Multi-Level Reasoning Graph), which hierarchically organizes reasoning steps. This approach enhances modular understanding and ensures better alignment between reasoning steps and the generated code, significantly improving code generation performance. Our experiments on two advanced LLMs (GPT-4o-mini and DeepSeek-R1), comparing MoT to six baseline prompting techniques across eight benchmarks, demonstrate that MoT significantly outperforms existing baselines (e.g., CoT and SCoT), achieving Pass@1 scores ranging from 58.1% to 95.1%.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 24 of its 49 references that are in the map. First posted on arXiv 16 Mar 2025.
Builds on
24 of 49 references.
Closest ancestors · 2
Same direction, newest first
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code12 Mar
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generation17 Aug
Other references · 22
- 2023GPT-4 Technical Reportcited by 18,396
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2022Emergent Abilities of Large Language Modelscited by 2,512
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,407
- 2021Measuring Coding Challenge Competence With APPScited by 902
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2023StarCoder: may the source be with you!cited by 799
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
- 2024DeepSeek LLM: Scaling Open-Source Language Models with Longtermismcited by 642
10 more
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
- 2021Retrieval Augmented Code Generation and Summarizationcited by 149
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
- 2023CodeScore: Evaluating Code Generation by Learning Code Executioncited by 67
- 2023CodeChain: Towards Modular Code Generation Through Chain of Self-revisions with Representative Sub-modulescited by 58
- 2024Efficient Prompting Methods for Large Language Models: A Surveycited by 47
- 2025CodeCoR: An LLM-Based Self-Reflective Multi-Agent Framework for Code Generationcited by 34
- 2023Interpretable Deep Learning Methods for Multiview Learningcited by 5
Built on by
Citing papers per year: 2025: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2023MoTCoder: Elevating Large Language Models with Modular of Thought for Challenging Programming Tasks
- 2023Think Outside the Code: Brainstorming Boosts Large Language Models in Code Generation
- 2023Structured Chain-of-Thought Prompting for Code Generation
- 2025SEER: Enhancing Chain-of-Thought Code Generation through Self-Exploring Deep Reasoning
- 2025Understanding Chain-of-Thought Effectiveness in Code Generation: An Empirical and Information-Theoretic Analysis
- 2025Intention Chain-of-Thought Prompting with Dynamic Routing for Code Generation
- 2024Boosting of Thoughts: Trial-and-Error Problem Solving with Large Language Models
- 2024Enhancing Code Generation Performance of Smaller Models by Distilling the Reasoning Ability of LLMs