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

关于基于嵌入的方法在衡量代码生成功能正确性方面的局限性

On the Limitations of Embedding Based Methods for Measuring Functional Correctness for Code Generation

Carnegie Mellon University(卡内基梅隆大学)

Atharva Naik

AI总结:

本文分析了 CodeBERTScore 等基于嵌入的指标在代码生成评估中的局限性,发现其与功能正确性仅弱相关(0.16),但与编辑工作量强相关(0.72),揭示了现有评估指标的不足。

摘要:

从自然语言生成代码(NL2Code)的任务已经变得极为流行,尤其是随着大语言模型(LLMs)的出现。然而,由于缺乏可靠的功能正确性度量指标,量化和跟踪这一进展的努力一直受到影响。虽然像 HumanEval 这样的流行基准具有测试用例,能够对正确性进行可靠评估,但收集测试用例耗时且需要人工努力。作为替代方案,人们提出了若干基于参考的评估指标,其中基于嵌入的指标如 CodeBERTScore 被宣传为与人类偏好和功能正确性具有高度相关性。在我们的工作中,我们通过分析十个模型在两个流行代码生成基准上的输出,分析了 CodeBERTScore 等基于嵌入的指标衡量功能正确性以及其他有用构念(如编辑工作量)的能力。我们的结果表明,虽然它们与功能正确性只有弱相关性(0.16),但与编辑工作量有强相关性(0.72)。

英文摘要:

The task of code generation from natural language (NL2Code) has become extremely popular, especially with the advent of Large Language Models (LLMs). However, efforts to quantify and track this progress have suffered due to a lack of reliable metrics for functional correctness. While popular benchmarks like HumanEval have test cases to enable reliable evaluation of correctness, it is time-consuming and requires human effort to collect test cases. As an alternative several reference-based evaluation metrics have been proposed, with embedding-based metrics like CodeBERTScore being touted as having a high correlation with human preferences and functional correctness. In our work, we analyze the ability of embedding-based metrics like CodeBERTScore to measure functional correctness and other helpful constructs like editing effort by analyzing outputs of ten models over two popular code generation benchmarks. Our results show that while they have a weak correlation with functional correctness (0.16), they are strongly correlated (0.72) with editing effort.

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

↑