[论文解读] On the Evaluation of Commit Message Generation Models: An Experimental Study
本文对提交消息生成模型进行了系统的实证研究,评估了多种编程语言下的指标、数据集和划分策略。研究发现 BLEU-Norm 与人工判断的相关性最高,提出了包含五种语言共 360 万个消息的大规模 MCMD 数据集,并表明模型性能在很大程度上取决于数据集划分策略,为未来评估和模型选择提供了实用指导。
Commit messages are natural language descriptions of code changes, which are important for program understanding and maintenance. However, writing commit messages manually is time-consuming and laborious, especially when the code is updated frequently. Various approaches utilizing generation or retrieval techniques have been proposed to automatically generate commit messages. To achieve a better understanding of how the existing approaches perform in solving this problem, this paper conducts a systematic and in-depth analysis of the state-of-the-art models and datasets. We find that: (1) Different variants of the BLEU metric are used in previous works, which affects the evaluation and understanding of existing methods. (2) Most existing datasets are crawled only from Java repositories while repositories in other programming languages are not sufficiently explored. (3) Dataset splitting strategies can influence the performance of existing models by a large margin. Some models show better performance when the datasets are split by commit, while other models perform better when the datasets are split by timestamp or by project. Based on our findings, we conduct a human evaluation and find the BLEU metric that best correlates with the human scores for the task. We also collect a large-scale, information-rich, and multi-language commit message dataset MCMD and evaluate existing models on this dataset. Furthermore, we conduct extensive experiments under different dataset splitting strategies and suggest the suitable models under different scenarios. Based on the experimental results and findings, we provide feasible suggestions for comprehensively evaluating commit message generation models and discuss possible future research directions. We believe this work can help practitioners and researchers better evaluate and select models for automatic commit message generation.
研究动机与目标
- 为解决提交消息生成研究中缺乏一致且全面的评估实践的问题。
- 探究不同评估指标(尤其是 BLEU 变体)与人工判断的相关性。
- 探讨数据集构成(尤其是语言多样性与数据划分策略)对模型性能的影响。
- 收集并发布大规模多语言提交消息数据集(MCMD),以支持更广泛且更真实的评估。
- 为研究人员和实践者提供关于选择和评估提交消息生成模型的可操作建议。
提出的方法
- 对 100 条 BLEU 分数差异显著的提交消息进行了人工评估,以衡量自动指标与人工判断之间的相关性。
- 提出了并评估了对 NNGen 检索式模型的两项改进:使用 n-gram 表示法(NNGen-Gram4)和应用平滑函数(NNGen-Smooth)。
- 从 500 个仓库中收集并整理了 MCMD 数据集,涵盖五种主流编程语言(Java、Python、JavaScript、C++、Go),包含超过 360 万个提交消息及丰富的上下文元数据。
- 在三种数据集划分策略下评估了当前最先进模型的性能:按提交划分、按时间戳划分和按项目划分,以评估其对性能的影响。
- 使用皮尔逊相关系数和斯皮尔曼等级相关系数,将 BLEU 变体(B-Moses、B-Norm、B-CC)与人工评分进行比较,以识别最可靠的指标。
- 在可能的情况下重用了原始模型实现,并对新实现进行了双重验证,以确保可复现性和有效性。
实验结果
研究问题
- RQ1在提交消息生成任务中,哪种 BLEU 变体(B-Moses、B-Norm、B-CC)与人工判断的相关性最强?
- RQ2不同的数据集划分策略(基于提交、基于时间戳、基于项目)如何影响现有提交消息生成模型的性能?
- RQ3训练和评估数据集中语言多样性在多大程度上影响模型的泛化能力和性能?
- RQ4对现有检索式模型进行简单修改(如 n-gram 索引、平滑处理)是否能显著提升性能?
- RQ5当前提交消息生成模型评估实践中存在哪些关键局限性和威胁?
主要发现
- BLEU-Norm 变体与人工判断的相关性最高(皮尔逊相关系数 r = 0.62,斯皮尔曼等级相关系数 ρ = 0.58),因此是最适合评估提交消息生成模型的指标。
- 模型性能在很大程度上受数据集划分策略的影响:在基于提交的划分下模型表现更优,而在基于项目或时间戳的划分下性能显著下降。
- MCMD 数据集包含五种编程语言的超过 360 万个提交消息,揭示了现有大多数数据集严重偏向 Java,限制了模型的泛化能力。
- 将检索索引从 1-gram 提升至 4-gram 表示法(NNGen-Gram4)后,BLEU-Norm 从 23.07 提升至 23.92;结合平滑处理(NNGen-Smooth-Gram4)后进一步提升至 24.03。
- 现有模型在基于项目和时间戳的划分下表现出有限的泛化能力,表明需要更优的数据划分策略和数据增强方法。
- 人工评估揭示了显著的偏见风险,但通过明确的评分规则和评分者讨论得以缓解,确保了评分者之间较低的标准差。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。