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

使用GPT-4o迭代评估和提升代码质量研究

On Iterative Evaluation and Enhancement of Code Quality Using GPT-4o

JPMorgan Chase(摩根大通)

Rundong Liu, Andre Frade, Amal Vaidya, Maxime Labonne, Marcus Kaiser, Bismayan Chakrabarti, Jonathan Budd, Sean Moran

AI总结:

本文提出CodeQUEST框架,利用LLMs迭代评估和提升代码质量,通过评估器(多维度评估)和优化器(反馈驱动改进)组件,在Python/JavaScript数据集上实现52.6%的质量提升,验证了LLMs在自动化代码质量优化中的潜力。

摘要:

本文介绍了CodeQUEST,这是一个利用大型语言模型(LLMs)在可读性、可维护性、效率和安全性等多个维度上迭代评估和提升代码质量的新型框架。该框架分为两个主要组件:评估器(Evaluator),可评估十个维度的代码质量并提供定量分数和定性总结;优化器(Optimizer),根据评估器的反馈迭代改进代码。研究表明,CodeQUEST能有效且稳健地评估代码质量,其评估结果与已确立的代码质量指标高度一致。通过对Python和JavaScript示例的精选数据集进行一系列实验,CodeQUEST实现了代码质量的显著提升,平均相对百分比改进达52.6%。该框架的评估结果通过Pylint分数、Radon可维护性指数和Bandit输出日志等代理指标验证,显示出有意义的相关性。这凸显了LLMs在自动化代码质量评估和改进流程中的潜力,为提升软件开发实践迈出了重要一步。该框架的代码实现可在https://github.com/jpmorganchase/CodeQuest获取。

英文摘要:

This paper introduces CodeQUEST, a novel framework leveraging Large Language Models (LLMs) to iteratively evaluate and enhance code quality across multiple dimensions, including readability, maintainability, efficiency, and security. The framework is divided into two main components: an Evaluator that assesses code quality across ten dimensions, providing both quantitative scores and qualitative summaries, and an Optimizer that iteratively improves the code based on the Evaluator's feedback. Our study demonstrates that CodeQUEST can effectively and robustly evaluate code quality, with its assessments aligning closely with established code quality metrics. Through a series of experiments using a curated dataset of Python and JavaScript examples, CodeQUEST demonstrated significant improvements in code quality, achieving a mean relative percentage improvement of 52.6%. The framework's evaluations were validated against a set of proxy metrics comprising of Pylint Score, Radon Maintainability Index, and Bandit output logs, showing a meaningful correlation. This highlights the potential of LLMs in automating code quality evaluation and improvement processes, presenting a significant advancement toward enhancing software development practices. The code implementation of the framework is available at: https://github.com/jpmorganchase/CodeQuest.

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

↑