A Metamorphic Testing Perspective on Knowledge Distillation for Language Models of Code: Does the Student Deeply Mimic the Teacher?
Not on the map. Why?
Abstract (arXiv)
Transformer-based language models of code have achieved state-of-the-art performance across a wide range of software analytics tasks, but their practical deployment remains limited due to high computational costs, slow inference speeds, and significant environmental impact. To address these challenges, recent research has increasingly explored knowledge distillation as a method for compressing a large language model of code (the teacher) into a smaller model (the student) while maintaining performance. However, the degree to which a student model deeply mimics the predictive behavior and internal representations of its teacher remains largely unexplored, as current accuracy-based evaluation provides only a surface-level view of model quality and often fails to capture more profound discrepancies in behavioral fidelity between the teacher and student models. To address this gap, we empirically show that the student model often fails to deeply mimic the teacher model, resulting in up to 285% greater performance drop under adversarial attacks, which is not captured by traditional accuracy-based evaluation. Therefore, we propose MetaCompress, a metamorphic testing framework that systematically evaluates behavioral fidelity by comparing the outputs of teacher and student models under a set of behavior-preserving metamorphic relations. We evaluate MetaCompress on two widely studied tasks, using compressed versions of popular language models of code, obtained via three different knowledge distillation techniques: Compressor, AVATAR, and MORPH. The results show that MetaCompress identifies up to 62% behavioral discrepancies in student models, underscoring the need for behavioral fidelity evaluation within the knowledge distillation pipeline and establishing MetaCompress as a practical framework for testing compressed language models of code derived through knowledge distillation.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 62 of its 99 references that are in the map. First posted on arXiv 7 Nov 2025.
Builds on
62 of 99 references.
References · 62
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2015Distilling the Knowledge in a Neural Networkcited by 10,076
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2017On Calibration of Modern Neural Networkscited by 4,860
- 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,243
- 2016A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networkscited by 2,362
- 2020MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformerscited by 1,414
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2019TinyBERT: Distilling BERT for Natural Language Understandingcited by 1,153
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
38 more
- 2019Relational Knowledge Distillationcited by 873
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2019Green AIcited by 620
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2019Patient Knowledge Distillation for BERT Model Compressioncited by 502
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
- 2020MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devicescited by 476
- 2013Do Deep Nets Really Need to be Deep?cited by 466
- 2020Movement Pruning: Adaptive Sparsity by Fine-Tuningcited by 398
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2020Knowledge Distillation and Student-Teacher Learning for Visual Intelligence: A Review and New Outlookscited by 312
- 2019Q8BERT: Quantized 8Bit BERTcited by 296
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 266
- 2023A Survey on Model Compression for Large Language Modelscited by 263
- 2020MiniLMv2: Multi-Head Self-Attention Relation Distillation for Compressing Pretrained Transformerscited by 240
- 2019Machine Learning Testing: Survey, Landscapes and Horizonscited by 213
- 2020Compressing BERT: Studying the Effects of Weight Pruning on Transfer Learningcited by 184
- 2019Distilling Task-Specific Knowledge from BERT into Simple Neural Networkscited by 152
- 2015Compressing Neural Networks with the Hashing Trickcited by 150
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 133
- 2019Adversarially Robust Distillationcited by 124
- 2020BERT-of-Theseus: Compressing BERT by Progressive Module Replacingcited by 112
- 2019Adversarial Robustness vs Model Compression, or Both?cited by 98
- 2024MT-Eval: A Multi-Turn Capabilities Evaluation Benchmark for Large Language Modelscited by 78
- 2021Revisiting Adversarial Robustness Distillation: Robust Soft Labels Make Student Bettercited by 77
- 2022Natural Attack for Pre-trained Models of Codecited by 72
- 2023Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)cited by 72
- 2020Metamorphic Testing: A New Approach for Generating Next Test Casescited by 71
- 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 68
- 2021A Survey on Green Deep Learningcited by 52
- 2022A Survey on Model Compression and Acceleration for Pretrained Language Modelscited by 45
- 2021Beyond Preserved Accuracy: Evaluating Loyalty and Robustness of BERT Compressioncited by 38
- 2023Lion: Adversarial Distillation of Proprietary Large Language Modelscited by 33
- 2025Hallucination Detection in Large Language Models with Metamorphic Relationscited by 24
- 2022Compressing Pre-trained Models of Code into 3 MBcited by 21
- 2023Greening Large Language Models of Codecited by 19
50 most cited of 62 All 62 (JSON)
Built on by
Citing papers per year: 2026: 1.
1 paper.
- 2026Knowledge Distillation Must Account for What It Losescited by 1
- 2026Knowledge Distillation Must Account for What It Loses28 Apr 2026