Command Palette
Search for a command to run...

Abstract
We present CodeBERT, a bimodal pre-trained model for programming language(PL) and nat-ural language (NL). CodeBERT learns general-purposerepresentations that support downstream NL-PL applications such as naturallanguage codesearch, code documentation generation, etc. We develop CodeBERTwith Transformer-based neural architecture, and train it with a hybridobjective function that incorporates the pre-training task of replaced tokendetection, 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 latterhelps to learn better generators. We evaluate CodeBERT on two NL-PLapplications by fine-tuning model parameters. Results show that CodeBERTachieves state-of-the-art performance on both natural language code search andcode documentation generation tasks. Furthermore, to investigate what type ofknowledge is learned in CodeBERT, we construct a dataset for NL-PL probing, andevaluate in a zero-shot setting where parameters of pre-trained models arefixed. Results show that CodeBERT performs better than previous pre-trainedmodels on NL-PL probing.
Code Repositories
Benchmarks
| Benchmark | Methodology | Metrics |
|---|---|---|
| code-documentation-generation-on | Transformer | Smoothed BLEU-4: 13.44 |
| code-documentation-generation-on | CodeBERT (MLM) | Smoothed BLEU-4: 15.48 |
| code-documentation-generation-on | pre-train w/ code only | Smoothed BLEU-4: 15.12 |
| code-documentation-generation-on | seq2seq | Smoothed BLEU-4: 13.04 |
| code-documentation-generation-on | CodeBERT (MLM+RTD) | Smoothed BLEU-4: 15.41 |
| code-documentation-generation-on | RoBERTa | Smoothed BLEU-4: 14.92 |
| code-documentation-generation-on-1 | pre-train w/ code only | Smoothed BLEU-4: 13.07 |
| code-documentation-generation-on-1 | CodeBERT (MLM+RTD) | Smoothed BLEU-4: 14.56 |
| code-documentation-generation-on-1 | RoBERTa | Smoothed BLEU-4: 13.2 |
| code-documentation-generation-on-1 | Transformer | Smoothed BLEU-4: 12.57 |
| code-documentation-generation-on-1 | CodeBERT (MLM) | Smoothed BLEU-4: 13.59 |
| code-documentation-generation-on-1 | CodeBERT (RTD) | Smoothed BLEU-4: 12.72 |
| code-documentation-generation-on-1 | seq2seq | Smoothed BLEU-4: 11.42 |
| code-documentation-generation-on-2 | RoBERTa | Smoothed BLEU-4: 26.09 |
| code-documentation-generation-on-2 | pre-train w/ code only | Smoothed BLEU-4: 26.39 |
| code-documentation-generation-on-2 | CodeBERT (RTD) | Smoothed BLEU-4: 26.02 |
| code-documentation-generation-on-2 | CodeBERT (MLM) | Smoothed BLEU-4: 26.79 |
| code-documentation-generation-on-2 | seq2seq | Smoothed BLEU-4: 23.48 |
| code-documentation-generation-on-2 | CodeBERT (MLM+RTD) | Smoothed BLEU-4: 26.66 |
| code-documentation-generation-on-3 | pre-train w/ code only | Smoothed BLEU-4: 20.71 |
| code-documentation-generation-on-3 | CodeBERT (RTD) | Smoothed BLEU-4: 20.25 |
| code-documentation-generation-on-3 | CodeBERT (MLM+RTD) | Smoothed BLEU-4: 21.32 |
| code-documentation-generation-on-3 | seq2seq | Smoothed BLEU-4: 18.4 |
| code-documentation-generation-on-3 | RoBERTa | Smoothed BLEU-4: 19.9 |
| code-documentation-generation-on-3 | Transformer | Smoothed BLEU-4: 18.25 |
| code-documentation-generation-on-3 | CodeBERT (MLM) | Smoothed BLEU-4: 21 |
| code-documentation-generation-on-4 | CodeBERT (MLM+RTD) | Smoothed BLEU-4: 8.46 |
| code-documentation-generation-on-4 | RoBERTa | Smoothed BLEU-4: 7.26 |
| code-documentation-generation-on-4 | CodeBERT (MLM) | Smoothed BLEU-4: 7.95 |
| code-documentation-generation-on-4 | Transformer | Smoothed BLEU-4: 7.87 |
| code-documentation-generation-on-4 | seq2seq | Smoothed BLEU-4: 6.96 |
| code-documentation-generation-on-4 | pre-train w/ code only | Smoothed BLEU-4: 7.36 |
| code-documentation-generation-on-5 | seq2seq | Smoothed BLEU-4: 6.88 |
| code-documentation-generation-on-5 | Transformer | Smoothed BLEU-4: 25.61 |
| code-documentation-generation-on-5 | pre-train w/ code only | Smoothed BLEU-4: 8.3 |
| code-documentation-generation-on-5 | CodeBERT (MLM+RTD) | Smoothed BLEU-4: 9.54 |
| code-documentation-generation-on-5 | CodeBERT (RTD) | Smoothed BLEU-4: 8.73 |
| code-documentation-generation-on-5 | CodeBERT (MLM) | Smoothed BLEU-4: 8.51 |
| code-documentation-generation-on-5 | RoBERTa | Smoothed BLEU-4: 5.72 |
| code-documentation-generation-on-6 | CodeBERT (MLM+RTD) | Smoothed BLEU-4: 15.99 |
| code-documentation-generation-on-6 | CodeBERT (RTD) | Smoothed BLEU-4: 15.03 |
| code-documentation-generation-on-6 | RoBERTa | Smoothed BLEU-4: 14.52 |
| code-documentation-generation-on-6 | Transformer | Smoothed BLEU-4: 14.31 |
| code-documentation-generation-on-6 | pre-train w/ code only | Smoothed BLEU-4: 15.15 |
| code-documentation-generation-on-6 | seq2seq | Smoothed BLEU-4: 13.36 |
| code-documentation-generation-on-6 | CodeBERT (MLM) | Smoothed BLEU-4: 15.55 |
| code-search-on-codesearchnet | CodeBERT | Go: 69.3 JS: 74.8 Java: 86.8 Overall: 76.0 PHP: 70.6 Python: 84.0 Ruby: 70.6 |
| type-prediction-on-manytypes4typescript | CodeBERT | Average Accuracy: 61.72 Average F1: 59.57 Average Precision: 59.34 Average Recall: 59.80 |
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.