paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Evaluating Code Summarization Techniques: A New Metric and an Empirical Characterization

评估代码摘要技术:一种新度量与经验性刻画
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 2/10 · 该论文研究代码摘要生成与自动评估指标,使用对比学习衡量摘要与代码语义的对齐,属于软件工程/NLP交叉方向;但它不涉及静态分析、Agentic 程序、浮点程序分析或贝叶斯程序分析,与用户核心研究方向关联很弱。引用 33 inbox
Antonio Mastropaolo, Matteo Ciniselli, Massimiliano Di Penta, Gabriele Bavota
crossref: 2026-09-12

AI 速览

一句话:提出基于对比学习的新度量,独立于参考摘要衡量生成代码摘要与代码语义的对齐,并实证其更贴近开发者评价。

现有代码摘要生成研究多用 BLEU、ROUGE、METEOR 等自动指标,其共同假设是生成摘要与开发者参考摘要文本越相似,质量越高。然而参考摘要可能低质或过时,且语义等价但措辞不同的摘要也应被视为合适。本文对多类指标在捕捉生成摘要质量上的互补性进行系统实证研究,并提出一个新维度:不依赖参考摘要,衡量生成摘要与所文档化代码片段语义的对齐程度。作者给出基于对比学习的度量来捕捉该维度。实证表明,引入这一新维度能更有效地表示开发者对自动生成摘要质量的评价。

问题
现有自动代码摘要评价指标依赖与参考摘要的文本相似度,无法处理参考摘要低质或过时以及语义等价但表述不同的问题。研究旨在评估不同指标的互补性并更准确反映开发者判断。
方法
对多种已有指标进行经验性比较,并设计基于对比学习的新度量,从生成摘要与代码语义对齐这一独立于参考摘要的维度评价摘要。
评估
通过实证分析自动指标与开发者评价的关系,显示加入新语义对齐维度后能更好表征开发者对生成摘要质量的评估。
原文摘要(Abstract)

Several code summarization techniques have been proposed in the literature to automatically document a code snippet or a function. Ideally, software developers should be involved in assessing the quality of the generated summaries. However, in most cases, researchers rely on automatic evaluation metrics such as BLEU, ROUGE, and METEOR. These metrics are all based on the same assumption: The higher the textual similarity between the generated summary and a reference summary written by developers, the higher its quality. However, there are two reasons for which this assumption falls short: (i) reference summaries, e.g., code comments collected by mining software repositories, may be of low quality or even outdated; (ii) generated summaries, while using a different wording than a reference one, could be semantically equivalent to it, thus still being suitable to document the code snippet. In this paper, we perform a thorough empirical investigation on the complementarity of different types of metrics in capturing the quality of a generated summary. Also, we propose to address the limitations of existing metrics by considering a new dimension, capturing the extent to which the generated summary aligns with the semantics of the documented code snippet, independently from the reference summary. To this end, we present a new metric based on contrastive learning to capture said aspect. We empirically show that the inclusion of this novel dimension enables a more effective representation of developers' evaluations regarding the quality of automatically generated summaries.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11293,
  title = {Evaluating Code Summarization Techniques: A New Metric and an Empirical Characterization},
  author = {Antonio Mastropaolo and Matteo Ciniselli and Massimiliano Di Penta and Gabriele Bavota},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639174}
}