[论文解读] Automatically Recommend Code Updates: Are We There Yet?
本文提出 AutoUpdate,首次对预训练代码语言模型(CodeLMs)如 CodeT5、CodeBERT 和 UniXcoder 在推荐 Android 代码更新方面的表现进行了全面评估。基于一个包含 209,000 个来自 3,195 个 Android 应用的更新方法的新数据集,实验表明在真实时间场景下的评估中,CodeLMs 相较于传统方法性能提升 190%–385%,其中 CodeT5 在各类更新类型中表现最佳。
In recent years, large pre-trained Language Models of Code (CodeLMs) have shown promising results on various software engineering tasks. One such task is automatic code update recommendation, which transforms outdated code snippets into their approved and revised counterparts. Although many CodeLM-based approaches have been proposed, claiming high accuracy, their effectiveness and reliability on real-world code update tasks remain questionable. In this paper, we present the first extensive evaluation of state-of-the-art CodeLMs for automatically recommending code updates. We assess their performance on two diverse datasets of paired updated methods, considering factors such as temporal evolution, project specificity, method size, and update complexity. Our results reveal that while CodeLMs perform well in settings that ignore temporal information, they struggle in more realistic time-wise scenarios and generalize poorly to new projects. Furthermore, CodeLM performance decreases significantly for larger methods and more complex updates. Furthermore, we observe that many CodeLM-generated "updates" are actually null, especially in time-wise settings, and meaningful edits remain challenging. Our findings highlight the significant gap between the perceived and actual effectiveness of CodeLMs for real-world code update recommendation and emphasize the need for more research on improving their practicality, robustness, and generalizability.
研究动机与目标
- 探究预训练 CodeLMs 在推荐 Android 应用自动化代码更新方面的可行性与有效性。
- 解决现有方法不针对 Android 特定代码更新(如 API 废弃与兼容性修复)的问题。
- 在真实时间划分评估场景下评估 CodeLM 的性能,避免因随机数据划分导致的过于乐观的结果。
- 分析更新类型、方法大小与更新大小对 CodeLM 在 Android 代码更新推荐中性能的影响。
- 通过识别 CodeLM 在不断演化的 Android 生态系统中时间适应性与泛化能力的局限性,为未来研究奠定基础。
提出的方法
- 整理了一个独特的数据集,包含来自 3,195 个在 GitHub 上托管、并在 2008 至 2022 年间发布于 Google Play 的开源 Android 应用的 209,000 对成对更新方法。
- 在序列到序列生成框架下,评估了最先进的 CodeLMs(CodeT5、CodeBERT、CodeGPT、UniXcoder 和 T5)在推荐代码更新任务中的表现。
- 采用束搜索解码策略,通过不同束宽评估不同推理策略下的生成质量与鲁棒性。
- 实施时间划分评估场景,即模型在旧版本代码上训练,于未来更新上测试,以模拟真实世界部署条件。
- 通过消融研究分析更新类型、方法大小与更新大小对模型性能的影响。
- 使用标准指标(如精确匹配与 BLEU)评估生成代码更新的预测准确率与语言流畅性。
实验结果
研究问题
- RQ1预训练 CodeLMs 与传统深度学习模型(如 Tufano et al., AutoTransform)相比,在推荐 Android 代码更新方面表现如何?
- RQ2与随机数据划分相比,采用时间划分评估场景对 CodeLM 性能评估结果有何影响?
- RQ3在 Android 应用的不同代码更新类型中,哪种 CodeLM 架构(如 CodeT5、CodeBERT)表现最佳?
- RQ4更新类型、方法大小与更新大小如何影响 CodeLM 在代码更新推荐中的性能?
- RQ5CodeLM 在不同 Android 应用代码库及不断演化的 API 变更中,其泛化能力如何?
主要发现
- 预训练 CodeLMs 显著优于传统基线模型,在真实时间划分评估中,完美预测准确率提升 190%–385%。
- CodeT5 在所有更新类型中均保持最高性能,展现出在 Android 代码更新推荐中卓越的泛化能力与适应性。
- 时间划分评估表明,随机数据划分会导致性能估计过于乐观,凸显未来软件工程模型评估中时间验证的必要性。
- 该数据集包含多样化的更新类型,其中重构与错误修复最为常见,表明模型需具备对多种变更语义的泛化能力。
- 随着方法大小与更新大小的增加,模型性能下降,表明在处理复杂或大规模代码转换时面临挑战。
- CodeLM 展现出在自动化 Android 代码更新方面的强大潜力,但其时间适应性与对演化 API 的鲁棒性仍是未来研究的关键挑战。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。