Agentic AI
New prompting method helps AI models write better code by breaking down problems hierarchically
Researchers propose MoT, a technique that decomposes complex coding tasks into modular reasoning steps to improve large language model code generation.
Large language models have become powerful tools for automating software development, but existing prompting strategies struggle with intricate programming challenges. Researchers have now introduced a novel approach that applies the principles of modular code design to improve how AI systems tackle complex coding problems.
A Hierarchical Alternative to Linear Reasoning#
Current techniques like Chain-of-Thought prompting guide models through step-by-step problem-solving in a linear fashion. However, this sequential approach can be limiting for problems that naturally benefit from a hierarchical or modular structure. The new method, called Modularization of Thought (MoT), reframes the reasoning process to mirror how experienced developers actually organize code.
Rather than following a single line of reasoning from start to finish, MoT breaks complex programming tasks into smaller, independent reasoning modules. Each module focuses on a specific aspect of the problem, making the overall problem-solving process more structured and transparent.
How the System Works#
The technique organizes reasoning using a Multi-Level Reasoning Graph (MLR Graph), which arranges reasoning steps in a hierarchical structure. This design aligns reasoning more closely with the modular code that gets generated, improving both the clarity of the AI's thought process and the quality of the final code output.
Experimental Results#
Researchers tested MoT against six baseline prompting techniques across eight programming benchmarks using two advanced language models: GPT-4o-mini and DeepSeek-R1. The results show that MoT consistently outperforms existing methods, including Chain-of-Thought and other established baselines, achieving Pass@1 scores (a measure of successful code generation on the first attempt) ranging from 58.1% to 95.1% depending on the benchmark.
The full research paper is available on arXiv.

