arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2502.07835cs.SEcs.AI
收藏

连接LLM生成代码与需求:面向开发者洞察的反向生成技术与SBC指标

Bridging LLM-Generated Code and Requirements: Reverse Generation technique and SBC Metric for Developer Insights

Ahilan Ayyachamy Nadar Ponnusamy

AI总结:

针对AI生成代码质量评估与人类判断相关性弱、现有指标实用性不足的问题,本文提出基于反向生成技术的SBC评分机制,通过重构需求并对比原始规格量化准确性,为开发者提供可操作洞察。

摘要:

大型语言模型(LLMs)在软件工程领域的兴起,尤其是在代码生成方面,已获得广泛关注。然而,由于编程任务的固有复杂性,以及缺乏与人类判断高度一致的稳健评估指标,评估AI生成代码的质量仍是一项挑战。传统的基于token的指标如BLEU和ROUGE虽在自然语言处理中常用,但在代码智能与验证任务中与人类评估的相关性较弱。此外,这些指标主要聚焦于研究,并非为无缝集成到软件开发生命周期而设计,限制了其对寻求提升代码质量和安全性的开发者的实际效用。AI辅助编码已被证明对资深开发者更有益,因为他们具备批判性评估生成代码的正确性、完整性和合规性的专业知识。相比之下,初级开发者可能难以识别AI生成代码中的幻觉、缺失功能或错误逻辑。为弥合这一差距,本文引入一种名为SBC分数的新型评分机制,该机制基于利用LLMs自然语言生成能力的反向生成技术。与直接代码分析不同,我们的方法从AI生成代码中重构系统需求,并将其与原始规格进行比较以量化准确性。SBC分数结合了语义相似度、BLEU和完整性分析,通过突出缺失功能和幻觉为开发者提供可操作的洞察。我们的代码和数据集可在GitHub上获取。

英文摘要:

The rise of Large Language Models (LLMs) in software engineering, particularly in code generation, has garnered significant attention. However, assessing the quality of AI-generated code remains a challenge due to the inherent complexity of programming tasks and the lack of robust evaluation metrics that align well with human judgment. Traditional token-based metrics such as BLEU and ROUGE, while commonly used in natural language processing, exhibit weak correlations with human assessments in code intelligence and verification tasks. Furthermore, these metrics are primarily research focused and are not designed for seamless integration into the software development lifecycle, limiting their practical utility for developers seeking to improve code quality and security. AI-assisted coding has been shown to be more beneficial for senior developers, as they possess the expertise to critically evaluate the generated code for correctness, completeness, and compliance. In contrast, junior developers may struggle to identify hallucinations, missing functionality, or incorrect logic in AI-generated code. To bridge this gap, This paper introduces a novel scoring mechanism called the SBC score, which is based on a reverse generation technique that leverages the natural language generation capabilities of LLMs. Unlike direct code analysis, our approach reconstructs system requirements from AI-generated code and compares them with the original specifications to quantify accuracy. The SBC score combines semantic similarity, BLEU, and completeness analysis, providing actionable insights to developers by highlighting missing features and hallucinations. Our code and datasets are available on GitHub

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

↑