CodeScore: Evaluating Code Generation by Learning Code Execution

被引:1
作者
Dong, Yihong [1 ,2 ]
Ding, Jiazheng [1 ,2 ]
Jiang, Xue [1 ,2 ]
Li, Ge [1 ,2 ]
Li, Zhuo [1 ,2 ]
Jin, Zhi [1 ,2 ]
机构
[1] Peking Univ, Key Lab High Confidence Software Technol, Minist Educ, Beijing, Peoples R China
[2] Peking Univ, Sch Comp Sci, Beijing, Peoples R China
基金
中国国家自然科学基金;
关键词
Code Evaluation; Code Pre-trained Language Model; Code Generation;
D O I
10.1145/3695991
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
A proper code evaluation metric (CEM) profoundly impacts the evolution of code generation, which is an important research field in NLP and software engineering. Prevailing match-based CEMs (e.g., BLEU, Accuracy, and CodeBLEU) suffer from two significant drawbacks. 1. They primarily measure the surface differences between codes without considering their functional equivalence. However, functional equivalence is pivotal in evaluating the effectiveness of code generation, as different codes can perform identical operations. 2. They are predominantly designed for the Ref-only input format. However, code evaluation necessitates versatility in input formats. Aside from Ref-only, there are NL-only and Ref and NL formats, which existing match-based CEMs cannot effectively accommodate. In this article, we propose CodeScore, a large language model (LLM)based CEM, which estimates the functional correctness of generated code on three input types. To acquire CodeScore, we present UniCE, a unified code generation learning framework, for LLMs to learn code execution (i.e., learning PassRatio and Executability of generated code) with unified input. Extensive experimental results on multiple code evaluation datasets demonstrate that CodeScore absolutely improves up to 58.87% correlation with functional correctness compared to other CEMs, achieves state-of-the-art performance, and effectively handles three input formats.
引用
收藏
页数:22
相关论文
共 68 条
[41]  
Radford A., 2018, Improving language understanding by generative pre-training
[42]  
Ranasinghe Tharindu, 2020, P 28 INT C COMPUTATI, P5070
[43]  
Raychev V, 2014, ACM SIGPLAN NOTICES, V49, P419, DOI [10.1145/2666356.2594321, 10.1145/2594291.2594321]
[44]  
Rei R., 2022, P 7 C MACHINE TRANSL, P578
[45]  
Rei Ricardo, 2020, EMNLP, V1, P2685
[46]  
Rei Ricardo, 2021, P 6 C MACH TRANSL AS, P1030
[47]  
Reimers N, 2019, 2019 CONFERENCE ON EMPIRICAL METHODS IN NATURAL LANGUAGE PROCESSING AND THE 9TH INTERNATIONAL JOINT CONFERENCE ON NATURAL LANGUAGE PROCESSING (EMNLP-IJCNLP 2019), P3982
[48]  
Ren S, 2020, Arxiv, DOI arXiv:2009.10297
[49]  
Roziere B, 2024, Arxiv, DOI arXiv:2308.12950
[50]  
Roziere Baptiste, 2020, Advances in Neural Information Processing Systems, V33