Towards Efficient Fine-tuning of Pre-trained Code Models: An Experimental Study and Beyond
Ensheng Shi, Yanlin Wang, Hongyu Zhang, Lun Du, Shi Han, Dongmei, Zhang, Hongbin Sun

TL;DR
This paper investigates how pre-trained code models encode code properties across layers and proposes a layer freezing method called Telly to fine-tune these models more efficiently without sacrificing performance.
Contribution
The paper provides an in-depth analysis of layer-wise code property encoding during fine-tuning and introduces Telly, a layer freezing approach that reduces training cost while maintaining or improving performance.
Findings
Lower, intermediate, and higher layers encode lexical, syntactic, and structural properties respectively.
Fine-tuning preserves most code properties encoded in the lower and intermediate layers.
Top two layers undergo the most change during fine-tuning, enabling efficient layer freezing.
Abstract
Recently, fine-tuning pre-trained code models such as CodeBERT on downstream tasks has achieved great success in many software testing and analysis tasks. While effective and prevalent, fine-tuning the pre-trained parameters incurs a large computational cost. In this paper, we conduct an extensive experimental study to explore what happens to layer-wise pre-trained representations and their encoded code knowledge during fine-tuning. We then propose efficient alternatives to fine-tune the large pre-trained code model based on the above findings. Our experimental study shows that (1) lexical, syntactic and structural properties of source code are encoded in the lower, intermediate, and higher layers, respectively, while the semantic property spans across the entire model. (2) The process of fine-tuning preserves most of the code properties. Specifically, the basic code properties captured…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Machine Learning and Data Classification
MethodsCodeBERT
