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

当语言模型遇到私有库

When Language Model Meets Private Library

Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学);Microsoft Research Asia(微软亚洲研究院)

Daoguang Zan, Bei Chen, Zeqi Lin, Bei Guan, Yongji Wang, Jian-Guang Lou

摘要:

随着预训练技术的迅速发展,大量的语言模型已经在大规模的代码语料库上进行了预训练,并在代码生成中表现良好。在本文中,我们研究了如何使预先训练好的语言模型具有为私有库生成代码生成的能力。在实践中,程序员使用私有库编写代码是很常见的。然而,这对语言模型来说是一个挑战,因为它们在训练期间从未见过私有API。受私有库通常附带详细的API文档这一事实的启发,我们提出了一个具有两个模块的新框架:APIRetriever发现有用的API,然后APICoder使用这些API生成代码。对于API检索器,我们提出了一个稠密检索系统,并设计了一个友好的交互,涉及使用。对于APICoder,我们可以直接使用现成的语言模型,或者在包含API信息的代码语料库上持续预训练基础模型。这两个模块都是用公共图书馆的数据训练的,可以推广到私人图书馆。此外,我们为私有库制作了三个基准测试,分别为TorchDataEval、MonkeyEval和BeatNumEval。实验结果表明,令人印象深刻的性能,我们的框架。

英文摘要:

With the rapid development of pre-training techniques, a number of language models have been pre-trained on large-scale code corpora and perform well in code generation. In this paper, we investigate how to equip pre-trained language models with the ability of code generation for private libraries. In practice, it is common for programmers to write code using private libraries. However, this is a challenge for language models since they have never seen private APIs during training. Motivated by the fact that private libraries usually come with elaborate API documentation, we propose a novel framework with two modules: the APIRetriever finds useful APIs, and then the APICoder generates code using these APIs. For APIRetriever, we present a dense retrieval system and also design a friendly interaction to involve uses. For APICoder, we can directly use off-the-shelf language models, or continually pre-train the base model on a code corpus containing API information. Both modules are trained with data from public libraries and can be generalized to private ones. Furthermore, we craft three benchmarks for private libraries, named TorchDataEval, MonkeyEval, and BeatNumEval. Experimental results demonstrate the impressive performance of our framework.

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

↑