arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2002.08155cs.CLcs.PL
收藏

CodeBERT:一个用于编程和自然语言的预训练模型

CodeBERT: A Pre-Trained Model for Programming and Natural Languages

Research Center for Social Computing and Information Retrieval, Harbin Institute of Technology(哈尔滨工业大学社会计算与信息检索研究中心);The School of Data and Computer Science, Sun Yat-sen University(中山大学数据与计算机科学学院);Microsoft Research Asia(微软亚洲研究院);Microsoft Search Technology Center Asia(微软亚洲搜索技术中心)

Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting Liu, Daxin Jiang, Ming Zhou

摘要:

我们提出了CodeBERT,一个用于程序设计语言(PL)和自然语言(NL)的双峰预训练模型。CodeBERT学习通用的表示,支持下游NL-PL应用程序,如自然语言codestrapping,代码文档生成等,我们开发CodeBERT与基于变压器的神经架构,并训练它与混合目标函数,其中包括替换令牌检测,这是检测从发电机采样的似是而非的替代品的预训练任务。这使我们能够利用NL-PL对的双峰数据和单峰数据,前者为模型训练提供输入令牌,而后者有助于学习更好的生成器。我们评估CodeBERT两个NL-PL应用程序通过微调模型参数。结果表明,CodeBERT在自然语言代码搜索和代码文档生成任务上都达到了最先进的性能。此外,为了研究在CodeBERT中学习到什么类型的知识,我们构建了一个用于NL-PL探测的数据集,并在预训练模型的参数固定的零射击(zero-shot)设置中进行评估。结果表明,CodeBERT在NL-PL探测上的表现优于以前的预训练模型。

英文摘要:

We present CodeBERT, a bimodal pre-trained model for programming language (PL) and nat-ural language (NL). CodeBERT learns general-purpose representations that support downstream NL-PL applications such as natural language codesearch, code documentation generation, etc. We develop CodeBERT with Transformer-based neural architecture, and train it with a hybrid objective function that incorporates the pre-training task of replaced token detection, which is to detect plausible alternatives sampled from generators. This enables us to utilize both bimodal data of NL-PL pairs and unimodal data, where the former provides input tokens for model training while the latter helps to learn better generators. We evaluate CodeBERT on two NL-PL applications by fine-tuning model parameters. Results show that CodeBERT achieves state-of-the-art performance on both natural language code search and code documentation generation tasks. Furthermore, to investigate what type of knowledge is learned in CodeBERT, we construct a dataset for NL-PL probing, and evaluate in a zero-shot setting where parameters of pre-trained models are fixed. Results show that CodeBERT performs better than previous pre-trained models on NL-PL probing.

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

↑