桥接预训练模型和下游任务以理解Source Code
Bridging Pre-trained Models and Downstream Tasks for Source Code Understanding
摘要:
随着预训练模型的巨大成功,预训练然后微调范式已被广泛用于下游任务,以理解源代码。然而,与从头开始训练大规模模型的成本相比,如何有效地使预训练模型适应新任务尚未得到充分探索。在本文中,我们提出了一种连接预训练模型和代码相关任务的方法。我们利用语义保持转换来丰富下游数据的多样性,并帮助预训练模型学习对这些语义等价转换不变的语义特征。此外,我们还引入了课程学习,以从易到难的方式组织转换后的数据,从而对现有的预训练模型进行微调。我们将我们的方法应用于一系列预先训练的模型,它们在源代码理解任务上的表现明显优于最先进的模型,例如算法分类,代码克隆检测和代码搜索。我们的实验甚至表明,在没有对代码数据进行大量预训练的情况下,使用我们的轻量级方法进行微调的自然语言预训练模型RoBERTa可以优于或媲美对上述任务进行微调的现有代码预训练模型,例如CodeBERT和GraphCodeBERT。这一发现表明,代码预训练模型仍有很大的改进空间。
英文摘要:
With the great success of pre-trained models, the pretrain-then-finetune paradigm has been widely adopted on downstream tasks for source code understanding. However, compared to costly training a large-scale model from scratch, how to effectively adapt pre-trained models to a new task has not been fully explored. In this paper, we propose an approach to bridge pre-trained models and code-related tasks. We exploit semantic-preserving transformation to enrich downstream data diversity, and help pre-trained models learn semantic features invariant to these semantically equivalent transformations. Further, we introduce curriculum learning to organize the transformed data in an easy-to-hard manner to fine-tune existing pre-trained models. We apply our approach to a range of pre-trained models, and they significantly outperform the state-of-the-art models on tasks for source code understanding, such as algorithm classification, code clone detection, and code search. Our experiments even show that without heavy pre-training on code data, natural language pre-trained model RoBERTa fine-tuned with our lightweight approach could outperform or rival existing code pre-trained models fine-tuned on the above tasks, such as CodeBERT and GraphCodeBERT. This finding suggests that there is still much room for improvement in code pre-trained models.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。