Publication | Open Access
CodeBLEU: a Method for Automatic Evaluation of Code Synthesis
185
Citations
18
References
2020
Year
Software MaintenanceEngineeringSoftware EngineeringSource Code AnalysisEvaluation MetricsSoftware AnalysisCorpus LinguisticsCode RefinementNatural Language ProcessingComputational LinguisticsLanguage StudiesMachine TranslationCode GenerationComputer ScienceCode RepresentationSoftware DesignProgram AnalysisSoftware TestingFormal MethodsCode SynthesisProgram SynthesisLinguisticsSoftware Language Engineering
Evaluation metrics are crucial for code synthesis, yet BLEU and perfect accuracy fail to capture code syntax and semantics, leading to inadequate assessment. The authors propose CodeBLEU, an automatic evaluation metric tailored for code synthesis. CodeBLEU extends BLEU by incorporating abstract syntax tree matching for syntax and data‑flow analysis for semantics, and its performance was tested via correlation with programmer‑rated scores on text‑to‑code, code translation, and code refinement tasks. CodeBLEU achieves higher correlation with human judgments than BLEU and perfect accuracy.
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.
| Year | Citations | |
|---|---|---|
Page 1
Page 1