LLM时代文学编程的复兴:增强大规模项目中基于LLM的代码生成
Renaissance of Literate Programming in the Era of LLMs: Enhancing LLM-Based Code Generation in Large-Scale Projects
AI总结:
本研究提出可互操作文学编程(ILP)概念,结合文学编程原则与提示工程方法,增强LLM在大型项目中的代码生成能力,并在RepoBench基准上验证其优势。
摘要:
大型语言模型(LLMs)通过代码生成、理解和修复帮助程序员提高了效率。然而,由于现代代码库的复杂依赖关系和庞大体积,它们在大型项目中的应用仍然具有挑战性。尽管Knuth的文学编程(LP)概念将代码和自然语言结合起来以传达逻辑和意图,但其在增强大型项目关系方面的潜力尚未被充分探索。在本研究中,我们引入了可互操作文学编程(ILP)的概念,利用文学编程原则来增强LLMs在小型文档和大型项目开发中的作用。我们调查了LLMs在ILP风格指令下如何执行文档导向任务和整个项目。认识到许多研究人员依赖结构良好的模板来指导LLMs,我们提出了一种简洁的提示工程方法来编写LP文档,以便LLMs更好地参与代码生成。我们还考察了各种LLMs在RepoBench基准上生成Scheme和Python代码的能力,展示了我们方法的优势。我们的研究结果表明,ILP与LLMs可以增强大型项目开发中基于LLM的代码生成。
英文摘要:
Large Language Models (LLMs) have helped programmers increase efficiency through code generation, comprehension, and repair. However, their application to large-scale projects remains challenging due to complex interdependencies and the extensive size of modern codebases. Although Knuth's concept of Literate Programming (LP) combines code and natural language to convey logic and intent, its potential for enhancing relationships in large projects has not been fully explored. In this study, we introduce the idea of Interoperable LP (ILP), which leverages literate programming principles to enhance the development of both small-scale documents and large-scale projects with LLMs. We investigate how LLMs perform under ILP-style instructions for both document-oriented tasks and entire projects. Recognizing that many researchers rely on well-structured templates to guide LLMs, we propose a concise prompt engineering method to write LP documents so LLMs can better be involved in code generation. We also examine the capacity of various LLMs to generate Scheme and Python code on the RepoBench benchmark, illustrating the advantages of our approach. Our findings indicate that ILP with LLMs can enhance LLM-based code generation in large-scale project development.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。