Learning and Evaluating Contextual Embedding of Source Code
arXiv:2001.00059
Abstract
Recent research has achieved impressive results on understanding and improving source code by building up on machine-learning techniques developed for natural languages. A significant advancement in natural-language understanding has come with the development of pre-trained contextual embeddings, such as BERT, which can be fine-tuned for downstream tasks with less labeled data and training budget, while achieving better accuracies. However, there is no attempt yet to obtain a high-quality contextual embedding of source code, and to evaluate it on multiple program-understanding tasks simultaneously; that is the gap that this paper aims to mitigate. Specifically, first, we curate a massive, deduplicated corpus of 7.4M Python files from GitHub, which we use to pre-train CuBERT, an open-sourced code-understanding BERT model; and, second, we create an open-sourced benchmark that comprises five classification tasks and one program-repair task, akin to code-understanding tasks proposed in the literature before. We fine-tune CuBERT on our benchmark tasks, and compare the resulting models to different variants of Word2Vec token embeddings, BiLSTM and Transformer models, as well as published state-of-the-art models, showing that CuBERT outperforms them all, even with shorter training, and with fewer labeled examples. Future work on source-code embedding can benefit from reusing our benchmark, and from comparing against CuBERT models as a strong baseline.
Published in ICML 2020. This version (v.3) is the final camera-ready version of the paper. It contains the re-computed results, based on the open-sourced datasets
Cited by in corpus (38)
- CodeBLEU: a Method for Automatic Evaluation of Code Synthesis
- Natural Attack for Pre-trained Models of Code
- Neural Transfer Learning for Repairing Security Vulnerabilities in C Code
- No More Fine-Tuning? An Experimental Evaluation of Prompt Tuning in Code Intelligence
- Natural Language Generation and Understanding of Big Code for AI-Assisted Programming: A Review
- TOGA: A Neural Method for Test Oracle Generation
- An Empirical Study on the Usage of Transformer Models for Code Completion
- Semantic Robustness of Models of Source Code
- Recommending Metamodel Concepts during Modeling Activities with Pre-Trained Language Models
- SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representation
- Bugs in Quantum Computing Platforms: An Empirical Study
- Language-Agnostic Representation Learning of Source Code from Structure and Context
- Exploring Software Naturalness through Neural Language Models
- On the Effectiveness of Transfer Learning for Code Search
- Self-Supervised Bug Detection and Repair
- Program Synthesis with Large Language Models
- Combiner: Full Attention Transformer with Sparse Computation Cost
- Revisiting the Plastic Surgery Hypothesis via Large Language Models
- Software Vulnerability Detection via Deep Learning over Disaggregated Code Graph Representation
- DOBF: A Deobfuscation Pre-Training Objective for Programming Languages
- The EarlyBIRD Catches the Bug: On Exploiting Early Layers of Encoder Models for More Efficient Code Classification
- Neural Code Search Revisited: Enhancing Code Snippet Retrieval through Natural Language Intent
- Learning to Find Usages of Library Functions in Optimized Binaries
- Leveraging Automated Unit Tests for Unsupervised Code Translation
- CS1QA: A Dataset for Assisting Code-based Question Answering in an Introductory Programming Course
- SEED: Semantic Graph based Deep detection for type-4 clone
- ProtoTransformer: A Meta-Learning Approach to Providing Student Feedback
- Enabling Automatic Repair of Source Code Vulnerabilities Using Data-Driven Methods
- GraphCode2Vec: Generic Code Embedding via Lexical and Program Dependence Analyses
- Deep Data Flow Analysis
- How could Neural Networks understand Programs?
- A Controlled Experiment of Different Code Representations for Learning-Based Bug Repair
- SYNFIX: Automatically Fixing Syntax Errors using Compiler Diagnostics
- Universal Policies for Software-Defined MDPs
- Universal Representation for Code
- Learning to Extend Program Graphs to Work-in-Progress Code
- Mining Program Properties From Neural Networks Trained on Source Code Embeddings
- Programming Puzzles