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

超越功能正确性:探究大型语言模型中的编码风格不一致性

Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Models

Sun Yat-sen University(中山大学);Huawei Cloud Computing Technologies(华为云计算技术)

Yanlin Wang, Tianyue Jiang, Mingwei Liu, Jiachi Chen, Mingzhi Mao, Xilin Liu, Yuchi Ma, Zibin Zheng

AI总结:

本文实证分析主流代码LLM与人类开发者编码风格差异,总结不一致分类,从可读性、简洁性、健壮性比较,并探讨原因与解决方案。

摘要:

大型语言模型(LLMs)给代码生成领域带来了范式转变,为增强软件开发过程提供了潜力。然而,以往的研究主要关注代码生成的准确性,而LLMs与人类开发者之间的编码风格差异仍未得到充分探索。在本文中,我们实证分析了主流代码LLMs生成的代码与人类开发者编写的代码之间的编码风格差异,并总结了编码风格不一致的分类体系。具体而言,我们首先通过人工分析大量生成结果来归纳编码风格不一致的类型。然后,我们从可读性、简洁性和健壮性三个方面比较了代码LLMs生成的代码与人类程序员编写的代码。结果表明,LLMs与开发者的编码风格存在差异。此外,我们研究了这些不一致的可能原因,并提供了一些缓解该问题的解决方案。

英文摘要:

Large language models (LLMs) have brought a paradigm shift to the field of code generation, offering the potential to enhance the software development process. However, previous research mainly focuses on the accuracy of code generation, while coding style differences between LLMs and human developers remain under-explored. In this paper, we empirically analyze the differences in coding style between the code generated by mainstream Code LLMs and the code written by human developers, and summarize coding style inconsistency taxonomy. Specifically, we first summarize the types of coding style inconsistencies by manually analyzing a large number of generation results. We then compare the code generated by Code LLMs with the code written by human programmers in terms of readability, conciseness, and robustness. The results reveal that LLMs and developers have different coding styles. Additionally, we study the possible causes of these inconsistencies and provide some solutions to alleviate the problem.

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

↑