Compared to Full-Model Fine-Tuning (FMFT), Parameter Efficient Fine-Tuning (PEFT) has demonstrated superior performance and lower computational overhead in several code understanding tasks, such as code summarization and code search. This advantage can be attributed to PEFT's ability to alleviate the catastrophic forgetting issue of Pre-trained Language Models (PLMs) by updating only a small number of parameters. As a result, PEFT effectively harnesses the pre-trained general-purpose knowledge for downstream tasks. However, existing studies primarily involve static code comprehension, aligning with the pre-training paradigm of recent PLMs and facilitating knowledge transfer, but they do not account for dynamic code changes. Thus, it remains unclear whether PEFT outperforms FMFT in task-specific adaptation for code-change-related tasks. To address this question, we examine two prevalent PEFT methods, namely Adapter Tuning (AT) and Low-Rank Adaptation (LoRA), and compare their performance with FMFT on five popular PLMs. Specifically, we evaluate their performance on two widely-studied code-change-related tasks: Just-In-Time Defect Prediction (JIT-DP) and Commit Message Generation (CMG). The results demonstrate that both AT and LoRA achieve state-of-the-art (SOTA) results in JIT-DP and exhibit comparable performances in CMG when compared to FMFT and other SOTA approaches. Furthermore, AT and LoRA exhibit superiority in cross-lingual and low-resource scenarios. We also conduct three probing tasks to explain the efficacy of PEFT techniques on JIT-DP and CMG tasks from both static and dynamic perspectives. The study indicates that PEFT, particularly through the use of AT and LoRA, offers promising advantages in code-change-related tasks, surpassing FMFT in certain aspects.
翻译:相较于全模型微调,参数高效微调在代码摘要和代码搜索等多项代码理解任务中展现出更优性能与更低计算开销。这一优势可归因于PEFT通过仅更新少量参数,有效缓解了预训练语言模型面临的灾难性遗忘问题。因此,PEFT能高效利用预训练的通用知识服务于下游任务。然而,现有研究主要涉及静态代码理解,这虽契合当前PLMs的预训练范式并促进知识迁移,却未考虑动态代码变更。因此,在面向代码变更任务的特定领域适配中,PEFT是否优于FMFT仍不明确。为解答此问题,我们考察了适配器调优与低秩适配两种主流PEFT方法,并在五个流行PLMs上将其性能与FMFT进行对比。具体而言,我们评估了它们在两项广泛研究的代码变更相关任务(即时缺陷预测与提交消息生成)中的表现。结果表明,与FMFT及其他当前最优方法相比,AT与LoRA在JIT-DP中均取得最优结果,在CMG中则表现相当。此外,AT与LoRA在跨语言和低资源场景中展现出优越性。我们还设计了三项探针任务,从静态与动态双重视角解释PEFT技术在JIT-DP与CMG任务上的有效性。研究表明,PEFT(特别是通过AT与LoRA的应用)在代码变更相关任务中展现出显著优势,在某些方面超越了FMFT。