Intention Chain-of-Thought Prompting with Dynamic Routing for Code Generation
Shen Li, Li Huang, Shaoxiong Zhan, Weifeng Sun, Tao Yin, Zhongxin Liu, Meng Yan

TL;DR
This paper introduces RoutingGen, a dynamic prompting framework for code generation that adapts to task difficulty, guiding models to focus on core intentions and improving performance while reducing token usage.
Contribution
The paper proposes RoutingGen, a difficulty-aware routing framework with Intention Chain-of-Thought prompting, enhancing code generation by focusing on task intentions and adapting prompting strategies.
Findings
RoutingGen achieves state-of-the-art results on multiple benchmarks.
It reduces token usage by 46.37% on average.
ICoT outperforms existing prompting methods on challenging tasks.
Abstract
Large language models (LLMs) exhibit strong generative capabilities and have shown great potential in code generation. Existing chain-of-thought (CoT) prompting methods enhance model reasoning by eliciting intermediate steps, but suffer from two major limitations: First, their uniform application tends to induce overthinking on simple tasks. Second, they lack intention abstraction in code generation, such as explicitly modeling core algorithmic design and efficiency, leading models to focus on surface-level structures while neglecting the global problem objective. Inspired by the cognitive economy principle of engaging structured reasoning only when necessary to conserve cognitive resources, we propose RoutingGen, a novel difficulty-aware routing framework that dynamically adapts prompting strategies for code generation. For simple tasks, it adopts few-shot prompting; for more complex…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Machine Learning in Materials Science · Software Engineering Research
