CodeBERTScore: Evaluating Code Generation with Pretrained Models of Code

被引:0
|
作者
Zhou, Shuyan [1 ]
Alon, Uri [1 ,2 ]
Agarwal, Sumit [1 ]
Neubig, Graham [1 ]
机构
[1] Carnegie Mellon Univ, Language Technol Inst, Pittsburgh, PA 15213 USA
[2] Google DeepMind, London, England
关键词
D O I
暂无
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
Since the rise of neural natural-language-to-code models (NL -> Code) that can generate long expressions and statements rather than a single next-token, one of the major problems has been reliably evaluating their generated output. In this paper, we propose CodeBERTScore: an evaluation metric for code generation, which builds on BERTScore (Zhang et al., 2020). Instead of encoding only the generated tokens as in BERTScore, CodeBERTScore also encodes the natural language input preceding the generated code, thus modeling the consistency between the generated code and its given natural language context as well. We perform an extensive evaluation of CodeBERTScore across four programming languages. We find that CodeBERTScore achieves a higher correlation with human preference and with functional correctness than all existing metrics. That is, generated code that receives a higher score by CodeBERTScore is more likely to be preferred by humans, as well as to function correctly when executed. We release five language-specific pretrained models to use with our publicly available code. Our language-specific models have been downloaded more than 1,000,000 times from the Huggingface Hub.(1)
引用
收藏
页码:13921 / 13937
页数:17
相关论文
共 50 条
  • [31] Text to Code: Pseudo Code Generation
    Din, Altaf U.
    Adnan, Awais
    CONTEXT-AWARE SYSTEMS AND APPLICATIONS, AND NATURE OF COMPUTATION AND COMMUNICATION, 2019, 298 : 20 - 37
  • [32] Code-Centric Code Generation
    Busch, Daniel
    Smyth, Steven
    Tegeler, Tim
    Steffen, Bernhard
    LEVERAGING APPLICATIONS OF FORMAL METHODS, VERIFICATION AND VALIDATION: REOCAS COLLOQUIUM IN HONOR OF ROCCO DE NICOLA, PT I, ISOLA 2024, 2025, 15219 : 340 - 355
  • [33] Code generation
    Firth, Niall
    NEW SCIENTIST, 2014, 223 (2985) : 38 - 41
  • [34] Retargetable generation of code selectors for HDL processor models
    Leupers, R
    Marwedel, P
    EUROPEAN DESIGN & TEST CONFERENCE - ED&TC 97, PROCEEDINGS, 1997, : 140 - 144
  • [35] RateML: A Code Generation Tool for Brain Network Models
    van der Vlag, Michiel
    Woodman, Marmaduke
    Fousek, Jan
    Diaz-Pier, Sandra
    Martin, Aaron Perez
    Jirsa, Viktor
    Morrison, Abigail
    FRONTIERS IN NETWORK PHYSIOLOGY, 2022, 2
  • [36] CODE GENERATION FOR CSM/ECSM MODELS IN COSMA ENVIRONMENT
    Grabski, Waldemar
    Nowacki, Michal
    COMPUTER SCIENCE-AGH, 2007, 8 : 49 - 59
  • [37] AltaRica 3.0 code generation from SysML models
    Nga Nguyen
    Mhenni, Faida
    Choley, Jean-Yves
    SAFETY AND RELIABILITY - SAFE SOCIETIES IN A CHANGING WORLD, 2018, : 2435 - 2440
  • [38] Communication pipelining for Code Generation from Simulink Models
    Yan, Rongjie
    Huang, Kai
    Yu, Min
    Zhang, Xiaomeng
    2013 12TH IEEE INTERNATIONAL CONFERENCE ON TRUST, SECURITY AND PRIVACY IN COMPUTING AND COMMUNICATIONS (TRUSTCOM 2013), 2013, : 1893 - 1900
  • [39] Structural language models for any-code generation
    Alon, Uri
    Sadaka, Roy
    Levy, Omer
    Yahav, Eran
    arXiv, 2019,
  • [40] Automated generation of simulation models for control code tests
    Barth, Mike
    Fay, Alexander
    CONTROL ENGINEERING PRACTICE, 2013, 21 (02) : 218 - 230