An Empirical Study of Knowledge Distillation for Code Understanding Tasks
On the map: Knowledge distillation → Knowledge distillation for LLMs
Abstract (arXiv)
Pre-trained language models (PLMs) have emerged as powerful tools for code understanding. However, deploying these PLMs in large-scale applications faces practical challenges due to their computational intensity and inference latency. Knowledge distillation (KD), a promising model compression and acceleration technique, addresses these limitations by transferring knowledge from large teacher models to compact student models, enabling efficient inference while preserving most of the teacher models' capabilities. While this technique has shown remarkable success in natural language processing and computer vision domains, its potential for code understanding tasks remains largely underexplored. In this paper, we systematically investigate the effectiveness and usage of KD in code understanding tasks. Our study encompasses two popular types of KD methods, i.e., logit-based and feature-based KD methods, experimenting across eight student models and two teacher PLMs from different domains on three downstream tasks. The experimental results indicate that KD consistently offers notable performance boosts across student models with different sizes compared with standard fine-tuning. Notably, code-specific PLM demonstrates better effectiveness as the teacher model. Among all KD methods, the latest feature-based KD methods exhibit superior performance, enabling student models to retain up to 98% teacher performance with merely 5% parameters. Regarding student architecture, our experiments reveal that similarity with teacher architecture does not necessarily lead to better performance. We further discuss the efficiency and behaviors in the KD process and inference, summarize the implications of findings, and identify promising future directions.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in Knowledge distillation for LLMs, one of 12 directions in Knowledge distillation. Builds on 44 of its 62 references that are in the map. First posted on arXiv 21 Aug 2025.
Builds on
44 of 62 references.
Closest ancestors · 2
Same direction, newest first
- 2023AD-KD: Attribution-Driven Knowledge Distillation for Language Model Compression17 May
- 2021Distilling Linguistic Context for Language Model Compression17 Sep
Other references · 42
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2015Distilling the Knowledge in a Neural Networkcited by 10,324
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,307
- 2014Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translationcited by 4,057
- 2018The Lottery Ticket Hypothesis: Finding Sparse, Trainable Neural Networkscited by 2,262
- 2020DeBERTa: Decoding-enhanced BERT with Disentangled Attentioncited by 2,181
- 2020MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformerscited by 1,463
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
30 more
- 2019TinyBERT: Distilling BERT for Natural Language Understandingcited by 1,167
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2019Are Sixteen Heads Really Better than One?cited by 816
- 2016Sequence-Level Knowledge Distillationcited by 801
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2024DeepSeek LLM: Scaling Open-Source Language Models with Longtermismcited by 642
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2024Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inferencecited by 554
- 2019Patient Knowledge Distillation for BERT Model Compressioncited by 508
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2021Distilling Knowledge via Knowledge Reviewcited by 288
- 2020MiniLMv2: Multi-Head Self-Attention Relation Distillation for Compressing Pretrained Transformerscited by 245
- 2022Knowledge Distillation from A Stronger Teachercited by 208
- 2022Knowledge Distillation with the Reused Teacher Classifiercited by 141
- 2020BERT-of-Theseus: Compressing BERT by Progressive Module Replacingcited by 113
- 2022Compression of Generative Pre-trained Language Models via Quantizationcited by 79
- 2021CoSQA: 20,000+ Web Queries for Code Search and Question Answeringcited by 75
- 2020Pre-trained Summarization Distillationcited by 71
- 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 69
- 2022A Survey on Model Compression and Acceleration for Pretrained Language Modelscited by 45
- 2019Learning and Evaluating Contextual Embedding of Source Codecited by 33
- 2021Bridging Pre-trained Models and Downstream Tasks for Source Code Understandingcited by 28
- 2020Opportunities and Challenges in Code Search Toolscited by 22
- 2022CoCoSoDa: Effective Contrastive Learning for Code Searchcited by 22
- 2022Compressing Pre-trained Models of Code into 3 MBcited by 21
- 2023Greening Large Language Models of Codecited by 19
- 2021A Short Study on Compressing Decoder-Based Language Modelscited by 16
- 2023Greener yet Powerful: Taming Large Code Generation Models with Quantizationcited by 4
- 2024Bridge and Hint: Extending Pre-trained Language Models for Long-Range Codecited by 2
Built on by
Citing papers per year: 2025: 1; 2026: 1.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2026KDFP: A first-principles approach to knowledge distillation in large language models
- 2025Feature Alignment and Representation Transfer in Knowledge Distillation for Large Language Models
- 2024A Survey on Knowledge Distillation of Large Language Models
- 2024DistiLLM: Towards Streamlined Distillation for Large Language Models
- 2026Understanding Knowledge Distillation in Post-Training: When It Helps and When It Fails
- 2025Knowledge Distillation and Dataset Distillation of Large Language Models: Emerging Trends, Challenges, and Future Directions
- 2025UNDO: Understanding Distillation as Optimization
- 2025Does Knowledge Distillation Matter for Large Language Model based Bundle Generation?