Pre-trained Contextual Embedding of Source Code

By Aditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen Shi. 2019

83 citations recorded by the source corpus.

The source code of a program not only serves as a formal description of an executable task, but it also serves to communicate developer intent in a human-readable form. To facilitate this, developers use meaningful identifier names and natural-language documentation. This makes it possible to successfully apply sequence-modeling approaches, shown to be effective in natural-language processing, to source code. A major advancement in natural-language understanding has been the use of pre-trained token embeddings; BERT and other works have further shown that pre-trained contextual embeddings can be extremely powerful and can be fine-tuned effectively for a variety of downstream supervised tasks. Inspired by these developments, we present the first attempt to replicate this success on source code. We curate a massive corpus of Python programs from GitHub to pre-train a BERT model, which we call Code Understanding BERT (CuBERT). We also pre-train Word2Vec embeddings on the same dataset. We create a benchmark of five classification tasks and compare fine-tuned CuBERT against sequence models trained with and without the Word2Vec embeddings. Our results show that CuBERT outperforms the baseline methods by a margin of 2.9-22%. We also show its superiority when fine-tuned with smaller datasets, and over fewer epochs. We further evaluate CuBERT's effectiveness on a joint classification, localization and repair task involving prediction of two pointers.

Subfields: Information Systems, Software, Representation & Self-Supervised Learning, Code Generation & Program Synthesis, Signal Processing

How researchers see this paper

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

In Information Systems

  1. Nan Duan
  2. Daya Guo
  3. Neel Sundaresan
  4. Alexey Svyatkovskiy
  5. Duyu Tang
  6. Jian Yin
  7. Colin B. Clement
  8. Ting-Wei Liu

In Software

  1. Neel Sundaresan
  2. Alexey Svyatkovskiy
  3. Daya Guo
  4. Nan Duan
  5. Jian Yin
  6. Colin B. Clement
  7. Shao Kun Deng
  8. Dawn Drain

In Representation & Self-Supervised Learning

  1. Ting-Wei Liu
  2. Bing Qin
  3. Duyu Tang
  4. Joseph E. Gonzalez
  5. Tianjun Zhang
  6. M. Zhou
  7. Neel Sundaresan
  8. Ajay Jain

In Code Generation & Program Synthesis

  1. Jian Yin
  2. Neel Sundaresan
  3. Shao Kun Deng
  4. Colin B. Clement
  5. Shengyu Fu
  6. Yanlin Wang
  7. Daya Guo
  8. Michele Tufano

In Signal Processing

  1. Long Zhou
  2. M. Zhou
  3. Jian Yin
  4. Neel Sundaresan
  5. Bing Qin
  6. Ajay Jain
  7. Qun Liu
  8. Pieter Abbeel

Citations in the corpus