基于适配器模块的自然语言到代码的跨模态转换
On The Cross-Modal Transfer from Natural Language to Code through Adapter Modules
摘要:
预训练神经语言模型(PTLM),例如CodeBERT,最近在软件工程中用作在大型源代码语料库上预训练的模型。他们的知识通过微调转移到下游任务(例如代码克隆检测)。在自然语言处理(NLP)中,通过使用插入在PTLM的层中的适配器、紧凑的、参数有效的模块,探索用于传递PTLM的知识的其他替代方案。尽管与需要重新训练所有模型参数的微调模型相比,适配器有助于适应许多下游任务-这归功于适配器的即插即用性质和参数效率-但它们在软件工程中的使用尚未探索。在这里,我们探讨了使用适配器的知识转移,并根据Hindle等人提出的自然性假设。al \cite{hindle2016naturalness} .因此,研究的双峰适配器的完形填空测试和代码克隆检测两个任务,从CodeXGLUE平台的基准相比。这些适配器使用程序设计语言进行训练,并插入在英语语料库(N-PTLM)上进行预训练的PTLM中。三种程序设计语言,C/C++,Python和Java,随着广泛的实验,用于适配器的最佳设置进行了研究。改进N-PTLM的结果证实了适配器在知识转移到软件工程方面的成功,这有时与在源代码上训练的PTLM的结果相当或超过PTLM的结果;同时在参数数量、内存使用和推理时间方面更有效。我们的研究结果可以为更多的软件工程任务建立更小的模型开辟新的方向。我们开源了所有的脚本和经过训练的适配器。
英文摘要:
Pre-trained neural Language Models (PTLM), such as CodeBERT, are recently used in software engineering as models pre-trained on large source code corpora. Their knowledge is transferred to downstream tasks (e.g. code clone detection) via fine-tuning. In natural language processing (NLP), other alternatives for transferring the knowledge of PTLMs are explored through using adapters, compact, parameter efficient modules inserted in the layers of the PTLM. Although adapters are known to facilitate adapting to many downstream tasks compared to fine-tuning the model that require retraining all of the models' parameters -- which owes to the adapters' plug and play nature and being parameter efficient -- their usage in software engineering is not explored. Here, we explore the knowledge transfer using adapters and based on the Naturalness Hypothesis proposed by Hindle et. al \cite{hindle2016naturalness}. Thus, studying the bimodality of adapters for two tasks of cloze test and code clone detection, compared to their benchmarks from the CodeXGLUE platform. These adapters are trained using programming languages and are inserted in a PTLM that is pre-trained on English corpora (N-PTLM). Three programming languages, C/C++, Python, and Java, are studied along with extensive experiments on the best setup used for adapters. Improving the results of the N-PTLM confirms the success of the adapters in knowledge transfer to software engineering, which sometimes are in par with or exceed the results of a PTLM trained on source code; while being more efficient in terms of the number of parameters, memory usage, and inference time. Our results can open new directions to build smaller models for more software engineering tasks. We open source all the scripts and the trained adapters.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。