CCT5:一种面向代码变更的预训练模型
CCT5: A Code-Change-Oriented Pre-Trained Model
AI总结:
为解决现有模型难以处理代码变更任务的问题,提出面向代码变更的预训练模型CCT5,基于150万对数据构建五个预训练任务,在多项代码变更与审查任务上优于现有方法。
摘要:
软件处于不断变化之中,要求开发者及时执行若干派生任务,例如为代码变更的意图编写描述,或识别易出缺陷的代码变更。考虑到处理这些任务的成本通常占软件开发总支出很大比例(通常约70%),自动化此类流程将显著减轻开发者的负担。为实现这一目标,现有方法主要依赖从头训练深度学习模型或在特定任务上微调现有预训练模型,两者均存在不足。具体而言,前者使用相对小规模的标注数据进行训练,难以学习并利用大量未标注代码中隐藏的编程语言领域知识;后者则难以充分利用预训练模型已学到的知识,因为现有预训练模型被设计为编码单个代码片段,而非代码变更(即两段代码片段之间的差异)。我们提出预训练一个专为代码变更设计的模型,以更好地支持开发者的软件维护工作。为此,我们首先收集了一个包含150万对以上代码变更与提交信息的大规模数据集。基于这些数据,我们设计了五个不同的预训练任务,使模型具备关于代码变更的多样化领域知识。我们在由代码变更引发的三个被广泛研究的任务以及两个特定于代码审查过程的任务上微调预训练模型CCT5。结果表明,CCT5在这些任务上均优于传统深度学习方法和现有预训练模型。
英文摘要:
Software is constantly changing, requiring developers to perform several derived tasks in a timely manner, such as writing a description for the intention of the code change, or identifying the defect-prone code changes. Considering that the cost of dealing with these tasks can account for a large proportion (typically around 70 percent) of the total development expenditure, automating such processes will significantly lighten the burdens of developers. To achieve such a target, existing approaches mainly rely on training deep learning models from scratch or fine-tuning existing pretrained models on such tasks, both of which have weaknesses. Specifically, the former uses comparatively small-scale labelled data for training, making it difficult to learn and exploit the domain knowledge of programming language hidden in the large-amount unlabelled code in the wild; the latter is hard to fully leverage the learned knowledge of the pre-trained model, as existing pre-trained models are designed to encode a single code snippet rather than a code change (i.e., the difference between two code snippets). We propose to pre-train a model specially designed for code changes to better support developers in software maintenance. To this end, we first collect a large-scale dataset containing 1.5M+ pairwise data of code changes and commit messages. Based on these data, we curate five different tasks for pre-training, which equip the model with diverse domain knowledge about code changes. We fine-tune the pre-trained model, CCT5, on three widely-studied tasks incurred by code changes and two tasks specific to the code review process. Results show that CCT5 outperforms both conventional deep learning approaches and existing pre-trained models on these tasks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。