MoT: Modularization-of-Thought Prompting for Effective Code Generation
Ruwei Pan, Hongyu Zhang
Key points
From the paper's conclusion- Inspired by the principle of modularization in software development, we propose a novel prompting technique called MoT (Modularization of Thought), to enhance the code generation performance of LLMs.
- 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%.
- MoT significantly outperforms existing baselines (e.g., CoT and SCoT), achieving Pass@1 scores ranging from 58.1% to 95.1%.
Abstract
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 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%.
Read the paper
Discussion · 1
Science Skim's AI key points, plus readers' public thoughts
- Inspired by the principle of modularization in software development, we propose a novel prompting technique called MoT (Modularization of Thought), to enhance the code generation performance of LLMs.
- 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%.
- MoT significantly outperforms existing baselines (e.g., CoT and SCoT), achieving Pass@1 scores ranging from 58.1% to 95.1%.
Readers' thoughts
No reader thoughts yet.
Related papers
- Lingxi: Repository-Level Issue Resolution Framework Enhanced by Procedural Knowledge Guided ScalingProceedings of the ACM on Software Engineering · 2026
- CONCUR: Benchmarking LLMs for Concurrent Code GenerationProceedings of the ACM on Software Engineering · 2026
- Do Advanced Language Models Eliminate the Need for Prompt Engineering in Software Engineering?ACM Transactions on Software Engineering and Methodology · 2025
- An Empirical Study on the Code Refactoring Capability of Large Language ModelsACM Transactions on Software Engineering and Methodology · 2026
- Multi-step SWE: Can Coding Agents Keep Building on Their Own Code Over Long Horizons?arXiv · 2026
- Self-Evolving Coding Agents via Harness-Policy OptimizationarXiv · 2026