论文标题

使用转移学习与代码相关的任务

Using Transfer Learning for Code-Related Tasks

论文作者

Mastropaolo, Antonio, Cooper, Nathan, Palacio, David Nader, Scalabrino, Simone, Poshyvanyk, Denys, Oliveto, Rocco, Bavota, Gabriele

论文摘要

深度学习(DL)技术已被用来支持几个与代码相关的任务,例如代码摘要和固定错误。特别是,预先训练的变压器模型正在上升,这也归功于他们在自然语言处理(NLP)任务中取得的出色结果。这些模型背后的基本思想是首先使用自我监管的任务(例如,在句子中填充蒙版单词)在通用数据集上进行培训。然后,这些模型经过微调以支持特定的感兴趣任务(例如,语言翻译)。单个模型可以进行微调以支持多个任务,可能利用转移学习的好处。这意味着为解决特定任务(例如,语言翻译)所获得的知识对于提高另一个任务的性能很有用(例如情感分类)。尽管转移学习的好处已在NLP中得到了广泛的研究,但与代码相关的任务时,有限的经验证据可获得。在本文中,我们评估了文本到文本传输变压器(T5)模型的性能,以支持四个不同的代码相关任务:(i)自动漏洞固定,(ii)注入代码突变体,(iii)assert语句的生成和(iv)代码摘要。我们特别关注研究模型性能的预训练和多任务微调所扮演的角色。我们表明(i)与最先进的基线相比,T5可以取得更好的性能; (ii)虽然预训练有助于模型,但并非所有任务都受益于多任务微调。

Deep learning (DL) techniques have been used to support several code-related tasks such as code summarization and bug-fixing. In particular, pre-trained transformer models are on the rise, also thanks to the excellent results they achieved in Natural Language Processing (NLP) tasks. The basic idea behind these models is to first pre-train them on a generic dataset using a self-supervised task (e.g, filling masked words in sentences). Then, these models are fine-tuned to support specific tasks of interest (e.g, language translation). A single model can be fine-tuned to support multiple tasks, possibly exploiting the benefits of transfer learning. This means that knowledge acquired to solve a specific task (e.g, language translation) can be useful to boost performance on another task (e.g, sentiment classification). While the benefits of transfer learning have been widely studied in NLP, limited empirical evidence is available when it comes to code-related tasks. In this paper, we assess the performance of the Text-To-Text Transfer Transformer (T5) model in supporting four different code-related tasks: (i) automatic bug-fixing, (ii) injection of code mutants, (iii) generation of assert statements, and (iv) code summarization. We pay particular attention in studying the role played by pre-training and multi-task fine-tuning on the model's performance. We show that (i) the T5 can achieve better performance as compared to state-of-the-art baselines; and (ii) while pre-training helps the model, not all tasks benefit from a multi-task fine-tuning.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源