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

By Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting-Wei Liu, Daxin Jiang and 1 more. 2020

4,078 citations recorded by the source corpus.

We present CodeBERT, a bimodal pre-trained model for programming language (PL) and natural language (NL). CodeBERT learns general-purpose representations that support downstream NL-PL applications such as natural language code search, 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. 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 NLPL probing.

Subfields: Artificial Intelligence, Information Systems, Large Language Models, Natural Language Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Mohit Bansal
  2. Jianfeng Gao
  3. Luke S. Zettlemoyer
  4. Percy Liang
  5. Graham Neubig
  6. Quoc V. Le
  7. Caiming Xiong
  8. Yoshua Bengio

In Information Systems

  1. Prem Devanbu
  2. Miltiadis Allamanis
  3. Charles Sutton
  4. Uri Alon
  5. Michael Pradel
  6. Yanqiao Zhu
  7. Yichen Xu
  8. Toufique Ahmed

In Large Language Models

  1. Jianfeng Gao
  2. Luke S. Zettlemoyer
  3. Graham Neubig
  4. Jimmy J. Lin
  5. Weizhu Chen
  6. Michael Lewis
  7. Ming Zhou
  8. Nan Duan

In Natural Language Processing

  1. Graham Neubig
  2. Luke S. Zettlemoyer
  3. Mohit Bansal
  4. Jianfeng Gao
  5. Percy Liang
  6. Richard Socher
  7. Caiming Xiong
  8. Quoc V. Le

Citations in the corpus