arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2108.05890cs.SE
收藏

代码搜索的迁移学习有效性研究

On the Effectiveness of Transfer Learning for Code Search

Pasquale Salza, Christoph Schwizer, Jian Gu, Harald C. Gall

摘要:

Transformer架构和迁移学习标志着自然语言处理的巨大飞跃,提高了一系列基于文本的任务的最新技术水平。本文将探讨如何将这些改进应用于代码搜索并改进代码搜索。为此,我们在自然语言和源代码数据的组合上预训练基于BERT的模型,并在StackOverflow问题标题和代码答案对上对其进行微调。我们的结果表明,预训练的模型始终优于未预训练的模型。在模型是在自然语言"和"源代码数据上进行预训练的情况下,它的性能也优于基于Lucene的信息检索基线。此外,我们还证明了将基于信息检索的方法与Transformer结合使用可以获得最佳的整体结果,特别是在搜索大型搜索池时。当有大量预训练数据可用并且微调数据有限时,迁移学习特别有效。我们证明了基于Transformer架构的自然语言处理模型可以直接应用于源代码分析任务,如代码搜索。随着专门为处理源代码数据而设计的Transformer模型的发展,我们相信源代码分析任务的结果可以得到进一步改进。

英文摘要:

The Transformer architecture and transfer learning have marked a quantum leap in natural language processing, improving the state of the art across a range of text-based tasks. This paper examines how these advancements can be applied to and improve code search. To this end, we pre-train a BERT-based model on combinations of natural language and source code data and fine-tune it on pairs of StackOverflow question titles and code answers. Our results show that the pre-trained models consistently outperform the models that were not pre-trained. In cases where the model was pre-trained on natural language "and" source code data, it also outperforms an information retrieval baseline based on Lucene. Also, we demonstrated that the combined use of an information retrieval-based approach followed by a Transformer leads to the best results overall, especially when searching into a large search pool. Transfer learning is particularly effective when much pre-training data is available and fine-tuning data is limited. We demonstrate that natural language processing models based on the Transformer architecture can be directly applied to source code analysis tasks, such as code search. With the development of Transformer models designed more specifically for dealing with source code data, we believe the results of source code analysis tasks can be further improved.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑