When Language Model Meets Private Library

Daoguang Zan, Bei Chen, Zeqi Lin, Bei Guan, Yongji Wang +1 more
10/31/2022
cs.PLcs.CLcs.SE

Official code: microsoft/PyCodeGPT (282 stars, Python, MIT, last commit 2023-06-12).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

MIT

A pre-trained GPT model for Python code completion and generation

28243Python, ShellMar 9, 20223 years agoMIT

Similar Papers

Cite this paper

@article{zan2022when,
  title  = {When Language Model Meets Private Library},
  author = {Daoguang Zan and Bei Chen and Zeqi Lin and Bei Guan and Yongji Wang and Jian-Guang Lou},
  year   = {2022},
  eprint = {2210.17236},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2210.17236}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2210.17236.svg)](https://codeofpaper.com/paper/2210.17236)

Discussion