让不懂编程的人也能用大模型生成完整项目代码。
SRLCG: Self-Rectified Large-Scale Code Generation with Multidimensional Chain-of-Thought and Dynamic Backtracking
- 用多维思维链+自我修正机制引导模型生成连贯代码。
- 生成代码长度是GPT-4的16倍,且更准确、更稳定。
- 适合零基础用户构建大型软件项目,提升开发效率。
大语言模型(LLMs)已显著提升开发者生产力,但对缺乏编程知识的多数用户而言,仍难以使用,因其仅生成孤立代码片段,无法构成完整项目。用户缺乏能力去理解、修改和迭代模型输出,导致无法组装成可用项目。为此,我们提出自修正大规模代码生成框架SRLCG,仅凭单一提示即可生成多文件完整项目代码。SRLCG采用新颖的多维思维链(CoT)与自修正机制,引导模型生成正确且鲁棒的代码文件,并通过动态回溯算法整合为结构一致的完整项目。实验表明,SRLCG生成代码长度达DeepSeek-V3的15倍、GPT-4的16倍,且至少是其他主流基于CoT基线的10倍以上。同时,在大规模代码生成任务中,其正确性、鲁棒性与性能均优于现有方法。
原文摘要 · Abstract (English)
Large language models (LLMs) have revolutionized code generation, significantly enhancing developer productivity. However, for a vast number of users with minimal coding knowledge, LLMs provide little support, as they primarily generate isolated code snippets rather than complete, large-scale project code. Without coding expertise, these users struggle to interpret, modify, and iteratively refine the outputs of LLMs, making it impossible to assemble a complete project. To address this issue, we propose Self-Rectified Large-Scale Code Generator (SRLCG), a framework that generates complete multi-file project code from a single prompt. SRLCG employs a novel multidimensional chain-of-thought (CoT) and self-rectification to guide LLMs in generating correct and robust code files, then integrates them into a complete and coherent project using our proposed dynamic backtracking algorithm. Experimental results show that SRLCG generates code 15x longer than DeepSeek-V3, 16x longer than GPT-4, and at least 10x longer than other leading CoT-based baselines. Furthermore, they confirm its improved correctness, robustness, and performance compared to baselines in large-scale code generation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。