CERT: Continual Pre-Training on Sketches for Library-Oriented Code Generation

Daoguang Zan, Bei Chen, Dejian Yang, Zeqi Lin, Minsu Kim +4 more
6/14/2022
cs.SEcs.CLcs.PL

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

Abstract

Code generation is a longstanding challenge, aiming to generate a code snippet based on a natural language description. Usually, expensive text-code paired data is essential for training a code generation model.

Show full abstract

Recently, thanks to the success of pre-training techniques, large language models are trained on large-scale unlabelled code corpora and perform well in code generation. In this paper, we investigate how to leverage an unlabelled code corpus to train a model for library-oriented code generation. Since it is a common practice for programmers to reuse third-party libraries, in which case the text-code paired data are harder to obtain due to the huge number of libraries. We observe that library-oriented code snippets are more likely to share similar code sketches. Hence, we present CERT with two steps: a sketcher generates the sketch, then a generator fills the details in the sketch. Both the sketcher and the generator are continually pre-trained upon a base model using unlabelled data. Furthermore, we craft two benchmarks named PandasEval and NumpyEval to evaluate library-oriented code generation. Experimental results demonstrate the impressive performance of CERT. For example, it surpasses the base model by an absolute 15.67% improvement in terms of pass@1 on PandasEval. Our work is available at https://github.com/microsoft/PyCodeGPT.

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{zan2022cert,
  title  = {CERT: Continual Pre-Training on Sketches for Library-Oriented Code Generation},
  author = {Daoguang Zan and Bei Chen and Dejian Yang and Zeqi Lin and Minsu Kim and Bei Guan and Yongji Wang and Weizhu Chen and Jian-Guang Lou},
  year   = {2022},
  eprint = {2206.06888},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2206.06888}
}

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/2206.06888.svg)](https://codeofpaper.com/paper/2206.06888)

Discussion