How to Select Pre-Trained Code Models for Reuse? A Learning Perspective
Not on the map. Why?
Abstract (arXiv)
Pre-training a language model and then fine-tuning it has shown to be an efficient and effective technique for a wide range of code intelligence tasks, such as code generation, code summarization, and vulnerability detection. However, pretraining language models on a large-scale code corpus is computationally expensive. Fortunately, many off-the-shelf Pre-trained Code Models (PCMs), such as CodeBERT, CodeT5, CodeGen, and Code Llama, have been released publicly. These models acquire general code understanding and generation capability during pretraining, which enhances their performance on downstream code intelligence tasks. With an increasing number of these public pre-trained models, selecting the most suitable one to reuse for a specific task is essential. In this paper, we systematically investigate the reusability of PCMs. We first explore three intuitive model selection methods that select by size, training data, or brute-force fine-tuning. Experimental results show that these straightforward techniques either perform poorly or suffer high costs. Motivated by these findings, we explore learning-based model selection strategies that utilize pre-trained models without altering their parameters. Specifically, we train proxy models to gauge the performance of pre-trained models, and measure the distribution deviation between a model's latent features and the task's labels, using their closeness as an indicator of model transferability. We conduct experiments on 100 widely-used opensource PCMs for code intelligence tasks, with sizes ranging from 42.5 million to 3 billion parameters. The results demonstrate that learning-based selection methods reduce selection time to 100 seconds, compared to 2,700 hours with brute-force fine-tuning, with less than 6% performance degradation across related tasks.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 49 of its 77 references that are in the map. First posted on arXiv 7 Jan 2025.
Builds on
49 of 77 references.
References · 49
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023StarCoder: may the source be with you!cited by 790
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
37 more
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2018Do Better ImageNet Models Transfer Better?cited by 560
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 294
- 2020A Survey on Neural Network Interpretabilitycited by 291
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 266
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
- 2023CodeBERTScore: Evaluating Code Generation with Pretrained Models of Codecited by 101
- 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 100
- 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 99
- 2018Tree-to-tree Neural Networks for Program Translationcited by 93
- 2022An Information-Theoretic Approach to Transferability in Task Transfer Learningcited by 79
- 2022Natural Attack for Pre-trained Models of Codecited by 72
- 2021What to Pre-Train on? Efficient Intermediate Task Selectioncited by 62
- 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
- 2020Scalable Transfer Learning with Expert Modelscited by 48
- 2023An Empirical Study of Pre-Trained Model Reuse in the Hugging Face Deep Learning Model Registrycited by 45
- 2024Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedbackcited by 45
- 2019Multi-Modal Attention Network Learning for Semantic Source Code Retrievalcited by 40
- 2021Scalable Diverse Model Selection for Accessible Transfer Learningcited by 40
- 2023Model Spider: Learning to Rank Pre-Trained Models Efficientlycited by 32
- 2022How stable are Transferability Metrics evaluations?cited by 30
- 2022On the Transferability of Pre-trained Language Models for Low-Resource Programming Languagescited by 30
- 2021Ranking and Tuning Pre-trained Models: A New Paradigm for Exploiting Model Hubscited by 28
- 2020Neural Data Server: A Large-Scale Search Engine for Transfer Learning Datacited by 27
- 2021How could Neural Networks understand Programs?cited by 26
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2020Which Model to Transfer? Finding the Needle in the Growing Haystackcited by 21
- 2023Towards Efficient Fine-tuning of Pre-trained Code Models: An Experimental Study and Beyondcited by 20
- 2022AST-Probe: Recovering abstract syntax trees from hidden representations of pre-trained language modelscited by 16
- 2023Better Context Makes Better Code Language Models: A Case Study on Function Call Argument Completioncited by 14
- 2022Zero-Shot AutoML with Pretrained Modelscited by 13
- 2023Automating Code-Related Tasks Through Transformers: The Impact of Pre-trainingcited by 8
- 2024Coding-PTMs: How to Find Optimal Code Pre-trained Models for Code Embedding in Vulnerability Detection?cited by 4
- 2018SCC: Automatic Classification of Code Snippetscited by 2
Built on by
Not cited yet.