arXiv:2505.15469cs.SEcs.AI2025-05中稿 · PROMISE '25被引 8

研究大模型生成多语言代码注释的错误类型与评测指标可靠性

A Qualitative Investigation into LLM-Generated Multilingual Code Comments and Automatic Evaluation Metrics

  • 通过开放式编码分析五种模型在五种语言中的注释错误
  • 发现26类错误,且主流评测指标无法区分正确与错误注释
  • 适合关注多语言代码生成与评估可信度的研究者

大型语言模型是重要的编程助手,但其训练主要以英语为中心。本研究评估代码语言模型在非英语语境下的表现,揭示其在多语言工作流中应用与集成的挑战。我们对五种前沿代码模型(CodeGemma、CodeLlama、CodeQwen1.5、GraniteCode、StarCoder2)在中文、荷兰语、英语、希腊语和波兰语中的代码注释生成结果进行开放式编码分析。研究构建了一个包含12,500条标注生成结果的数据集并公开发布。进一步评估标准评测指标在捕捉注释正确性方面的可靠性,发现这些模型常生成部分正确的注释,而现代神经评测指标无法可靠区分有意义的补全与随机噪声。专家评分显示正确与错误注释间存在显著分数重叠,质疑了现有指标在评估生成注释时的有效性。

原文摘要 · Abstract (English)

Large Language Models are essential coding assistants, yet their training is predominantly English-centric. In this study, we evaluate the performance of code language models in non-English contexts, identifying challenges in their adoption and integration into multilingual workflows. We conduct an open-coding study to analyze errors in code comments generated by five state-of-the-art code models, CodeGemma, CodeLlama, CodeQwen1.5, GraniteCode, and StarCoder2 across five natural languages: Chinese, Dutch, English, Greek, and Polish. Our study yields a dataset of 12,500 labeled generations, which we publicly release. We then assess the reliability of standard metrics in capturing comment \textit{correctness} across languages and evaluate their trustworthiness as judgment criteria. Through our open-coding investigation, we identified a taxonomy of 26 distinct error categories in model-generated code comments. They highlight variations in language cohesion, informativeness, and syntax adherence across different natural languages. Our analysis shows that, while these models frequently produce partially correct comments, modern neural metrics fail to reliably differentiate meaningful completions from random noise. Notably, the significant score overlap between expert-rated correct and incorrect comments calls into question the effectiveness of these metrics in assessing generated comments.

代码生成多语言评测指标LLM

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。