Generating Bug-Fixes Using Pretrained Transformers
arXiv:2104.07896 · doi:10.1145/3460945.3464951
Abstract
Detecting and fixing bugs are two of the most important yet frustrating parts of the software development cycle. Existing bug detection tools are based mainly on static analyzers, which rely on mathematical logic and symbolic reasoning about the program execution to detect common types of bugs. Fixing bugs is typically left out to the developer. In this work we introduce DeepDebug: a data-driven program repair approach which learns to detect and fix bugs in Java methods mined from real-world GitHub repositories. We frame bug-patching as a sequence-to-sequence learning task consisting of two steps: (i) denoising pretraining, and (ii) supervised finetuning on the target translation task. We show that pretraining on source code programs improves the number of patches found by 33% as compared to supervised training from scratch, while domain-adaptive pretraining from natural language to code further improves the accuracy by another 32%. We refine the standard accuracy evaluation metric into non-deletion and deletion-only fixes, and show that our best model generates 75% more non-deletion fixes than the previous state of the art. In contrast to prior work, we attain our best results when generating raw code, as opposed to working with abstracted code that tends to only benefit smaller capacity models. Finally, we observe a subtle improvement from adding syntax embeddings along with the standard positional embeddings, as well as with adding an auxiliary task to predict each token's syntactic class. Despite focusing on Java, our approach is language agnostic, requiring only a general-purpose parser such as tree-sitter.
References in corpus (9)
- Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
- Scaling Laws for Neural Language Models
- SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repair
- fairseq: A Fast, Extensible Toolkit for Sequence Modeling
- Get To The Point: Summarization with Pointer-Generator Networks
- Semantic Code Repair using Neuro-Symbolic Transformation Networks
- ENCORE: Ensemble Learning using Convolution Neural Machine Translation for Automatic Program Repair
- Encoder-Decoder Models Can Benefit from Pre-trained Masked Language Models in Grammatical Error Correction
- Parallel Iterative Edit Models for Local Sequence Transduction
Cited by in corpus (4)
- DeepDebug: Fixing Python Bugs Using Stack Traces, Backtranslation, and Code Skeletons
- Exploring and Evaluating Personalized Models for Code Generation
- Self-Supervised Learning to Prove Equivalence Between Straight-Line Programs via Rewrite Rules
- Long-Range Modeling of Source Code Files with eWASH: Extended Window Access by Syntax Hierarchy