CCAF: Learning Code Change Via AdapterFusion

Wentao Zou,Zongwen Shen,Jidong Ge,Chuanyi Li,Bin Luo
DOI: https://doi.org/10.1145/3671016.3671399
2024-01-01
Abstract:Code changes are crucial because all code repositories can be viewed as composed of a series of code changes. Recent works on code changes prefer to use pre-trained models (PTMs) to capture the code change representations and have achieved remarkable success. However, these works usually compromise the original code representations of PTMs and ignore the relation of different code-change-related tasks. To boost the existing solutions to code-change-related tasks, we propose a new two-stage Code Change representation learning method using AdapterFusion, which is called CCAF. The first stage is knowledge extraction, where we freeze the parameters of the PTM and fine-tune additional parameters known as adapters. Each adapter acquires knowledge from a specific code-change-related task. The second stage, knowledge composition, employs AdapterFusion to compose the knowledge from all adapters, enhancing the PTM's performance on a specific code-change-related task. To assess the effectiveness of CCAF, we employ CodeT5 as the base PTM, with its parameters frozen, and apply CCAF to three code-change-related tasks: commit message generation, automated patch correctness assessment, and just-in-time defect prediction. The experimental results indicate that CCAF not only outperforms a fully fine-tuned CodeT5 but also performs comparably to the state-of-the-art method, CCRep.
What problem does this paper attempt to address?