CCRep: Learning Code Change Representations via Pre-Trained Code Model and Query Back
Authors:
- 1 May 2023
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 17-29
Abstract
Representing code changes as numeric feature vectors, i.e., code change representations, is usually an essential step to automate many software engineering tasks related to code changes, e.g., commit message generation and just-in-time defect prediction. Intuitively, the quality of code change representations is crucial for the effectiveness of automated approaches. Prior work on code changes usually designs and evaluates code change representation approaches for a specific task, and little work has investigated code change encoders that can be used and jointly trained on various tasks. To fill this gap, this work proposes a novel Code Change Representation learning approach named CCRep, which can learn to encode code changes as feature vectors for diverse downstream tasks. Specifically, CCRep regards a code change as the combination of its before-change and after-change code, leverages a pre-trained code model to obtain high-quality contextual embeddings of code, and uses a novel mechanism named query back to extract and encode the changed code fragments and make them explicitly interact with the whole code change. To evaluate CCRep and demonstrate its applicability to diverse code-change-related tasks, we apply it to three tasks: commit message generation, patch correctness assessment, and just-in-time defect prediction. Experimental results show that CCRep outperforms the state-of-the-art techniques on each task.Keywords
All Related Versions
Funding Information
- Fundação de Amparo à Pesquisa do Estado de São Paulo (62202420)
This publication has 41 references indexed in Scilit:
- Neural Machine Translation of Rare Words with Subword Units2016
- Studying just-in-time defect prediction using cross-project modelsEmpirical Software Engineering, 2015
- Is the cure worse than the disease? overfitting in automated program repair2015
- An analysis of patch plausibility and correctness for generate-and-validate patch generation systems2015
- Partitioning Composite Code Changes to Facilitate Code Review2015
- Untangling fine-grained code changes2015
- Boa: A language and infrastructure for analyzing ultra-large-scale software repositories2013
- Identifying Linux bug fixing patches2012
- BLEU2001
- Long Short-Term MemoryNeural Computation, 1997