arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.23169cs.CLcs.SE
收藏

MATCH:通过对比学习实现任务驱动的代码评估

MATCH: Task-Driven Code Evaluation through Contrastive Learning

Bosch Research(博世研究)

Marah Ghoummaid, Vladimir Tchuiev, Ofek Glick, Michal Moshkovitz, Dotan Di Castro

AI总结:

针对现有代码评估方法存在的依赖参考、成本高或无法反映功能契合度的问题,提出基于对比学习的无参考代码评估指标MATCH,在多语言场景下与功能正确性和人类偏好的相关性优于现有指标。

摘要:

基于AI的代码生成应用日益广泛,据估计GitHub上46%的代码由GitHub Copilot生成。准确评估生成代码与开发者意图的契合度仍是一项关键挑战。传统评估方法(如单元测试)通常可扩展性差且成本高昂;句法相似度指标(如BLEU、ROUGE)无法捕捉代码功能,而CodeBERTScore这类指标需要参考代码,这类代码并非总能获取。为填补无参考评估领域(仅有ICE-Score等少数方案)的空白,本文提出一种新型无参考指标MATCH。MATCH利用对比学习为代码和自然语言任务描述生成有意义的嵌入,从而得出能反映生成代码任务实现程度的相似度评分。实验表明,在多种编程语言中,MATCH与功能正确性和人类偏好的相关性均优于现有指标。

英文摘要:

AI-based code generation is increasingly prevalent, with GitHub Copilot estimated to generate 46% of the code on GitHub. Accurately evaluating how well generated code aligns with developer intent remains a critical challenge. Traditional evaluation methods, such as unit tests, are often unscalable and costly. Syntactic similarity metrics (e.g., BLEU, ROUGE) fail to capture code functionality, and metrics like CodeBERTScore require reference code, which is not always available. To address the gap in reference-free evaluation, with few alternatives such as ICE-Score, this paper introduces MATCH, a novel reference-free metric. MATCH uses Contrastive Learning to generate meaningful embeddings for code and natural language task descriptions, enabling similarity scoring that reflects how well generated code implements the task. We show that MATCH achieves stronger correlations with functional correctness and human preference than existing metrics across multiple programming languages.

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

↑