arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2601.12146cs.SE
收藏

从LLM到代理:提供编译器对编程的影响

From LLMs to Agents in Programming: The Impact of Providing an LLM with a Compiler

Chalmers University of Technology and University of Gothenburg(查尔姆斯理工大学和哥德堡大学)

Viktor Kjellberg, Miroslaw Staron, Farnaz Fotrousi

AI总结:

本文研究了提供编译器如何提升LLM在编程任务中的表现,发现编译器能显著提高编译成功率并减少错误,且小型模型在某些情况下表现更优。

摘要:

大型语言模型在自然语言和程序生成以及软件开发中展现出了显著的能力。然而,由LLM生成的源代码并不总是符合质量要求,可能无法编译。因此,许多研究转向了能够先进行问题推理再生成解决方案源代码的代理。本文旨在研究此类代理在获得软件开发工具(在此情况下是gcc编译器)的情况下,能获得何种程度的收益。我们在RosettaCode数据集上对699个C语言编程任务进行了计算实验。我们评估了将编译器整合到语言模型中如何将语言模型的角色从被动生成者转变为能够根据编译器反馈迭代开发可运行程序的主动代理。我们评估了16种语言模型,其规模从小(1.35亿)到中(30亿)再到大(70亿)。我们的结果表明,访问编译器使编译成功率提高了5.3至79.4个百分点,而不会影响生成程序的语义。语法错误减少了75%,而未定义引用相关的错误减少了87%,对于代理优于基线的情况。我们还观察到,在某些情况下,带有编译器的小型模型优于带有编译器的大型模型。我们得出结论,为LLM提供软件工程工具对于提高其性能和减少软件工程中对大模型的需求至关重要,例如减少我们的能源足迹。

英文摘要:

Large Language Models have demonstrated a remarkable capability in natural language and program generation and software development. However, the source code generated by the LLMs does not always meet quality requirements and may fail to compile. Therefore, many studies evolve into agents that can reason about the problem before generating the source code for the solution. The goal of this paper is to study the degree to which such agents benefit from access to software development tools, in our case, a gcc compiler. We conduct a computational experiment on the RosettaCode dataset, on 699 programming tasks in C. We evaluate how the integration with a compiler shifts the role of the language model from a passive generator to an active agent capable of iteratively developing runnable programs based on feedback from the compiler. We evaluated 16 language models with sizes ranging from small (135 million) to medium (3 billion) and large (70 billion). Our results show that access to a compiler improved the compilation success by 5.3 to 79.4 percentage units in compilation without affecting the semantics of the generated program. Syntax errors dropped by 75%, and errors related to undefined references dropped by 87% for the tasks where the agents outperformed the baselines. We also observed that in some cases, smaller models with a compiler outperform larger models with a compiler. We conclude that it is essential for LLMs to have access to software engineering tools to enhance their performance and reduce the need for large models in software engineering, such as reducing our energy footprint.

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

↑