CodeBLEU:一种码综合自动评价方法
CodeBLEU: a Method for Automatic Evaluation of Code Synthesis
摘要:
评估指标在一个领域的发展中起着至关重要的作用,因为它定义了区分好模型和坏模型的标准。在代码合成领域,常用的评价指标是BLEU或完全准确度,但它们并不适合于代码的评价,因为BLEU最初是为评价自然语言而设计的,忽略了代码重要的句法和语义特征,而完全准确度过于严格,低估了具有相同语义逻辑的不同输出。为了解决这个问题,我们引入了一个新的自动评估指标,称为CodeBLEU。它吸收了BLEU在n-gram匹配中的优势,并通过抽象语法树(AST)进一步注入代码语法,并通过数据流注入代码语义。我们通过评估CodeBLEU和程序员在三个代码合成任务上分配的质量分数之间的相关系数来进行实验,即,文本到代码、代码翻译和代码细化。实验结果表明,我们提出的CodeBLEU可以实现更好的相关性与程序员分配的分数相比,BLEU和准确性。
英文摘要:
Evaluation metrics play a vital role in the growth of an area as it defines the standard of distinguishing between good and bad models. In the area of code synthesis, the commonly used evaluation metric is BLEU or perfect accuracy, but they are not suitable enough to evaluate codes, because BLEU is originally designed to evaluate the natural language, neglecting important syntactic and semantic features of codes, and perfect accuracy is too strict thus it underestimates different outputs with the same semantic logic. To remedy this, we introduce a new automatic evaluation metric, dubbed CodeBLEU. It absorbs the strength of BLEU in the n-gram match and further injects code syntax via abstract syntax trees (AST) and code semantics via data-flow. We conduct experiments by evaluating the correlation coefficient between CodeBLEU and quality scores assigned by the programmers on three code synthesis tasks, i.e., text-to-code, code translation, and code refinement. Experimental results show that our proposed CodeBLEU can achieve a better correlation with programmer assigned scores compared with BLEU and accuracy.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。