Structure-aware Fine-tuning for Code Pre-trained Models

Jiayi Wu, Renyu Zhu, Nuo Chen, Qiushi Sun, Xiang Li +1 more
4/11/2024
cs.SEcs.AIcs.CL

No confident code implementation found for this paper. 3 possible matches can be shown below.

Abstract

Over the past few years, we have witnessed remarkable advancements in Code Pre-trained Models (CodePTMs). These models achieved excellent representation capabilities by designing structure-based pre-training tasks for code. However, how to enhance the absorption of structural knowledge when fine-tuning CodePTMs still remains a significant challenge. To fill this gap, in this paper, we present Structure-aware Fine-tuning (SAT), a novel structure-enhanced and plug-and-play fine-tuning method for CodePTMs. We first propose a structure loss to quantify the difference between the information learned by CodePTMs and the knowledge extracted from code structure. Specifically, we use the attention scores extracted from Transformer layer as the learned structural information, and the shortest path length between leaves in abstract syntax trees as the structural knowledge. Subsequently, multi-task learning is introduced to improve the performance of fine-tuning. Experiments conducted on four pre-trained models and two generation tasks demonstrate the effectiveness of our proposed method as a plug-and-play solution. Furthermore, we observed that SAT can benefit CodePTMs more with limited training data.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 3 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{wu2024structureaware,
  title  = {Structure-aware Fine-tuning for Code Pre-trained Models},
  author = {Jiayi Wu and Renyu Zhu and Nuo Chen and Qiushi Sun and Xiang Li and Ming Gao},
  year   = {2024},
  eprint = {2404.07471},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.07471v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.07471.svg)](https://codeofpaper.com/paper/2404.07471)

Discussion