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

超越功能正确性:对大语言模型生成代码的静态质量分析

Beyond Functional Correctness: Static Code Quality Profiling of LLM-Generated Code

The University of Queensland(昆士兰大学);Texas A&M University–Kingsville(德克萨斯农工大学金斯维尔分校);Central Queensland University(中昆士兰大学)

Jue Huang, Tarek Mahmud, Meiru Che, Guowei Yang

AI总结:

本文针对大语言模型生成的Python代码开展大规模静态质量分析,借助Pylint等工具评估可维护性与可靠性,发现不同模型间存在功能正确性无法捕捉的系统性差异,推动了更全面的代码评估框架发展。

摘要:

大语言模型(LLMs)越来越多地被用于代码生成,但大多数评估仍聚焦于生成代码是否通过基准测试套件。然而仅功能正确性只能提供有限的质量视角:基准测试往往不完整,通过测试并不能保证代码具备可维护性、可靠性或良好的结构。本文针对大语言模型生成的Python代码开展大规模静态质量分析,重点关注可维护性与可靠性。我们使用LiveCodeBench中73个模型生成的65663个程序,借助Pylint、Radon和SonarQube等成熟静态分析工具对生成代码进行评估。结果显示,不同模型间存在仅靠正确性无法捕捉的系统性差异,其中可维护性是最明显的差异来源。我们还发现,正确性往往伴随结构权衡,而非统一的更简单解决方案。总体而言,研究结果推动了仅通过通过率之外的指标评估大语言模型生成代码的评估框架发展。

英文摘要:

Large language models (LLMs) are increasingly used for code generation, yet most evaluations still focus on whether generated code passes benchmark test suites. Functional correctness alone, however, provides only a limited view of quality: benchmark tests are often incomplete, and passing them does not guarantee that code is maintainable, reliable, or well-structured. This paper {presents a large-scale static quality profiling of} LLM-generated Python code, with a focus on maintainability and reliability. Using 65{,}663 programs from 73 models in LiveCodeBench, we evaluate generated code with established static analysis tools, including Pylint, Radon, and SonarQube. Our results show systematic differences across models that are not captured by correctness alone, with maintainability emerging as the clearest source of variation. We further find that correctness often comes with structural trade-offs rather than uniformly simpler solutions. Overall, our findings motivate evaluation frameworks that assess LLM-generated code beyond pass rates alone.

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

↑