arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.15080cs.SEcs.AI
收藏

赋能AI生成更好的AI代码:利用LLM引导生成深度学习项目

Empowering AI to Generate Better AI Code: Guided Generation of Deep Learning Projects with LLMs

School of Computer Science, Shanghai Jiao Tong University(计算机科学学院,上海交通大学)

Chen Xie, Mingsheng Jiao, Xiaodong Gu, Beijun Shen

AI总结:

针对LLM生成深度学习项目困难的问题,提出规划引导的代码生成方法DLCodeGen,通过预测解决方案计划、检索相似代码并抽象模板,结合对比学习生成代码,在自建数据集上CodeBLEU提升9.7%,人工评估提升3.6%。

摘要:

尽管大型语言模型(LLM)已被广泛应用于代码生成,但它们在生成整个深度学习项目方面仍面临困难,这些项目的特点是结构复杂、函数较长,且比通用代码更依赖领域知识。开放领域的LLM通常缺乏针对特定项目的连贯上下文指导和领域专业知识,使得生成完全满足用户需求的完整代码变得具有挑战性。在本文中,我们提出了一种新颖的规划引导代码生成方法DLCodeGen,专门用于生成深度学习项目。DLCodeGen预测结构化的解决方案计划,为LLM生成项目提供全局指导。然后利用生成的计划来检索语义相似的代码样本,并进而抽象出代码模板。为了有效整合这些多种检索增强技术,设计了一种对比学习机制来生成最终代码。我们在自建的深度学习代码生成数据集上验证了方法的有效性。实验结果表明,DLCodeGen优于其他基线,在CodeBLEU上提高了9.7%,在人工评估指标上提高了3.6%。

英文摘要:

While large language models (LLMs) have been widely applied to code generation, they struggle with generating entire deep learning projects, which are characterized by complex structures, longer functions, and stronger reliance on domain knowledge than general-purpose code. An open-domain LLM often lacks coherent contextual guidance and domain expertise for specific projects, making it challenging to produce complete code that fully meets user requirements. In this paper, we propose a novel planning-guided code generation method, DLCodeGen, tailored for generating deep learning projects. DLCodeGen predicts a structured solution plan, offering global guidance for LLMs to generate the project. The generated plan is then leveraged to retrieve semantically analogous code samples and subsequently abstract a code template. To effectively integrate these multiple retrieval-augmented techniques, a comparative learning mechanism is designed to generate the final code. We validate the effectiveness of our approach on a dataset we build for deep learning code generation. Experimental results demonstrate that DLCodeGen outperforms other baselines, achieving improvements of 9.7% in CodeBLEU and 3.6% in human evaluation metrics.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑